using System; using System.Collections.Generic; using System.Linq; using System.Text; using V = Science.Mathematics.VectorCalculus; namespace VectorCalculus5Ed.Chapter5.Section5 { public class Example02 { public Example02() { } private string result; public string Result { get{return result;} } public void Compute() { Science.Mathematics.Function.ToLastType f = new Science.Mathematics.Function.ToLastType(func); double[] from = { 0.0, 0.0, 0.0 }; double[] to = { 1.0, 1.0, 1.0 }; V.IntegrationMultiD obj = new V.IntegrationMultiD(f, from, to); obj.Compute(); result += obj.BestEstimation.ToString() + "\r\n"; obj.NumberOfCall = 10000000; obj.Compute(); result += obj.BestEstimation.ToString() + "\r\n"; double a = (Math.E - 1.0)*(Math.E - 1.0)*(Math.E - 1.0); result += a.ToString() + "\r\n"; } private double func(double[] x) { return Math.Exp(x[0] + x[1] + x[2]); } } } /* 5.07333560075741 5.0732143044127 5.07321411177285 */