BASIC Programming/Normative BASIC/Minimal BASIC

= Sample Programs =

Sample programs for Minimal BASIC will appear here.

Introduction
There exists two cases, when the computation of the value of a definite integral by numerical methods is needed. One of them is the calculation of the area below the curve defined by a set of experimental data, and another is the calculation of the definite integral of a mathematical function, for which no known integral is known. The former is often the case of response functions in the experimental labors of science and engineering, while the latter is normally the case in the practical investigations of physics, mathematics, and engineering.

Independently of it, the development of numerical methods for integration purposes, a field that belongs to the department of applied mathematics, is based on the simple idea from which it stems, i.e., if $$y(x) = f(x)$$ is a real-valued (the complex-valued case can be treated analogously, by separating it into its real and imaginary parts) continuous function of $$x$$ defined in an interval $$(a,b)$$, its definite integral,

$$ \int_{a}^{b} f(x) dx = \sum_{x = a}^{x = b} \lim_{\delta x \rightarrow 0} f(x) \delta x = \lim_{\delta x \rightarrow 0} \sum_{x = a}^{x = b} f(x) \delta x \approx \sum_{x = a}^{x = b} f(x) \Delta x $$,

can be calculated approximately as the finite sum of the product $$f(x) \Delta x$$ evaluated at some given points in the interval $$(a,b)$$.

In the case of experimental data, the set of points at which the value of the function is measured is usually not regularly distributed (i.e., the points are not equispaced), so the value of the definite integral must be calculated in the form:

$$ \int_{a}^{b} f(x) dx = \int_{{x_0} = a}^ f(x) dx + \int_^ f(x) dx + ... + \int_^ f(x) dx + \int_^ f(x) dx $$,

which can be approximated either as:

$$ \int_{a}^{b} f(x) dx \approx f({x_0} = a) ({x_1} - {x_0}) + f({x_1}) ({x_2} - {x_1}) + ... + f({x_{n-2}}) ({x_{n-1}} - {x_{n-2}}) + f({x_{n-1}}) ({x_n} - {x_{n-1}}) $$,

or as:

$$ \int_{a}^{b} f(x) dx \approx f({x_1}) ({x_1} - {x_0}) + f({x_2}) ({x_2} - {x_1}) + ... + f({x_{n-1}}) ({x_{n-1}} - {x_{n-2}}) + f({x_n} = b) ({x_n} - {x_{n-1}}) $$.

In the first case, the value of the integral is underestimated (overestimated) in the case of monotonically ascending (descending) functions, since the value of $$f(x)$$ taken in each evaluation is always the lowest (highest) in every subinterval, and hence constituting an absolute lower (upper) bound to the value of the integral, while in the second case, the value of the integral is overestimated (underestimated) in the case of monotonically descending (ascending) functions, since the value of $$f(x)$$ taken in each evaluation is always the highest (lowest) in every subinterval, and hence constituting an absolute upper (lower) bound to the value of the integral.

According to the Mean-Value Theorem of Calculus, the value of a definite integral can also be calculated as:

$$ \int_{a}^{b} f(x) dx = f(\gamma) (b - a) $$,

for some value $$\gamma$$ in $$(a,b)$$ for which $$f(\gamma)$$ represents the mean value of $$f(x)$$ in $$(a,b)$$, so it is then a better approximation to calculate the definite integral of a set of experimental data as:

$$ \int_{a}^{b} f(x) dx = \int_{{x_0} = a}^ f(x) dx + \int_^ f(x) dx + ... + \int_^ f(x) dx + \int_^ f(x) dx $$,

$$ \int_{a}^{b} f(x) dx = f(\gamma_{(0,1)}) ({x_1} - {x_0}) + f(\gamma_{(1,2)}) ({x_2} - {x_1}) + ... + f(\gamma_{(n-2,n-1)}) ({x_{n-1}} - {x_{n-2}}) + f(\gamma_{(n-1,n)}) ({x_n} - {x_{n-1}}) $$,

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_0}) + f({x_1})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) + f({x_2})}{2} ({x_2} - {x_1}) + ... + \frac{f({x_{n-2}}) + f({x_{n-1}})}{2} ({x_{n-1}} - {x_{n-2}}) + \frac{f({x_{n-1}}) + f({x_n})}{2} ({x_n} - {x_{n-1}}) $$.

For reasons that we shall see later, this is equal to assume a piecewise linear interpolating function between the different points, and the value of the integral so calculated is exact for linear functions (i.e., functions for which its slope changes at constant rate), although it is underestimated for functions for which its slope grows at non-constant rate (i.e., its second derivative is strictly positive in the considered interval), and it is overestimated for functions for which its slope decreases at non-constant rate (i.e., its second derivative is strictly negative in the considered interval). The value so calculated constitutes a better approximation than the lower and upper bounds presented before, and in the case that the second derivative of the function (which can be calculated from the experimental data with the help of second or central differences) changes signs between subintervals, the value is expected to be close to the actual value due to the cancellation of the errors in the approximation of the mean values.

In the case of mathematical functions, there is more information about the function, since it is possible not only to calculate the value of the function at any given point, but also to compute first, second, and higher-order derivatives with any degree of accuracy.

Let us elaborate some mathematical results, going from simple to more elaborate methods:

The main theme in the development of numerical methods, together with the study of the stability (i.e., if a method converges), is the rate of convergence of the method, which studies how many evaluations are needed and the error in the approximation, for non-iterative methods, or how many iterations are needed and how the error is minimized in each iteration, for iterative methods.

In the case of the study of the stability, and as we have seen before, the value of the definite integral of a function $$f(x)$$ defined in an interval $$(a,b)$$,

$$ \int_{a}^{b} f(x) dx = \sum_{x = a}^{x = b} \lim_{\delta x \rightarrow 0} f(x) \delta x = \lim_{\delta x \rightarrow 0} \sum_{x = a}^{x = b} f(x) \delta x \approx \sum_{x = a}^{x = b} f({x_k}) \Delta {x_k} $$,

can be calculated approximately as the finite sum of the product $$f(x) \Delta x$$ evaluated at some given points in the interval $$(a,b)$$.

In the limit $$\Delta x \rightarrow \delta x \rightarrow 0$$, the finite sum tends to the infinite integral, and so convergence is assured.

In the case of the study of the rate of convergence, one is interested in increasing the accuracy of the approximation, while retaining the number of subintervals, with a minor increase in computational complexity.

The approach used consists normally in using a polynomial approximation for the evaluation of the function $$f(x)$$ in each subinterval, using the information provided by the value of the function at several points in the subinterval.

Let us consider the case of equally-spaced points (although this restriction can be easily lifted):

According to the definition,

$$ \int_{a}^{b} f(x) dx = \sum_{x = a}^{x = b} \lim_{\delta x \rightarrow 0} f(x) \delta x = \lim_{\delta x \rightarrow 0} \sum_{x = a}^{x = b} f(x) \delta x \approx \sum_{x = a}^{x = b} f({x_k}) \Delta {x_k} = \sum_{x = a}^{x = b} f({x_k}) ({x_{j+1}} - {x_{j}}) $$,

with $$k$$ being indicative of the subinterval, $${x_k}$$ being some arbitrary number in every subinterval $$({x_{j}},{x_{j+1}})$$, with $$j = 0, 1, 2, ..., n-1$$, and $${x_{0}} = a, {x_{n}} = b$$, and $$\Delta {x_{k}} = ({x_{j+1}} - {x_{j}})$$, with $$k = 1, 2, ..., n$$, and $$j = k - 1$$.

The Mean-Value Theorem of Calculus tells us, that if

$$ \int_{a}^{b} f(x) dx $$

is the definite integral of $$f(x)$$ in $$(a,b)$$, there exists a value $$\gamma$$ in $$(a,b)$$, such that

$$ \int_{a}^{b} f(x) dx = f(\gamma) (b - a) $$.

Additionally, by definition, if

$$ \int_{a}^{b} f(x) dx $$

is the definite integral of $$f(x)$$ in $$(a,b)$$, this one can also be understood as being composed of the individual contributions

$$ \int_{a}^{b} f(x) dx = \int_{{x_0} = a}^ f(x) dx + \int_^ f(x) dx + ... + \int_^ f(x) dx + \int_^ f(x) dx $$

for arbitrary values $${x_{0}} = a, {x_{1}}, {x_{2}}, ..., {x_{n-2}}, {x_{n-1}}, {x_{n}} = b$$.

Now, applying the Mean-Value Theorem to each individual contribution yields the result:

$$ \int_{a}^{b} f(x) dx = f(\gamma_{({x_{0}},{x_{1}})}) ({x_{1}} - {x_{0}}) + f(\gamma_{({x_{1}},{x_{2}})}) ({x_{2}} - {x_{1}}) + ... + f(\gamma_{({x_{n-2}},{x_{n-1}})}) ({x_{n-1}} - {x_{n-2}}) + f(\gamma_{({x_{n-1}},{x_{n}})}) ({x_{n}} - {x_{n-1}}) $$,

which is exact.

In the particular case that every subinterval is of equal size, i.e., $$({x_{1}} - {x_{0}}) = ({x_{2}} - {x_{1}}) = ... = ({x_{n-1}} - {x_{n-2}}) = ({x_{n}} - {x_{n-1}}) = \Delta x$$, then the expression reduces to

