using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace ScienceTest.MathematicsTest.VectorCalculusTest { public class DivergenceTest { public DivergenceTest() { } private string result; public string Result { get{return result;} } public void Compute() { V.Function.ToLastType f = new V.Function.ToLastType(func); double[] at = { 1.0, 2.0, 3.0 }; V.Divergence obj = new V.Divergence(f, at); obj.Compute(); result += obj.Result.ToString()+"\r\n"; at[0] = 2.0; at[1] = 3.0; at[2] = 4.0; obj.Compute(); result += obj.Result.ToString()+"\r\n"; } private double[] func(double[] x) { double[] f = new double[3]; f[0] = x[0]*x[1]; f[1] = x[1]*x[1]*x[2]; f[2] = x[2]*x[0]; return f; } } } // 15.0000000000045 // 28.9999999999994