Accord.Math.Integration.MonteCarloIntegration.Integrate C# (CSharp) Method

Integrate() public static method

Computes the area of the function under the selected Range. The computed value will be available at this object's Area.
public static Integrate ( double>.Func func, double a, double b, int samples ) : double
func double>.Func
a double
b double
samples int
return double
        public static double Integrate(Func<double[], double> func, double[] a, double[] b, int samples)
        {
            var mc = new MonteCarloIntegration(a.Length, func);
            for (int i = 0; i < a.Length; i++)
                mc.Range[i] = new DoubleRange(a[i], b[i]);
            mc.Iterations = samples;
            mc.Compute();
            return mc.Area;
        }

Same methods

MonteCarloIntegration::Integrate ( double>.Func func, double a, double b, int samples ) : double
MonteCarloIntegration::Integrate ( double>.Func func, double a, double b ) : double