예제 #1
0
        public double CalcIntegral(RectangleIntegralType type)
        {
            double result = 0;

            for (int i = 0; i < n; ++i)
            {
                result += GetValue(a + i * h, type);
            }
            return(result * h);
        }
예제 #2
0
        double GetValue(double value, RectangleIntegralType type)
        {
            switch (type)
            {
            case RectangleIntegralType.Left: return(function(value));

            case RectangleIntegralType.Right: return(function(value + h));

            default: return(function(value + h / 2));
            }
        }
예제 #3
0
        public double GetErrorDiap(RectangleIntegralType type)
        {
            RectangleIntegral temp = new RectangleIntegral(this.function, a, b, n * 2);

            return(Math.Abs(temp.CalcIntegral(type) - this.CalcIntegral(type)));
        }