using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter2.Section5 { public class Example05 { public Example05() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType f = new Science.Mathematics.Function.ToLastType(funcf); Science.Mathematics.Function.ToLastType g = new Science.Mathematics.Function.ToLastType(funcg); double[] x0 = { 0.0, 0.0 }; V.ChainRule obj = new V.ChainRule(f, g, x0); obj.Compute(); result += obj.Result.ToString() + "\r\n"; } private double[] funcf(double[] u) { double[] r = new double[2]; r[0] = Math.Cos(u[1]) + u[0]*u[0]; r[1] = Math.Exp(u[0]+u[1]); return r; } private double[] funcg(double[] x) { double[] r = new double[2]; r[0] = Math.Exp(x[0] * x[0]); r[1] = x[0] - Math.Sin(x[1]); return r; } } } /* 0 0 2.71828182845936 -2.71828182845936 */