Пример #1
0
        double DoubleIntegralCells(double X1, double X2, double Y1, double Y2, Double2Func Func)
        {
            double hx = (X2 - X1) / StepsXCount,
                   hy = (Y2 - Y1) / StepsYCount,
                   x = X1, y = Y1,
                   Result = 0.0;

            for (int i = 0; i < StepsYCount; i++, y += hy, x = X1)
            {
                for (int j = 0; j < StepsXCount; j++, x += hx)
                {
                    Result += Func(x - hx * 0.5, y - hy * 0.5);
                }
            }

            return(Result * hx * hy);
        }
Пример #2
0
        double DoubleIntegral(double X1, double X2, double Y1, double Y2, double[] LegendreRoots, double[] GaussCoefs, Double2Func Func)
        {
            double Result = 0;

            for (int i = 0; i < GaussCoefs.Length; i++)
            {
                double X = ((X2 + X1) + (X2 - X1) * LegendreRoots[i]) * 0.5;
                for (int j = 0; j < GaussCoefs.Length; j++)
                {
                    double Y = ((Y2 + Y1) + (Y2 - Y1) * LegendreRoots[j]) * 0.5;
                    Result += GaussCoefs[i] * GaussCoefs[j] * Func(X, Y);
                }
            }
            Result *= (X2 - X1) * (Y2 - Y1) * 0.25;
            return(Result);
        }