using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter2.Section3 { public class Example08 { public Example08() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType f = new Science.Mathematics.Function.ToLastType(func); double[] x = { 3.0, 2.0}; V.Gradient obj = new V.Gradient(f, x); obj.Compute(); result += obj.Result[0].ToString() + " "; result += obj.Result[1].ToString() + "\r\n"; result += (x[1] * Math.Exp(x[0] * x[1]) + x[1] * Math.Cos(x[0] * x[1])).ToString() + " "; result += (x[0] * Math.Exp(x[0] * x[1]) + x[0] * Math.Cos(x[0] * x[1])).ToString() + "\r\n"; } private double func(double[] x) { return Math.Exp(x[0] * x[1]) + Math.Sin(x[0] * x[1]); } } } /* 808.777927558136 1213.16689133832 808.777927558771 1213.16689133816 */