$$ \int_{a}^{b} f(x) dx = \left(f(\gamma_{({x_{0}},{x_{1}})}) + f(\gamma_{({x_{1}},{x_{2}})}) + ... + f(\gamma_{({x_{n-2}},{x_{n-1}})}) + f(\gamma_{({x_{n-1}},{x_{n}})})\right) \Delta x $$.

In this way, the calculation of the initial definite integral reduces to the calculation of the mean values

$$ f(\gamma_{({x_{0}},{x_{1}})}), f(\gamma_{({x_{1}},{x_{2}})}), ..., f(\gamma_{({x_{n-2}},{x_{n-1}})}), f(\gamma_{({x_{n-1}},{x_{n}})}) $$.

In a first approximation, with only one point,

$$ f(\gamma_{({x_{0}},{x_{1}})}) \approx f({x_{i}}_{({x_{0}},{x_{1}})}), f(\gamma_{({x_{1}},{x_{2}})}) \approx f({x_{i}}_{({x_{1}},{x_{2}})}), ..., f(\gamma_{({x_{n-2}},{x_{n-1}})}) \approx f({x_{i}}_{({x_{n-2}},{x_{n-1}})}), f(\gamma_{({x_{n-1}},{x_{n}})}) \approx f({x_{i}}_{({x_{n-1}},{x_{n}})}) $$,

with $${x_{i}}$$ being the value of $$x$$ in the middle of each subinterval, which leads to

$$ \int_{a}^{b} f(x) dx \approx \left(f({x_{i}}_{({x_{0}},{x_{1}})}) + f({x_{i}}_{({x_{1}},{x_{2}})}) + ... + f({x_{i}}_{({x_{n-2}},{x_{n-1}})}) + f({x_{i}}_{({x_{n-1}},{x_{n}})})\right) \Delta x $$.

In a second approximation, with only two points,

$$ f(\gamma_{({x_{0}},{x_{1}})}) \approx \frac{f({x_{0}}) + f({x_{1}})}{2}, f(\gamma_{({x_{1}},{x_{2}})}) \approx \frac{f({x_{1}}) + f({x_{2}})}{2}, ..., f(\gamma_{({x_{n-2}},{x_{n-1}})}) \approx \frac{f({x_{n-2}}) + f({x_{n-1}})}{2}, f(\gamma_{({x_{n-1}},{x_{n}})}) \approx \frac{f({x_{n-1}}) + f({x_{n}})}{2} $$,

with $${x_{n-1}}, {x_{n}}$$ being the value of $$x$$ at the beginning and at the end of each subinterval, which leads to

$$ \int_{a}^{b} f(x) dx \approx \left(f({x_{0}}) + 2 f({x_{1}}) + ... + 2 f({x_{n-1}}) + f({x_{n}})\right) \Delta x / 2 $$.

In a third approximation, with only three points,

$$ f(\gamma_{({x_{0}},{x_{1}})}) \approx \frac{f({x_{0}}) + f({x_{i}}_{({x_{0}},{x_{1}})}) + f({x_{1}})}{3}, f(\gamma_{({x_{1}},{x_{2}})}) \approx \frac{f({x_{1}}) + f({x_{i}}_{({x_{1}},{x_{2}})}) + f({x_{2}})}{3}, ..., f(\gamma_{({x_{n-2}},{x_{n-1}})}) \approx \frac{f({x_{n-2}}) + f({x_{i}}_{({x_{n-2}},{x_{n-1}})}) + f({x_{n-1}})}{3}, f(\gamma_{({x_{n-1}},{x_{n}})}) \approx \frac{f({x_{n-1}}) + f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})}{3} $$,

with $${x_{n-1}}, {x_{i}}, {x_{n}}$$ being the value of $$x$$ at the beginning, in the middle, and at the end of each subinterval, which leads to

$$ \int_{a}^{b} f(x) dx \approx \left(f({x_{0}}) + f({x_{i}}_{({x_{0}},{x_{1}})}) + 2 f({x_{1}}) + f({x_{i}}_{({x_{1}},{x_{2}})}) + 2 f({x_{2}}) + ... + 2 f({x_{n-2}}) + f({x_{i}}_{({x_{n-2}},{x_{n-1}})}) + 2 f({x_{n-1}}) + f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})\right) \Delta x / 3 $$.

In a fourth approximation, while still making use of the evaluation of the function $$f(x)$$ at the beginning, in the middle, and at the end of each subinterval, one can use the result that if $$f(\gamma^{-})$$ and $$f(\gamma^{+})$$ are estimates for $$f(\gamma)$$, then its arithmetic mean $$\left(f(\gamma^{-}) + f(\gamma^{+})\right) / 2$$ is also another estimate with at least the same accuracy, if not better.

So, adding the results for the first and second approximation, and dividing by two,

$$ f(\gamma_{({x_{n-1}},{x_{n}})}) \approx \frac{f({x_{i}}_{({x_{n-1}},{x_{n}})}) + \frac{f({x_{n-1}}) + f({x_{n}})}{2}}{2} = \frac{f({x_{n-1}}) + 2 f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})}{4} $$,

which leads to the result

$$ \int_{a}^{b} f(x) dx \approx \left(f({x_{0}}) + 2 f({x_{i}}_{({x_{0}},{x_{1}})}) + 2 f({x_{1}}) + 2 f({x_{i}}_{({x_{1}},{x_{2}})}) + 2 f({x_{2}}) + ... + 2 f({x_{n-2}}) + 2 f({x_{i}}_{({x_{n-2}},{x_{n-1}})}) + 2 f({x_{n-1}}) + 2 f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})\right) \Delta x / 4 $$.

Adding the results for the first and third approximation, and dividing by two,

$$ f(\gamma_{({x_{n-1}},{x_{n}})}) \approx \frac{f({x_{i}}_{({x_{n-1}},{x_{n}})}) + \frac{f({x_{n-1}}) + f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})}{3}}{2} = \frac{f({x_{n-1}}) + 4 f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})}{6} $$,

which leads to the result

$$ \int_{a}^{b} f(x) dx \approx \left(f({x_{0}}) + 4 f({x_{i}}_{({x_{0}},{x_{1}})}) + 2 f({x_{1}}) + 4 f({x_{i}}_{({x_{1}},{x_{2}})}) + 2 f({x_{2}}) + ... + 2 f({x_{n-2}}) + 4 f({x_{i}}_{({x_{n-2}},{x_{n-1}})}) + 2 f({x_{n-1}}) + 4 f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})\right) \Delta x / 6 $$.

In practice, one can do no better with only three evaluations in an interval, but the results obtained are simple and accurate enough, even in the case of one single interval.

Let us illustrate the case by means of an example:

Let us suppose, that we wish to calculate the definite integral of the function $$f(x) = exp(x)$$ in the interval $$(0,1)$$, for which we know its exact value, $$F(x)|_{0}^{1} = \int_{0}^{1} exp(x) dx = exp(x)|_{0}^{1} = exp(1) - exp(0) = 2.71828 - 1.00000 = 1.71828$$.

Let us also keep the problem simple and do the calculations with a single interval, i.e., $${x_{0}} = a = 0.0$$, $${x_{n}} = b = 1.0$$, and $$x_i = 0.5$$.

So, we have:

First approximation:

$$ \int_{a}^{b} f(x) dx \approx f(x_i) (b - a) = exp(0.5) (1.0 - 0.0) = 1.64872 $$

This is equal to a relative error of

$$ error = \frac{1.64872 - 1.71828}{1.71828} \times 100 = -4.04823% $$.

Second approximation:

$$ \int_{a}^{b} f(x) dx \approx \frac{f(x_a) + f(x_b)}{2} (b - a) = \frac{exp(0.0) + exp(1.0)}{2} (1.0 - 0.0) = 1.85914 $$

This is equal to a relative error of

$$ error = \frac{1.85914 - 1.71828}{1.71828} \times 100 = +8.19774% $$.

Third approximation:

$$ \int_{a}^{b} f(x) dx \approx \frac{f(x_a) + f(x_i) + f(x_b)}{3} (b - a) = \frac{exp(0.0) + exp(0.5) + exp(1.0)}{3} (1.0 - 0.0) = 1.78900 $$

This is equal to a relative error of

$$ error = \frac{1.85914 - 1.71828}{1.71828} \times 100 = +4.11575% $$.

Fourth approximation, first and second terms (linear expansion):

$$ \int_{a}^{b} f(x) dx \approx \frac{f(x_a) + 2 f(x_i) + f(x_b)}{4} (b - a) = \frac{exp(0.0) + 2 \times exp(0.5) + exp(1.0)}{4} (1.0 - 0.0) = 1.75393 $$

This is equal to a relative error of

$$ error = \frac{1.75393 - 1.71828}{1.71828} \times 100 = +2.07475% $$.

Fourth approximation, first and third terms (quadratic expansion):

$$ \int_{a}^{b} f(x) dx \approx \frac{f(x_a) + 4 f(x_i) + f(x_b)}{6} (b - a) = \frac{exp(0.0) + 4 \times exp(0.5) + exp(1.0)}{6} (1.0 - 0.0) = 1.71886 $$

This is equal to a relative error of

$$ error = \frac{1.71886 - 1.71828}{1.71828} \times 100 = +0.0337589% $$.

