using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter3.Section1 { public class Example04 { public Example04() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType f = new Science.Mathematics.Function.ToLastType(func); double[] at = { 1.0, 0.5}; V.IteratedPartialDerivative ddf = new V.IteratedPartialDerivative(f, at, 2); ddf.WithRespectToFirst = 0; ddf.WithRespectToSecond = 1; ddf.Compute(); result += ddf.Result.ToString() + "\r\n"; ddf.WithRespectToFirst = 1; ddf.WithRespectToSecond = 0; ddf.Compute(); result += ddf.Result.ToString() + "\r\n"; result += (Math.Exp(at[1])+2.0*at[0]).ToString() + "\r\n"; } private double func(double[] x) { return x[0]*Math.Exp(x[1]) + x[1] * x[0] * x[0]; } } } /* 3.64872127092045 3.64872127130241 3.64872127070013 */