Пример #1
0
        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);
        }
Пример #2
0
 public double CalcPi()
 {
     return(MonteCarloDouble.Integrate(x => H(x[0], x[1]), from, to, N));
 }
Пример #3
0
 public double CalcPiDouble()
 {
     return(MonteCarloDouble.Integrate(x => DH(x[0], x[1]), Dfrom, Dto, N));
 }