using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter3.Section4 { public class Example06 { public Example06() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType f = new Science.Mathematics.Function.ToLastType(func); Science.Mathematics.Function.ToLastType g = new Science.Mathematics.Function.ToLastType(gf); double[] x = { 1.0, -1.0 }; double l = 0.1; V.LagrangeMultiplierMethod obj = new V.LagrangeMultiplierMethod(f, g, x, l); obj.Compute(); result += obj.CriticalPoint[0].ToString() + "\r\n"; result += obj.CriticalPoint[1].ToString() + "\r\n"; result += obj.Lambda.ToString() + "\r\n"; } private double func(double[] x) { return x[0]*x[1]; } private double gf(double[] x) { return x[0] * x[0] + x[1] * x[1] - 1.0; } } } /* 0.707106781186576 -0.707106781186519 -0.499999999999982 */