Пример #1
0
        static double Gauss(double p)
        {
            double Result = 0;

            double[,] Matrix = new double[N, N + 1];

            LegendrePolynom.GetValueAt(0);
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (i == 0)
                    {
                        Matrix[i, j] = 1;
                    }
                    else
                    {
                        Matrix[i, j] = Math.Pow(LegendrePolynom.Roots[j], i);
                    }
                }

                if (i % 2 == 0)
                {
                    Matrix[i, N] = 2.0 / (i + 1);
                }
                else
                {
                    Matrix[i, N] = 0;
                }
            }
            double[] ResultColumn = SLE.GaussSolve(Matrix, N);

            for (int i = 0; i < N; i++)
            {
                double z = 0.5 + LegendreCoefs[i] * 0.5;
                Result += ResultColumn[i] * Integrand(p, z);
            }
            Result *= 0.5;
            return(Result);
        }