public static double Integrate(Func <double[], double> func, double[] a, double[] b, int samples) { var mc = new MonteCarloDouble(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); }
public double CalcPi() { return(MonteCarloDouble.Integrate(x => H(x[0], x[1]), from, to, N)); }
public double CalcPiDouble() { return(MonteCarloDouble.Integrate(x => DH(x[0], x[1]), Dfrom, Dto, N)); }