In case more accuracy is needed, one can analogously introduce higher-order terms in the expansion of $$f(x)$$ around $$x_i$$, or half the integration step in one of the methods considered before.

Let us consider the case, when higher-order terms are considered in the expansion, i.e.,

$$ f(\gamma_{({x_{n-1}},{x_{n}})}) \approx \frac{f({x_{i}}_{({x_{n-1}},{x_{n}})}) + \frac{f({x_{n-1}}) + f({x_{i}}_{1/4}) + f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{i}}_{3/4}) + f({x_{n}})}{5}}{2} = \frac{f({x_{n-1}}) + f({x_{i}}_{1/4}) + 6 f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{i}}_{3/4}) + f({x_{n}})}{10} $$,

which leads to the result

$$ \int_{a}^{b} f(x) dx \approx \left(f({x_{0}}) + f({x_{1/4}}_{({x_{0}},{x_{1}})}) + 6 f({x_{i}}_{({x_{1}},{x_{2}})}) + f({x_{3/4}}_{({x_{0}},{x_{1}})}) + 2 f({x_{1}}) + ... + 2 f({x_{n-1}}) + f({x_{1/4}}_{({x_{n-1}},{x_{n}})}) + 6 f({x_{i}}_{({x_{n-1}},{x_{n}})}) + f({x_{1/4}}_{({x_{n-1}},{x_{n}})}) + f({x_{n}})\right) \Delta x / 10 $$.

Let us illustrate the case by means of an example:

Let us suppose, that we wish to calculate the definite integral of the function $$f(x) = exp(x)$$ in the interval $$(0,1)$$, for which we know its exact value, $$F(x)|_{0}^{1} = \int_{0}^{1} exp(x) dx = exp(x)|_{0}^{1} = exp(1) - exp(0) = 2.71828 - 1.00000 = 1.71828$$.

Let us also keep the problem simple and do the calculations with two intervals, i.e., $${x_{0}} = a = 0.0$$, $${x_{n}} = b = 1.0$$, $${x_{1}} = 0.5$$, $${x_{i}}_{({x_{0}},{x_{1}})} = 0.25$$ and $${x_{i}}_{({x_{1}},{x_{2}})} = 0.25$$.

Applying second order expansion

$$ \int_{a}^{b} f(x) dx \approx \left(f({x_{0}}) + 4 f({x_{i}}_{({x_{0}},{x_{1}})}) + 2 f({x_{1}}) + 4 f({x_{i}}_{({x_{1}},{x_{2}})}) + f({x_{2}})\right) \Delta x / 6 $$,

which yields

$$ \int_{a}^{b} f(x) dx \approx \left(exp(0.0) + 4 exp(0.25) + 2 exp(0.5) + 4 exp(0.75) + exp(1.0)\right) \times 0.5 / 6 = 1.71832 $$,

which is equal to a relative error of

$$ error = \frac{1.71832 - 1.71828}{1.71828} \times 100 = +0.00216456% $$.

Applying fourth order expansion

$$ \int_{a}^{b} f(x) dx \approx \left(f(0.0) + f(0.25) + 6 f(0.50) + f(0.75) + f(1.0)\right) 1.0 / 10 $$,

which yields

$$ \int_{a}^{b} f(x) dx \approx \left(exp(0.0) + 7 exp(0.25) + 2 exp(0.5) + 7 exp(0.75) + exp(1.0)\right) \times 1.0 / 10 $$.

We know from the Calculus of Differences, that any function can be expressed as the polynomial expansion

$$ f(x) = f({x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_0})^2 + ... $$

in the case of forward differences, or

$$ f(x) = f({x_1}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_1}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_1})^2 + ... $$

in the case of backward differences, or

$$ f(x) = f({x_i}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_i}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_i})^2 + ... $$

in the case of central differences.

In a first approximation,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_0}) + h({x_0})(x - {x_0}) \right) dx \approx \int_{a}^{b} f({x_0}) dx = f({x_0})(b - a) = f({x_0})({x_1} - {x_0}) = f({x_0}) \Delta x $$

$$ \int_{a}^{b} h({x_0})(x - {x_0}) dx = h({x_0})\frac{(x - {x_0})^2}{2}|_{a}^{b} = h({x_0})\frac{(b - {x_0})^2 - (a - {x_0})^2}{2} = h({x_0})\frac{({x_1} - {x_0})^2 - ({x_0} - {x_0})^2}{2} = h({x_0})\frac{({x_1} - {x_0})^2}{2} = h({x_0})\frac{\Delta x^2}{2} \simeq f'({x_0}) \frac{\Delta x^2}{2} $$

in the case of forward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_1}) + h({x_1})(x - {x_1}) \right) dx \approx \int_{a}^{b} f({x_1}) dx = f({x_1})(b - a) = f({x_1})({x_1} - {x_0}) = f({x_1}) \Delta x $$

$$ \int_{a}^{b} h({x_1})(x - {x_1}) dx = h({x_1})\frac{(x - {x_1})^2}{2}|_{a}^{b} = h({x_1})\frac{(b - {x_1})^2 - (a - {x_1})^2}{2} = h({x_1})\frac{({x_1} - {x_1})^2 - ({x_0} - {x_1})^2}{2} = h({x_1})\frac{-({x_0} - {x_1})^2}{2} = - h({x_1})\frac{\Delta x^2}{2} \simeq -f'({x_1}) \frac{\Delta x^2}{2} $$

in the case of backward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_i}) + h({x_i})(x - {x_i}) \right) dx \approx \int_{a}^{b} f({x_i}) dx = f({x_i})(b - a) = f({x_i})({x_1} - {x_0}) = f({x_i}) \Delta x $$

$$ \int_{a}^{b} h({x_i})(x - {x_i}) dx = h({x_i})\frac{(x - {x_i})^2}{2}|_{a}^{b} = h({x_i})\frac{(b - {x_i})^2 - (a - {x_i})^2}{2} = h({x_i})\frac{({x_1} - {x_i})^2 - ({x_0} - {x_i})^2}{2} = h({x_i})\frac{(\Delta x /2)^2 - (-\Delta x /2)^2}{2} = h({x_i})\frac{\Delta x^2 - \Delta x^2}{4} = 0 $$

in the case of central differences.

So, in the case of evaluating the integral with one single point, the value of it is always underestimated (overestimated) with forward (backward) differences if the value of the slope of the function at the evaluation point is positive, and underestimated (overestimated) with forward (backward) differences if the value of the slope of the function at the evaluation point is negative, being the error in the estimation directly proportional to the slope of the function at the evaluation point, and to one half of the square of the integration step. In the case of evaluating the integral with central differences, the value is exact for linear functions.

In a second approximation,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_0}) + h({x_0})(x - {x_0})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_0}) \right) dx = f({x_0})({x_1} - {x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} \frac{({x_1} - {x_0})^2 - ({x_0} - {x_0})^2}{2} $$

$$ \int_{a}^{b} f(x) dx \approx f({x_0})({x_1} - {x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} \frac{({x_1} - {x_0})^2}{2} = f({x_0})({x_1} - {x_0}) + \frac{f({x_1}) - f({x_0})}{2} ({x_1} - {x_0}) = \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) = \frac{f({x_1}) + f({x_0})}{2} \Delta x $$

$$ \int_{a}^{b} h({x_0})(x - {x_0})^2 dx = h({x_0})\frac{(x - {x_0})^3}{3}|_{a}^{b} = h({x_0})\frac{({x_1} - {x_0})^3 - ({x_0} - {x_0})^3}{3} = h({x_0})\frac{({x_1} - {x_0})^3}{3} = h({x_0})\frac{\Delta x^3}{3} \simeq f''({x_0}) \frac{\Delta x^3}{3} $$

in the case of forward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_1}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_1}) + h({x_1})(x - {x_1})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_1}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_1}) \right) dx = f({x_1})({x_1} - {x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} \frac{({x_1} - {x_1})^2 - ({x_0} - {x_1})^2}{2} $$

$$ \int_{a}^{b} f(x) dx \approx f({x_1})({x_1} - {x_0}) - \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} \frac{({x_1} - {x_0})^2}{2} = f({x_1})({x_1} - {x_0}) - \frac{f({x_1}) - f({x_0})}{2} ({x_1} - {x_0}) = \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) = \frac{f({x_1}) + f({x_0})}{2} \Delta x $$

$$ \int_{a}^{b} h({x_1})(x - {x_1})^2 dx = h({x_1})\frac{(x - {x_1})^3}{3}|_{a}^{b} = h({x_1})\frac{({x_1} - {x_1})^3 - ({x_0} - {x_1})^3}{3} = h({x_1})\frac{({x_1} - {x_0})^3}{3} = h({x_1})\frac{\Delta x^3}{3} \simeq f''({x_1}) \frac{\Delta x^3}{3} $$

in the case of backward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_i}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_i}) + h({x_i})(x - {x_i})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_i}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_i}) \right) dx = f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} \frac{({x_1} - {x_i})^2 - ({x_0} - {x_i})^2}{2} $$

$$ \int_{a}^{b} f(x) dx \approx f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} \frac{({x_1} - {x_i})^2 - ({x_i} - {x_0})^2}{2} = f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} \frac{({x_1} - {x_0})^2 - ({x_1} - {x_0})^2}{8} = f({x_i})({x_1} - {x_0}) = f({x_i}) \Delta x $$

