using System; namespace Science.Mathematics.VectorCalculus { public class ChainRule { Function.ToLastType f; Function.ToLastType g; public ChainRule(Function.ToLastType functionRmToRp, Function.ToLastType functionRnToRm, double[] at) { f = functionRmToRp; g = functionRnToRm; x0 = at; } private double[] x0; public double[] At { get { return x0; } set { x0 = value; } } public void Compute() { MatrixOfPartialDerivatives obj = new MatrixOfPartialDerivatives(g, x0); obj.Compute(); double[] y0 = g(x0); MatrixOfPartialDerivatives obj2 = new MatrixOfPartialDerivatives(f, y0); obj2.Compute(); res = obj2.Result * obj.Result; } private Matrix res; public Matrix Result { get { return res; } } } }