public static UnitsNet.Area Integrate(Func <UnitsNet.Length[], UnitsNet.Length> func, UnitsNet.Length[] a, UnitsNet.Length[] b, int samples)
        {
            var mc = new MonteCarloUnitsNet(a.Length, func);

            for (int i = 0; i < a.Length; i++)
            {
                mc.Range[i] = new UNRange(a[i], b[i]);
            }
            mc.Iterations = samples;
            mc.Compute();
            return(mc.Area);
        }
 public UnitsNet.Area CalcPi()
 {
     return(MonteCarloUnitsNet.Integrate(x => H(x[0], x[1]), from, to, N));
 }
Ejemplo n.º 3
0
 public UnitsNet.Area CalcPiUnitsNet()
 {
     return(MonteCarloUnitsNet.Integrate(x => UNH(x[0], x[1]), UNfrom, UNto, N));
 }