$$ \int_{a}^{b} h({x_i})(x - {x_i})^2 dx = h({x_i})\frac{(x - {x_i})^3}{3}|_{a}^{b} = h({x_i})\frac{({x_1} - {x_i})^3 - ({x_0} - {x_i})^3}{3} = h({x_i})\frac{({x_1} - {x_i})^3 + ({x_i} - {x_0})^3}{3} = h({x_i})\frac{({x_1} - {x_0})^3}{12} = h({x_i})\frac{\Delta x^3}{12} \simeq f''({x_i}) \frac{\Delta x^3}{12} $$

in the case of central differences.

So, in the case of evaluating the integral with a linear function, there is no difference between forward and backward differences, and the value of the integral is equal to the product of the mean of the values of the function at the beginning and at the end of the interval times the integration step, being the value so calculated underestimated (overestimated) for monotonically increasing (decreasing) functions with a positive (negative) second derivative, the error in the approximation being directly proportional to the second derivative of the function and to the cube of the integration step (i.e., as one increases the number of subintervals, one reduces the deviation proportional to the cube of the number of subintervals). In the case of central differences, the value of the integral is equal to the product of the value of the function in the middle of the interval times the integration step, as in the previous case, the error in the approximation being reduced by a factor of four with relation to the case of forward and backward differences.

In a third approximation,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_0})^2 + h({x_0})(x - {x_0})^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_0})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3 - ({x_0} - {x_0})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{3} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{3 f({x_1}) + 3 f({x_0}) + 2 f({x_1}) - 4 f({x_i}) + 2 f({x_0})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{5 f({x_0}) - 4 f({x_i}) + 5 f({x_1})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} h({x_0})(x - {x_0})^3 dx = h({x_0})\frac{(x - {x_0})^4}{4}|_{a}^{b} = h({x_0})\frac{({x_1} - {x_0})^4 - ({x_0} - {x_0})^4}{4} = h({x_0})\frac{({x_1} - {x_0})^4}{4} = h({x_0})\frac{\Delta x^4}{4} \simeq f'''({x_0}) \frac{\Delta x^4}{4} $$

in the case of forward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_1}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_1}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_1})^2 + h({x_1})(x - {x_1})^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_1}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_1}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_1})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_1})^3 - ({x_0} - {x_1})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) - \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) - \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{3} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{3 f({x_1}) + 3 f({x_0}) - 2 f({x_1}) + 4 f({x_i}) - 2 f({x_0})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_0}) + 4 f({x_i}) + f({x_1})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} h({x_1})(x - {x_1})^3 dx = h({x_1})\frac{(x - {x_1})^4}{4}|_{a}^{b} = h({x_1})\frac{({x_1} - {x_1})^4 - ({x_0} - {x_1})^4}{4} = -h({x_1})\frac{({x_1} - {x_0})^4}{4} = -h({x_1})\frac{\Delta x^4}{4} \simeq -f'''({x_1}) \frac{\Delta x^4}{4} $$

in the case of backward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_i}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_i}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_i})^2 + h({x_i})(x - {x_i})^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_i}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_i}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_i})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_i})^3 - ({x_0} - {x_i})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3}{12} $$

$$ \int_{a}^{b} f(x) dx \approx f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{12} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{12 f({x_i}) + f({x_1}) - 2 f({x_i}) + f({x_0})}{12} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + 10 f({x_i}) + f({x_0})}{12} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} h({x_i})(x - {x_i})^3 dx = h({x_i})\frac{(x - {x_i})^4}{4}|_{a}^{b} = h({x_i})\frac{({x_1} - {x_i})^4 - ({x_0} - {x_i})^4}{4} = h({x_i})\frac{({x_1} - {x_0})^4 - ({x_1} - {x_0})^4}{64} = 0 $$

in the case of central differences.

In a fourth approximation,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_0})^2 + \frac{\frac{f({x_1}) - f({x_i})}{{x_1} - {x_i}} - \frac{f({x_i}) - f({x_0})}{{x_i} - {x_0}}}{({x_1} - {x_0})^2} ({x} - {x_0})^3 + h({x_0})(x - {x_0})^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_0}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_0})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3 - ({x_0} - {x_0})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{3} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{3 f({x_1}) + 3 f({x_0}) + 2 f({x_1}) - 4 f({x_i}) + 2 f({x_0})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{5 f({x_0}) - 4 f({x_i}) + 5 f({x_1})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} h({x_0})(x - {x_0})^3 dx = h({x_0})\frac{(x - {x_0})^4}{4}|_{a}^{b} = h({x_0})\frac{({x_1} - {x_0})^4 - ({x_0} - {x_0})^4}{4} = h({x_0})\frac{({x_1} - {x_0})^4}{4} = h({x_0})\frac{\Delta x^4}{4} \simeq f'''({x_0}) \frac{\Delta x^4}{4} $$

in the case of forward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_1}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_1}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_1})^2 + h({x_1})(x - {x_1})^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_1}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_1}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_1})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_1})^3 - ({x_0} - {x_1})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) - \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + f({x_0})}{2} ({x_1} - {x_0}) - \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{3} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{3 f({x_1}) + 3 f({x_0}) - 2 f({x_1}) + 4 f({x_i}) - 2 f({x_0})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_0}) + 4 f({x_i}) + f({x_1})}{6} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} h({x_1})(x - {x_1})^3 dx = h({x_1})\frac{(x - {x_1})^4}{4}|_{a}^{b} = h({x_1})\frac{({x_1} - {x_1})^4 - ({x_0} - {x_1})^4}{4} = -h({x_1})\frac{({x_1} - {x_0})^4}{4} = -h({x_1})\frac{\Delta x^4}{4} \simeq -f'''({x_1}) \frac{\Delta x^4}{4} $$

in the case of backward differences,

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( f({x_i}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_i}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_i})^2 + h({x_i})(x - {x_i})^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} \left( f({x_i}) + \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} ({x} - {x_i}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} ({x} - {x_i})^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx \approx f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_i})^3 - ({x_0} - {x_i})^3}{3} $$

$$ \int_{a}^{b} f(x) dx \approx f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{({x_1} - {x_0})^2} \frac{({x_1} - {x_0})^3}{12} $$

$$ \int_{a}^{b} f(x) dx \approx f({x_i})({x_1} - {x_0}) + \frac{f({x_1}) - 2 f({x_i}) + f({x_0})}{12} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{12 f({x_i}) + f({x_1}) - 2 f({x_i}) + f({x_0})}{12} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} f(x) dx \approx \frac{f({x_1}) + 10 f({x_i}) + f({x_0})}{12} ({x_1} - {x_0}) $$

$$ \int_{a}^{b} h({x_i})(x - {x_i})^3 dx = h({x_i})\frac{(x - {x_i})^4}{4}|_{a}^{b} = h({x_i})\frac{({x_1} - {x_i})^4 - ({x_0} - {x_i})^4}{4} = h({x_i})\frac{({x_1} - {x_0})^4 - ({x_1} - {x_0})^4}{64} = 0 $$

in the case of central differences.

The divided differences are:

$$ \frac{df(x)}{dx} \approx \frac{f({x_1}) - f({x_0})}{{x_1} - {x_0}} $$

$$ \frac{d^2f(x)}{dx^2} \approx \frac{\frac{f({x_1}) - f({x_i})}{{x_1} - {x_i}} - \frac{f({x_i}) - f({x_0})}{{x_i} - {x_0}}}{{x_1} - {x_0}} = \frac{2 (f({x_1}) - 2 f({x_i}) + f({x_0}))}{({x_1} - {x_0})^2} $$

$$ \frac{d^3f(x)}{dx^3} \approx \frac{\frac{\frac{f({x_1}) - f(({x_1} + {x_i})/2)}{\frac{{x_1} - {x_0}}{4}} - \frac{f(({x_1} + {x_i})/2) - f({x_i})}{\frac{{x_1} - {x_0}}{4}}}{\frac{{x_1} - {x_0}}{2}} - \frac{\frac{f({x_i}) - f(({x_i} + {x_0})/2)}{\frac{{x_1} - {x_0}}{4}} - \frac{f(({x_i} + {x_0})/2) - f({x_0})}{\frac{{x_1} - {x_0}}{4}}}{\frac{{x_1} - {x_0}}{2}}}{{x_1} - {x_0}} = \frac{8 (f({x_1}) - 2 f(({x_1} + {x_i})/2) + 2 f(({x_i} + {x_0})/2) - f({x_0}))}{({x_1} - {x_0})^3} $$

$$ \frac{d^4f(x)}{dx^4} \approx \frac{\frac{\frac{\frac{f({x_1}) - f(({x_1} + {x_i})/4)}{\frac{{x_1} - {x_0}}{8}} - \frac{f({x_1}) - f(({x_1} + {x_i})/4)}{\frac{{x_1} - {x_0}}{8}}}{\frac{{x_1} - {x_0}}{4}} - \frac{f(({x_1} + {x_i})/2) - f({x_i})}{\frac{{x_1} - {x_0}}{4}}}{\frac{{x_1} - {x_0}}{2}} - \frac{\frac{f({x_i}) - f(({x_i} + {x_0})/2)}{\frac{{x_1} - {x_0}}{4}} - \frac{f(({x_i} + {x_0})/2) - f({x_0})}{\frac{{x_1} - {x_0}}{4}}}{\frac{{x_1} - {x_0}}{2}}}{{x_1} - {x_0}} = \frac{8 (f({x_1}) - 2 f(({x_1} + {x_i})/2) + 2 f(({x_i} + {x_0})/2) - f({x_0}))}{({x_1} - {x_0})^3} $$

