Exemple #1
0
        public double MethodSplains(double h)
        {
            double       sum1   = 0;
            double       sum2   = 0;
            List <Point> points = new List <Point>();

            for (double i = a; i < b; i += h)
            {
                points.Add(new Point(i, GetFunctionValue(i)));
            }
            Derivative derivative = new Derivative(points);

            for (double i = a; i <= b; i += h)
            {
                if (i == b)
                {
                    break;
                }
                sum1 += (GetFunctionValue(i) + GetFunctionValue(i + h)) * h;
                sum2 += derivative.CubicInterpolationMethod(3).DerivativePoints.IndexOf(new Point(i, GetFunctionValue(i + h))) * Math.Pow(h, 3);
            }
            sum1 *= 0.5;
            sum2 *= 1 / 12;
            double result = sum1 - sum2;

            return(result);
        }