using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter2.Section5 { public class Example03 { public Example03() { } 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 = { 1.0, 1.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[3]; r[0] = u[0] + u[1]; r[1] = u[0]; r[2] = u[1] * u[1]; return r; } private double[] funcg(double[] x) { double[] r = new double[2]; r[0] = x[0] * x[0] + 1.0; r[1] = x[1] * x[1]; return r; } } } /* 1.99999999999969 1.99999999999859 2.00000000000004 0 0 3.99999999999961 */