Lagrange interpolation

One point:

$$ L_{1}(x_0,x_1) = f(\frac{x_0 + x_1}{2}) = f(x_i) $$

Two points:

$$ L_{2}(x_0,x_1) = \frac{f(x_0)}{(x_0 - x_1)}(x - x_1) + \frac{f(x_1)}{(x_1 - x_0)}(x - x_0) $$

Three points:

$$ L_{3}(x_0,x_1) = \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x - x_i)(x - x_1) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x - x_0)(x - x_1) + \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(x - x_0)(x - x_i) $$

Four points:

$$ L_{4}(x_0,x_1) = \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x - x_i)(x - x_1) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x - x_0)(x - x_1) + \frac{f(x_1)}{(x_1 - x_i)(x_1 - x_0)}(x - x_i)(x - x_0) $$

Five points:

$$ L_{5}(x_0,x_1) = \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x - x_i)(x - x_1) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x - x_0)(x - x_1) + \frac{f(x_1)}{(x_1 - x_i)(x_1 - x_0)}(x - x_i)(x - x_0) $$

Six points:

$$ L_{6}(x_0,x_1) = \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x - x_i)(x - x_1) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x - x_0)(x - x_1) + \frac{f(x_1)}{(x_1 - x_i)(x_1 - x_0)}(x - x_i)(x - x_0) $$

Seven points:

$$ L_{7}(x_0,x_1) = \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x - x_i)(x - x_1) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x - x_0)(x - x_1) + \frac{f(x_1)}{(x_1 - x_i)(x_1 - x_0)}(x - x_i)(x - x_0) $$

One point:

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} (L_{1}(x) + h_{1}(x)) dx = \int_{a}^{b} (f(x_i) + 1 h_{1} (x - x_i)) dx $$

$$ \int_{a}^{b} f(x) dx = f(x_i)(x_1 - x_0) + h_{1}\frac{(x_1 - x_i)^2 - (x_0 - x_i)^2}{2} $$

$$ \int_{a}^{b} f(x) dx = f(x_i)(x_1 - x_0) $$

$$ \int_{a}^{b} f(x) dx = f(x_i) \Delta x $$

Two points:

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} (L_{2}(x) + h_{2}(x)) dx = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - x_1)}(x - x_1) + \frac{f(x_1)}{(x_1 - x_0)}(x - x_0) + 2 h_{2} (x - x_i)^2 \right) dx $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{(x_0 - x_1)} \frac{(x_1 - x_1)^2 - (x_0 - x_1)^2}{2} + \frac{f(x_1)}{(x_1 - x_0)} \frac{(x_1 - x_0)^2 - (x_0 - x_0)^2}{2} + 2 h_{2} \frac{(x_1 - x_i)^3 - (x_0 - x_i)^3}{3} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{(x_0 - x_1)} \frac{-(x_0 - x_1)^2}{2} + \frac{f(x_1)}{(x_1 - x_0)} \frac{(x_1 - x_0)^2}{2} + 2 h_{2} \frac{(x_1 - x_0)^3 - (x_0 - x_1)^3}{24} $$

$$ \int_{a}^{b} f(x) dx = \frac{-f(x_0)}{2} (x_0 - x_1) + \frac{f(x_1)}{2} (x_1 - x_0) + 2 h_{2} \frac{(x_1 - x_0)^3 + (x_1 - x_0)^3}{24} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{2} (x_1 - x_0) + \frac{f(x_1)}{2} (x_1 - x_0) + 4 h_{2} \frac{(x_1 - x_0)^3}{24} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + f(x_1)}{2} (x_1 - x_0) + h_{2} \frac{(x_1 - x_0)^3}{6} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + f(x_1)}{2} \Delta x + h_{2} \frac{\Delta x^3}{6} $$

$$ \int_{a}^{b} f(x) dx = (f(x_0) + f(x_1)) \frac{\Delta x}{2} + h_{2} \frac{\Delta x^3}{6} $$

Three points:

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} (L_{3}(x) + h_{3}(x)) dx = \int_{a}^{b} (L_{3,1}(x) + L_{3,2}(x) + L_{3,3}(x) + h_{3}(x)) dx $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x - x_i)(x - x_1) \right) dx \\ & + \int_{a}^{b} \left( \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x - x_0)(x - x_1) \right) dx \\ & + \int_{a}^{b} \left( \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(x - x_0)(x - x_i) \right) dx \\ & + \int_{a}^{b} h_{3}(x) (x - x_i)^3 dx \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x^2 - x x_i - x x_1 + x_i x_1) \right) dx \\ & + \int_{a}^{b} \left( \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x^2 - x x_0 - x x_1 + x_0 x_1) \right) dx \\ & + \int_{a}^{b} \left( \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(x^2 - x x_0 - x x_i + x_0 x_i) \right) dx \\ & + \int_{a}^{b} h_{3}(x) (x - x_i)^3 dx \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x^2 - (x_i + x_1) x + x_i x_1) \right) dx \\ & + \int_{a}^{b} \left( \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1) \right) dx \\ & + \int_{a}^{b} \left( \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(x^2 - (x_0 + x_i) x + x_0 x_i) \right) dx \\ & + \int_{a}^{b} h_{3}(x) (x - x_i)^3 dx \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (x_i + x_1) \frac{x_1^2 - x_0^2}{2} + x_i x_1 (x_1 - x_0)) \\ & + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + x_1) \frac{x_1^2 - x_0^2}{2} + x_0 x_1 (x_1 - x_0)) \\ & + \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + x_i) \frac{x_1^2 - x_0^2}{2} + x_0 x_i (x_1 - x_0)) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (\frac{x_0 + x_1}{2} + x_1) \frac{x_1^2 - x_0^2}{2} + \frac{x_0 + x_1}{2} x_1 (x_1 - x_0)) \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + x_1) \frac{x_1^2 - x_0^2}{2} + x_0 x_1 (x_1 - x_0)) \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + \frac{x_0 + x_1}{2}) \frac{x_1^2 - x_0^2}{2} + x_0 \frac{x_0 + x_1}{2} (x_1 - x_0)) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 + 3 x_1}{2} \frac{x_1^2 - x_0^2}{2} + \frac{x_1^2 - x_0^2}{2} x_1) \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 - x_0^3 + x_1^3 - x_1 x_0^2}{2} + x_0 x_1^2 - x_1 x_0^2) \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - \frac{3 x_0 + x_1}{2} \frac{x_1^2 - x_0^2}{2} + \frac{x_1^2 - x_0^2}{2} x_0) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (\frac{x_0 + 3 x_1}{2} - x_1) \frac{x_1^2 - x_0^2}{2}) \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 - x_0^3 + x_1^3 - x_1 x_0^2 - 2 x_0 x_1^2 + 2 x_1 x_0^2}{2}) \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - (\frac{3 x_0 + x_1}{2} - x_0) \frac{x_1^2 - x_0^2}{2}) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 + x_1}{2} \frac{x_1^2 - x_0^2}{2}) \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)} \frac{2 x_1^3 - 2 x_0^3 - 3 x_0 x_1^2 + 3 x_0^3 - 3 x_1^3 + 3 x_1 x_0^2 + 6 x_0 x_1^2 - 6 x_1 x_0^2}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 + x_1}{2} \frac{x_1^2 - x_0^2}{2}) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 - x_0^3 + x_1^3 - x_1 x_0^2}{4}) \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)} \frac{-x_1^3 + x_0^3 + 3 x_0 x_1^2 - 3 x_1 x_0^2}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 + x_1^3 - x_0^3 - x_1 x_0^2}{4}) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{4 x_1^3 - 4 x_0^3 - 3 x_0 x_1^2 + 3 x_0^3 - 3 x_1^3 + 3 x_1 x_0^2}{12} \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)} \frac{-x_1^3 + 3 x_0 x_1^2 - 3 x_1 x_0^2 + x_0^3}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{4 x_1^3 - 4 x_0^3 - 3 x_0 x_1^2 - 3 x_1^3 + 3 x_0^3 + 3 x_1 x_0^2}{12}) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{x_1^3 - x_0^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2}{12} \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_1 - x_0)} \frac{x_1^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2 - x_0^3}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2}{12}) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{x_1^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2 - x_0^3}{12} \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)} \frac{x_1^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2 - x_0^3}{12} \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{(x_1 - x_0)^3}{12} \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{12} \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{12} \\ & + \frac{4f(x_i)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{12} \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{2f(x_0)}{(x_1 - x_0)^2} \frac{(x_1 - x_0)^3}{12} \\ & + \frac{4f(x_i)}{(x_1 - x_0)^2} \frac{(x_1 - x_0)^3}{6} \\ & + \frac{2f(x_1)}{(x_1 - x_0)^2} \frac{(x_1 - x_0)^3}{12} \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \frac{f(x_0)}{6} (x_1 - x_0) \\ & + \frac{4f(x_i)}{6} (x_1 - x_0) \\ & + \frac{f(x_1)}{6} (x_1 - x_0) \\ & + h_{3} \frac{(x_1 - x_i)^4 - (x_0 - x_i)^4}{4} \end{align} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{6} (x_1 - x_0) + \frac{4f(x_i)}{6} (x_1 - x_0) + \frac{f(x_1)}{6} (x_1 - x_0) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + 4f(x_i) + f(x_1)}{6} (x_1 - x_0) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + 4f(x_i) + f(x_1)}{6} \Delta x + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = (f(x_0) + 4f(x_i) + f(x_1)) \frac{\Delta x}{6} + 3 h_{3} (x - x_i)^3 $$

