using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter2.Section3 { public class Example01 { public Example01() { } 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 = new Double[2]; x[0] = 1.0; x[1] = 6.0; V.PartialDerivative obj = new V.PartialDerivative(f, x); obj.WithRespectTo = 0; obj.Compute(); result += obj.Result.ToString() + "\r\n"; obj.WithRespectTo = 1; obj.Compute(); result += obj.Result.ToString() + "\r\n"; result += (2.0*x[0]*x[1]).ToString() + "\r\n"; result += (x[0]*x[0]+3.0*x[1]*x[1]).ToString() + "\r\n"; } private double func(double[] x) { return x[0] * x[0] * x[1] + x[1] * x[1] * x[1]; } } } /* 11.9999999999806 109.000000000069 12 109 */