Four points:

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} (L_{4}(x) + h_{4}(x)) dx = \int_{a}^{b} (L_{4,1}(x) + L_{4,2}(x) + L_{4,3}(x) + L_{4,4}(x) + h_{4}(x)) dx $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - {x_i}_{1/3})(x_0 - {x_i}_{2/3})(x_0 - x_1)}(x - {x_i}_{1/3})(x - {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{1/3})}{({x_i}_{1/3} - x_0)({x_i}_{1/3} - {x_i}_{2/3})({x_i}_{1/3} - x_1)}(x - x_0)(x - {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{2/3})}{({x_i}_{2/3} - x_0)({x_i}_{2/3} - {x_i}_{1/3})({x_i}_{2/3} - x_1)}(x - x_0)(x - {x_i}_{1/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f(x_1)}{(x_1 - x_0)(x_1 - {x_i}_{1/3})(x_1 - {x_i}_{2/3})}(x - x_0)(x - {x_i}_{1/3})(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{\frac{1}{3}(x_0 - x_1) \frac{2}{3}(x_0 - x_1) \frac{1}{1}(x_0 - x_1)}(x - {x_i}_{1/3})(x - {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{1/3})}{\frac{1}{3}(x_1 - x_0) \frac{1}{3}(x_0 - x_1) \frac{2}{3}(x_0 - x_1)}(x - x_0)(x - {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{2/3})}{\frac{2}{3}(x_1 - x_0) \frac{1}{3}(x_1 - x_0) \frac{1}{3}(x_0 - x_1)}(x - x_0)(x - {x_i}_{1/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f(x_1)}{\frac{1}{1}(x_1 - x_0) \frac{2}{3}(x_1 - x_0) \frac{1}{3}(x_1 - x_0)}(x - x_0)(x - {x_i}_{1/3})(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{9}{2} \frac{f(x_0)}{(x_0 - x_1) (x_0 - x_1) (x_0 - x_1)}(x - {x_i}_{1/3})(x - {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{27}{2} \frac{f({x_i}_{1/3})}{(x_1 - x_0) (x_0 - x_1) (x_0 - x_1)}(x - x_0)(x - {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{27}{2} \frac{f({x_i}_{2/3})}{(x_1 - x_0) (x_1 - x_0) (x_0 - x_1)}(x - x_0)(x - {x_i}_{1/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{9}{2} \frac{f(x_1)}{(x_1 - x_0) (x_1 - x_0) (x_1 - x_0)}(x - x_0)(x - {x_i}_{1/3})(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( -\frac{9}{2} \frac{f(x_0)}{(x_1 - x_0)^3} (x - {x_i}_{1/3}) (x - {x_i}_{2/3}) (x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{27}{2} \frac{f({x_i}_{1/3})}{(x_1 - x_0)^3} (x - x_0) (x - {x_i}_{2/3}) (x - x_1) \right) dx\\ & + \int_{a}^{b} \left( -\frac{27}{2} \frac{f({x_i}_{2/3})}{(x_1 - x_0)^3} (x - x_0) (x - {x_i}_{1/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{9}{2} \frac{f(x_1)}{(x_1 - x_0)^3} (x - x_0)(x - {x_i}_{1/3})(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx = & - \frac{9}{2} \frac{f(x_0)}{(x_1 - x_0)^3} \int_{a}^{b} \left( (x - {x_i}_{1/3}) (x - {x_i}_{2/3}) (x - x_1) \right) dx\\ & + \frac{27}{2} \frac{f({x_i}_{1/3})}{(x_1 - x_0)^3} \int_{a}^{b} \left( (x - x_0) (x - {x_i}_{2/3}) (x - x_1) \right) dx\\ & - \frac{27}{2} \frac{f({x_i}_{2/3})}{(x_1 - x_0)^3} \int_{a}^{b} \left( (x - x_0) (x - {x_i}_{1/3})(x - x_1) \right) dx\\ & + \frac{9}{2} \frac{f(x_1)}{(x_1 - x_0)^3} \int_{a}^{b} \left( (x - x_0)(x - {x_i}_{1/3})(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - {x_i}_{1/3})(x_0 - {x_i}_{2/3})(x_0 - x_1)}(x^2 - ({x_i}_{1/3} + {x_i}_{2/3}) x + {x_i}_{1/3} {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{1/3})}{({x_i}_{1/3} - x_0)({x_i}_{1/3} - {x_i}_{2/3})({x_i}_{1/3} - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1)(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{2/3})}{({x_i}_{2/3} - x_0)({x_i}_{2/3} - {x_i}_{1/3})({x_i}_{2/3} - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1)(x - {x_i}_{1/3}) \right) dx\\ & + \int_{a}^{b} \left( \frac{f(x_1)}{(x_1 - x_0)(x_1 - {x_i}_{1/3})(x_1 - {x_i}_{2/3})}(x^2 - ({x_i}_{1/3} + {x_i}_{2/3}) x + {x_i}_{1/3} {x_i}_{2/3})(x - x_0) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - {x_i}_{1/3})(x_0 - {x_i}_{2/3})(x_0 - x_1)}(x^2 - ({x_i}_{1/3} + {x_i}_{2/3}) x + {x_i}_{1/3} {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{1/3})}{({x_i}_{1/3} - x_0)({x_i}_{1/3} - {x_i}_{2/3})({x_i}_{1/3} - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1)(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{2/3})}{({x_i}_{2/3} - x_0)({x_i}_{2/3} - {x_i}_{1/3})({x_i}_{2/3} - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1)(x - {x_i}_{1/3}) \right) dx\\ & + \int_{a}^{b} \left( \frac{f(x_1)}{(x_1 - x_0)(x_1 - {x_i}_{1/3})(x_1 - {x_i}_{2/3})}(x^2 - ({x_i}_{1/3} + {x_i}_{2/3}) x + {x_i}_{1/3} {x_i}_{2/3})(x - x_0) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \begin{align} \int_{a}^{b} f(x) dx & = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - {x_i}_{1/3})(x_0 - {x_i}_{2/3})(x_0 - x_1)}(x^2 - ({x_i}_{1/3} + {x_i}_{2/3}) x + {x_i}_{1/3} {x_i}_{2/3})(x - x_1) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{1/3})}{({x_i}_{1/3} - x_0)({x_i}_{1/3} - {x_i}_{2/3})({x_i}_{1/3} - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1)(x - {x_i}_{2/3}) \right) dx\\ & + \int_{a}^{b} \left( \frac{f({x_i}_{2/3})}{({x_i}_{2/3} - x_0)({x_i}_{2/3} - {x_i}_{1/3})({x_i}_{2/3} - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1)(x - {x_i}_{1/3}) \right) dx\\ & + \int_{a}^{b} \left( \frac{f(x_1)}{(x_1 - x_0)(x_1 - {x_i}_{1/3})(x_1 - {x_i}_{2/3})}(x^2 - ({x_i}_{1/3} + {x_i}_{2/3}) x + {x_i}_{1/3} {x_i}_{2/3})(x - x_0) \right) dx\\ & + \int_{a}^{b} 4 h_{4} (x - x_i)^4 dx\\ \end{align} $$

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x^2 - x x_i - x x_1 + x_i x_1) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x^2 - x x_0 - x x_1 + x_0 x_1) + \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(x^2 - x x_0 - x x_i + x_0 x_i) + 3 h_{3} (x - x_i)^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx = \int_{a}^{b} \left( \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(x^2 - (x_i + x_1) x + x_i x_1) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(x^2 - (x_0 + x_1) x + x_0 x_1) + \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(x^2 - (x_0 + x_i) x + x_0 x_i) + 3 h_{3} (x - x_i)^3 \right) dx $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{(x_0 - x_i)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (x_i + x_1) \frac{x_1^2 - x_0^2}{2} + x_i x_1 (x_1 - x_0)) + \frac{f(x_i)}{(x_i - x_0)(x_i - x_1)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + x_1) \frac{x_1^2 - x_0^2}{2} + x_0 x_1 (x_1 - x_0)) + \frac{f(x_1)}{(x_1 - x_0)(x_1 - x_i)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + x_i) \frac{x_1^2 - x_0^2}{2} + x_0 x_i (x_1 - x_0)) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (\frac{x_0 + x_1}{2} + x_1) \frac{x_1^2 - x_0^2}{2} + \frac{x_0 + x_1}{2} x_1 (x_1 - x_0)) + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + x_1) \frac{x_1^2 - x_0^2}{2} + x_0 x_1 (x_1 - x_0)) + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - (x_0 + \frac{x_0 + x_1}{2}) \frac{x_1^2 - x_0^2}{2} + x_0 \frac{x_0 + x_1}{2} (x_1 - x_0)) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 + 3 x_1}{2} \frac{x_1^2 - x_0^2}{2} + \frac{x_1^2 - x_0^2}{2} x_1) + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 - x_0^3 + x_1^3 - x_1 x_0^2}{2} + x_0 x_1^2 - x_1 x_0^2) + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - \frac{3 x_0 + x_1}{2} \frac{x_1^2 - x_0^2}{2} + \frac{x_1^2 - x_0^2}{2} x_0) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - (\frac{x_0 + 3 x_1}{2} - x_1) \frac{x_1^2 - x_0^2}{2}) + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 - x_0^3 + x_1^3 - x_1 x_0^2 - 2 x_0 x_1^2 + 2 x_1 x_0^2}{2}) + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - (\frac{3 x_0 + x_1}{2} - x_0) \frac{x_1^2 - x_0^2}{2}) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 + x_1}{2} \frac{x_1^2 - x_0^2}{2}) + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)} \frac{2 x_1^3 - 2 x_0^3 - 3 x_0 x_1^2 + 3 x_0^3 - 3 x_1^3 + 3 x_1 x_0^2 + 6 x_0 x_1^2 - 6 x_1 x_0^2}{6} + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 + x_1}{2} \frac{x_1^2 - x_0^2}{2}) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 - x_0^3 + x_1^3 - x_1 x_0^2}{4}) + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)} \frac{-x_1^3 + x_0^3 + 3 x_0 x_1^2 - 3 x_1 x_0^2}{6} + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3}{3} - \frac{x_0 x_1^2 + x_1^3 - x_0^3 - x_1 x_0^2}{4}) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{4 x_1^3 - 4 x_0^3 - 3 x_0 x_1^2 + 3 x_0^3 - 3 x_1^3 + 3 x_1 x_0^2}{12} + \frac{4f(x_i)}{(x_1 - x_0)(x_0 - x_1)} \frac{-x_1^3 + 3 x_0 x_1^2 - 3 x_1 x_0^2 + x_0^3}{6} + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{4 x_1^3 - 4 x_0^3 - 3 x_0 x_1^2 - 3 x_1^3 + 3 x_0^3 + 3 x_1 x_0^2}{12}) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{x_1^3 - x_0^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2}{12} + \frac{4f(x_i)}{(x_1 - x_0)(x_1 - x_0)} \frac{x_1^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2 - x_0^3}{6} + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - x_0^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2}{12}) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{x_1^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2 - x_0^3}{12} + \frac{4f(x_i)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{6} + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)}(\frac{x_1^3 - 3 x_0 x_1^2 + 3 x_1 x_0^2 - x_0^3}{12}) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{2f(x_0)}{(x_0 - x_1)(x_0 - x_1)} \frac{(x_1 - x_0)^3}{12} + \frac{4f(x_i)}{6} (x_1 - x_0) + \frac{2f(x_1)}{(x_1 - x_0)(x_1 - x_0)} \frac{(x_1 - x_0)^3}{12} + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{6} (x_1 - x_0) + \frac{4f(x_i)}{6} (x_1 - x_0) + \frac{f(x_1)}{6} (x_1 - x_0) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + 4f(x_i) + f(x_1)}{6} (x_1 - x_0) + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + 4f(x_i) + f(x_1)}{6} \Delta x + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = (f(x_0) + 4f(x_i) + f(x_1)) \frac{\Delta x}{6} + 3 h_{3} (x - x_i)^3 $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{(x_0 - x_1)} \frac{-(x_0 - x_1)^2}{2} + \frac{f(x_1)}{(x_1 - x_0)} \frac{(x_1 - x_0)^2}{2} + 2 h_{2} \frac{(x_1 - x_0)^3 - (x_0 - x_1)^3}{24} $$

$$ \int_{a}^{b} f(x) dx = \frac{-f(x_0)}{2} (x_0 - x_1) + \frac{f(x_1)}{2} (x_1 - x_0) + 2 h_{2} \frac{(x_1 - x_0)^3 + (x_1 - x_0)^3}{24} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0)}{2} (x_1 - x_0) + \frac{f(x_1)}{2} (x_1 - x_0) + 4 h_{2} \frac{(x_1 - x_0)^3}{24} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + f(x_1)}{2} (x_1 - x_0) + h_{2} \frac{(x_1 - x_0)^3}{6} $$

$$ \int_{a}^{b} f(x) dx = \frac{f(x_0) + f(x_1)}{2} \Delta x + h_{2} \frac{\Delta x^3}{6} $$

$$ \int_{a}^{b} f(x) dx = f(x_i)(x_1 - x_0) $$

$$ \int_{a}^{b} f(x) dx = f(x_i) \Delta x $$

$$ \int_{a}^{b} f(x) dx \approx \int_{a}^{b} f(x_i) dx $$

S-Sum $$ S_{1}(x_0,x_1) = x_i1/2 / 1 $$

$$ S_{2}(x_0,x_1) = x_i1/3 + x_i2/3 / 2 $$

$$ S_{1}(x_0,x_1) = x_i1/4 + x_i2/4 + x_i3/4 / 3 $$

Let us consider the integrals

$$ \int (x - c_1) dx = \frac{x^2}{2} - c_1 x + c_0 = \frac{1 x^2 - 2 c_1 x + 2 c_0}{1 \times 2} $$

$$ \int (x - c_1) (x - c_2) dx = \int (x^2 - (c_1 + c_2) x + c_1 c_2) dx = \frac{x^3}{3} - (c_1 + c_2) \frac{x^2}{2} + c_1 c_2 x + c_0 = \frac{2 x^3 - 3 (c_1 + c_2) x + 6 c_1 c_2 x + 6 c_0}{1 \times 2 \times 3} $$

$$ \int (x - c_1) (x - c_2) (x - c_3) dx = \int (x^3 - (c_1 + c_2 + c_3) x^2 + (c_1 c_2 + c_1 c_3 + c_2 c_3) x + c_1 c_2 c_3) dx = \frac{x^4}{4} - (c_1 + c_2 + c_3) \frac{x^3}{3} + (c_1 c_2 + c_1 c_3 + c_2 c_3) \frac{x^2}{2} + c_1 c_2 c_3 x + c_0 = \frac{2 x^3 - 3 (c_1 + c_2) x + 6 c_1 c_2 x + 6 c_0}{1 \times 2 \times 3} $$

An analytical method of calculation of the relative weights of the evaluations of the function $$f(x)$$ at the points $${x_{0}}, {x_{i}}_{({x_{0}},{x_{1}})}, {x_{1}}, ...$$, consists in evaluating the integral of the function $$f(x)$$ as the integral of a polynomial approximation.

If one chooses the value of $${x_k}$$ as $${x_k} = {x_j}$$, i.e., at the beginning of every subinterval, then the sum of products is equal to:

$$ \int_{a}^{b} f(x) dx \approx f({x_0} = a) ({x_1} - {x_0}) + f({x_1}) ({x_2} - {x_1}) + ... + f({x_{n-2}}) ({x_{n-1}} - {x_{n-2}}) + f({x_{n-1}}) ({x_n} - {x_{n-1}}) $$,

If one chooses the value of $${x_k}$$ as $${x_k} = {x_i}$$, i.e., at the beginning of every subinterval, then the sum of products is equal to:

$$ \int_{a}^{b} f(x) dx \approx f({x_0} = a) ({x_1} - {x_0}) + f({x_1}) ({x_2} - {x_1}) + ... + f({x_{n-2}}) ({x_{n-1}} - {x_{n-2}}) + f({x_{n-1}}) ({x_n} - {x_{n-1}}) $$,

Let us consider the case of equally-spaced points (although this restriction can be easily lifted), according to the definition,

In the case of a semi-continuous function, i.e., a function which is continuous except for a finite numerable set of points in an interval $$(a,d)$$, the calculation of the definite integral can be defined as the sum of the definite integrals between the points of discontinuity, i.e.,

$$\int_{a}^{d} f(x) dx = \int_{a}^{b^{-}} f(x) dx + \int_{b^{+}}^{c^{-}} f(x) dx + \int_{c^{+}}^{d} f(x) dx \approx \sum_{x = a}^{x = {b^{-}}} f(x) \Delta x + \sum_{x = {b^{+}}}^{x = {c^{-}}} f(x) \Delta x + \sum_{x = {c^{+}}}^{x = d} f(x) \Delta x$$.

<!--

010 LET X0 = 0.0 020 LET XI = 0.5 030 LET X1 = 1.0 040 LET Y0 = EXP(X0) 050 LET YI = EXP(XI) 060 LET Y1 = EXP(X1) 070 LET IC = Y1 - Y0 080 LET I0 = Y0 * (X1 - X0) 090 LET II = YI * (X1 - X0) 100 LET I1 = Y1 * (X1 - X0) 110 LET I2 = (Y0 + Y1) / 2 * (X1 - X0) 120 LET I3 = (Y0 + YI + Y1) / 3 * (X1 - X0) 130 LET I4 = (Y0 + 2 * YI + Y1) / 4 * (X1 - X0) 140 LET I6 = (Y0 + 4 * YI + Y1) / 6 * (X1 - X0) 150 LET I8 = (Y0 + 6 * YI + Y1) / 8 * (X1 - X0) 160 LET I9 = (Y0 + 8 * YI + Y1) / 10 * (X1 - X0) 170 LET E0 = (I0 - IC) / IC * 100 180 LET EI = (II - IC) / IC * 100 190 LET E1 = (I1 - IC) / IC * 100 200 LET E2 = (I2 - IC) / IC * 100 210 LET E3 = (I3 - IC) / IC * 100 220 LET E4 = (I4 - IC) / IC * 100 230 LET E6 = (I6 - IC) / IC * 100 240 LET E8 = (I8 - IC) / IC * 100 250 LET E9 = (I9 - IC) / IC * 100 260 PRINT IC 270 PRINT I0 280 PRINT II 290 PRINT I1 300 PRINT I2 310 PRINT I3 320 PRINT I4 330 PRINT I6 340 PRINT I8 350 PRINT I9 360 PRINT E0 370 PRINT EI 380 PRINT E1 390 PRINT E2 400 PRINT E3 410 PRINT E4 420 PRINT E6 430 PRINT E8 440 PRINT E9 450 END

000 ANSWERS

1.71828

1

1.64872

2.71828

1.85914

1.78900

1.75393

1.71886

1.70133

1.69081

-41.8023

-4.04826

58.1977

8.19767

4.11570

2.07471

0.0337172

-0.986777

-1.59908

--

010 LET IC = (EXP(1.0) - EXP(0.0)) 020 LET I = (EXP(0.0) + 4 * EXP(0.25) + 2 * EXP(0.5) + 4 * EXP(0.75) + EXP(1.0)) * 0.5 / 6 030 LET E = (I - IC) / IC * 100 040 PRINT IC 050 PRINT I 060 PRINT E 070 END

ANSWER

1.71828

1.71832

0.00216456

--

010 LET IC = (EXP(1.0) - EXP(0.0)) 020 LET I = (EXP(0.0) + EXP(0.25) + 6 * EXP(0.5) + EXP(0.75) + EXP(1.0)) * 1.0 / 10 030 LET E = (I - IC) / IC * 100 040 PRINT IC 050 PRINT I 060 PRINT E 070 END

ANSWER

1.71828

1.70116

-0.99624

--

010 LET IC = (EXP(1.0) - EXP(0.0)) 020 LET I = (EXP(0.0) + 7 * EXP(0.25) + 2 * EXP(0.5) + 7 * EXP(0.75) + EXP(1.0)) * 0.5 / 10 030 LET E = (I - IC) / IC * 100 040 PRINT IC 050 PRINT I 060 PRINT E 070 END

ANSWER

1.71828

1.70116

-0.99624

--

010 LET X0 = -1.0 020 LET X1 = 1.0 030 LET XI = (X1 + X0) / 2 040 LET Y0 = EXP(X0) 050 LET Y1 = EXP(X1) 060 LET YI = EXP(XI) 070 LET IC = (Y1 - Y0) 080 LET II = YI * (X1 - X0) 090 LET I3 = (Y0 + YI + Y1) / 3 * (X1- X0) 100 LET I4 = (Y0 + 2 * YI + Y1) / 4 * (X1- X0) 110 LET I5 = (Y0 + 3 * YI + Y1) / 5 * (X1- X0) 120 LET I6 = (Y0 + 4 * YI + Y1) / 6 * (X1- X0) 130 LET I7 = (Y0 + 5 * YI + Y1) / 7 * (X1- X0) 140 LET I8 = (Y0 + 6 * YI + Y1) / 8 * (X1- X0) 150 LET I9 = (Y0 + 7 * YI + Y1) / 9 * (X1- X0) 160 LET I10 = (Y0 + 8 * YI + Y1) / 10 * (X1- X0) 170 LET I11 = (Y0 + 9 * YI + Y1) / 11 * (X1- X0) 180 LET I12 = (Y0 + 10 * YI + Y1) / 12 * (X1- X0) 190 LET I13 = (Y0 + 11 * YI + Y1) / 13 * (X1- X0) 200 LET I14 = (Y0 + 12 * YI + Y1) / 14 * (X1- X0) 210 LET I15 = (Y0 + 13 * YI + Y1) / 15 * (X1- X0) 220 LET I16 = (Y0 + 14 * YI + Y1) / 16 * (X1- X0) 230 LET I17 = (Y0 + 15 * YI + Y1) / 17 * (X1- X0) 240 LET I18 = (Y0 + 16 * YI + Y1) / 18 * (X1- X0) 250 LET I19 = (Y0 + 17 * YI + Y1) / 19 * (X1- X0) 260 LET I20 = (Y0 + 18 * YI + Y1) / 20 * (X1- X0) 270 LET I21 = (Y0 + 19 * YI + Y1) / 21 * (X1- X0) 280 LET I22 = (Y0 + 20 * YI + Y1) / 22 * (X1- X0) 290 LET EC = (IC - IC) / IC * 100 300 LET EI = (II - IC) / IC * 100 310 LET E3 = (I3 - IC) / IC * 100 320 LET E4 = (I4 - IC) / IC * 100 330 LET E5 = (I5 - IC) / IC * 100 340 LET E6 = (I6 - IC) / IC * 100 350 LET E7 = (I7 - IC) / IC * 100 360 LET E8 = (I8 - IC) / IC * 100 370 LET E9 = (I9 - IC) / IC * 100 380 LET E10 = (I10 - IC) / IC * 100 390 LET E11 = (I11 - IC) / IC * 100 400 LET E12 = (I12 - IC) / IC * 100 410 LET E13 = (I13 - IC) / IC * 100 420 LET E14 = (I14 - IC) / IC * 100 430 LET E15 = (I15 - IC) / IC * 100 440 LET E16 = (I16 - IC) / IC * 100 450 LET E17 = (I17 - IC) / IC * 100 460 LET E18 = (I18 - IC) / IC * 100 470 LET E19 = (I19 - IC) / IC * 100 480 LET E20 = (I20 - IC) / IC * 100 490 LET E21 = (I21 - IC) / IC * 100 500 LET E22 = (I22 - IC) / IC * 100 510 PRINT IC 520 PRINT II 530 PRINT I3 540 PRINT I4 550 PRINT I5 560 PRINT I6 570 PRINT I7 580 PRINT I8 590 PRINT I9 600 PRINT I10 610 PRINT I11 620 PRINT I12 630 PRINT I13 640 PRINT I14 650 PRINT I15 660 PRINT I16 670 PRINT I17 680 PRINT I18 690 PRINT I19 700 PRINT I20 710 PRINT I21 720 PRINT I22 730 PRINT EC 740 PRINT EI 750 PRINT E3 760 PRINT E4 770 PRINT E5 780 PRINT E6 790 PRINT E7 800 PRINT E8 810 PRINT E9 820 PRINT E10 830 PRINT E11 840 PRINT E12 850 PRINT E13 860 PRINT E14 870 PRINT E15 880 PRINT E16 890 PRINT E17 900 PRINT E18 910 PRINT E19 920 PRINT E20 930 PRINT E21 940 PRINT E22 950 END

ANSWER

2.3504

2

2.72411

2.54308

2.43446

2.36205

2.31033

2.27154

2.24137

2.21723

2.19748

2.18103

2.1671

2.15517

2.14482

2.13577

2.12778

2.12068

2.11433

2.10862

2.10344

2.09874

0

-14.9082

15.8996

8.19767

3.5765

0.495714

-1.70485

-3.35526

-4.63892

-5.66584

-6.50605

-7.20623

-7.79869

-8.30651

-8.74662

-9.13171

-9.47151

-9.77355

-10.0438

-10.287

-10.5071

-10.7071

010 LET X0 = -1.0 020 LET X1 = 1.0 030 LET XI = (X1 + X0) / 2 040 LET Y0 = EXP(X0) 050 LET Y1 = EXP(X1) 060 LET YI = EXP(XI) 070 LET IC = (Y1 - Y0) 080 LET II = YI * (X1 - X0) 090 LET I2 = (Y0 + Y1) / 2 * (X1 - X0) 100 LET I3 = (Y0 + YI + Y1) / 3 * (X1- X0) 110 LET I4 = (Y0 + 2 * YI + Y1) / 4 * (X1- X0) 120 LET I5 = (Y0 + 3 * YI + Y1) / 5 * (X1- X0) 130 LET I6 = (Y0 + 4 * YI + Y1) / 6 * (X1- X0) 140 LET EC = (IC - IC) / IC * 100 150 LET EI = (II - IC) / IC * 100 160 LET E2 = (I2 - IC) / IC * 100 170 LET E3 = (I3 - IC) / IC * 100 180 LET E4 = (I4 - IC) / IC * 100 190 LET E5 = (I5 - IC) / IC * 100 200 LET E6 = (I6 - IC) / IC * 100 210 PRINT IC 220 PRINT II 230 PRINT I2 240 PRINT I3 250 PRINT I4 260 PRINT I5 270 PRINT I6 280 PRINT EC 290 PRINT EI 200 PRINT E2 310 PRINT E3 320 PRINT E4 330 PRINT E5 340 PRINT E6 350 END

2.3504

2

3.08616

2.72411

2.54308

2.43446

2.36205

0

-14.9082

31.3035

15.8996

8.19767

3.5765

0.495714

-->