text:
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

-->


text:
Chess Opening Theory/1. d4/1...Nf6/2. Bf4/2...e6/3. e3/3...d5/4. Nd2/4...c5/5. c3

= London System Main Line - Pyramidal Structure c3-d4-e3 =

In the London System following the moves '''1. d4 Nf6 2. Bf4 e6 3. e3 d5 4. Nd2 c5 5. c3''', White's strategy centers around a few key ideas:

 * 1) Pyramidal Pawn Structure: The setup with pawns on c3, d4, and e3 creates a robust and characteristic pyramidal pawn structure for White. This structure solidifies the center, supporting both central and queenside operations.
 * 2) Defending the Queenside Pawn: With an early c3, White strengthens the d4 pawn and also prepares to safeguard the b2 pawn. Black's ...Qb6 often targets this pawn, but the advance of the c3 pawn, combined with other pieces, can neutralize such threats effectively.
 * 3) Active Dark-Squared Bishop: Even though Black may emulate a Queen's Gambit Declined approach, White's dark-squared bishop on f4 remains a dynamic asset. Its active posture grants White a potential advantage, especially in endgame scenarios where its influence can become pronounced.
 * 4) Reacting to ...c4 Advance: Should Black choose to push ...c4, White's plan typically involves a timely e4 pawn break, often preceded by retreating the light-squared bishop to c2, ensuring the center remains fluid and active.
 * 5) Countering ...Qb6: The c3 pawn move not only solidifies the center but also provides White the tactical resource of answering ...Qb6 with Qb3. This counter not only defends potential threats but can also lead to queen exchanges that favor White due to the active piece placement.

In essence, White's strategy in this line of the London System combines a sturdy pawn structure with active piece play, seeking to challenge Black's plans while also creating threats of their own.

Theory table
. '''1. d4 d5 2. Bf4 Nf6 3. e3 e6 4. Nd2 c5 5. c3'''

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Chess Opening Theory/1. d4/1...Nf6/2. Bf4/2...e6/3. e3/3...d5/4. Nd2/4...c5/5. c3/5...Nc6

= London System Main Line with Black ...e6 and ...c5 =

When Black faces the London System and adopts the sequence of moves '''1. d4 Nf6 2. Bf4 e6 3. e3 d5 4. Nd2 c5 5. c3 Nc6''', they employ a blend of classical central control and active piece development. Black's strategy in this line of the London System is centered around challenging the center, active piece deployment, and flexible pawn structures. Black aims to counteract White's plans and seize the initiative whenever opportunities arise. The strategy encompasses:

 * 1) Challenging the Center: With ...d5 and ...c5, Black directly challenges White's central pawns, aiming to break the typical pawn structures White might establish. The goal is to create a more dynamic game and avoid getting squeezed by a potential White pawn roller in the center.
 * 2) Active Knight Development: With ...Nf6 and ...Nc6, Black gets both knights to their most natural squares, pressuring the d4 pawn and supporting potential central pawn breaks.
 * 3) Flexible Bishop Deployment: In this setup, Black has options regarding the light-squared bishop. Depending on White's responses, the bishop can be fianchettoed with ...b6 and ...Bb7, or it can come out more traditionally with ...Bd6 or ...Be7.
 * 4) Queenside Counterplay: Black's ...c5 pawn break, combined with the knight on c6, allows for potential queenside operations. Moves like ...Qb6, targeting the b2 pawn, or doubling rooks on the c-file, can generate tangible threats.
 * 5) Central Pawn Breaks: Depending on White's setup and pawn structure, Black can look for a timely ...e5 or ...d4 pawn thrust, opening up the center and freeing their pieces.
 * 6) King Safety: Depending on the flow of the game, Black can opt for a short castle with ...Be7 followed by ...O-O. If the game becomes more open and there are potential tactics or threats on the kingside, Black might consider a long castle, though it's less common in these structures.
 * 7) Trade Considerations: Given White's active dark-squared bishop on f4, Black might seek to exchange it with ...Bd6 at the right moment. Removing this bishop can neutralize some of White's pressure and make Black's game easier to play.

Theory table
. '''1. d4 d5 2. Bf4 Nf6 3. e3 e6 4. Nd2 c5 5. c3 Nc6'''


text:
User:Adolfo Martin Fuentes/sandbox

= BASIC Programming Language =

BASIC was developed in 1963 at Dartmouth College in Hanover, New Hampshire as a teaching language. The acronym BASIC stands for Beginner's All-Purpose Symbolic Instruction Code. In 1964, John G. Kemeny and Thomas E. Kurtz designed the original BASIC language at Dartmouth College in New Hampshire.

= Programming Preliminaries = Anybody can write a program. A background in mathematics or science is not required. Patience, practice, and an interest in the subject matter should suffice, along with the required software and hardware.

Understanding programs can appear daunting at first, but their reliance on logical operations allow for easy learning of commands which you will commonly see in many programs. A program itself is merely a series of commands in the order in which they are to be executed. That is to say, that the first line is the beginning of the program!

All programs a user uses from day to day, including browsers (Internet Explorer, Firefox, etc.) and operating systems (Windows, Linux and Mac OS, etc) are separate sets of lines of code, which aim to fulfill tasks. The amount of code is dependent on how simple the task generally, and different types of code may be used for the advantages they give. BASIC is considered an excellent starting point for moving onto other languages, and can be useful for simple programs.

= Programming Languages = Programming languages allow people to give instructions to a computer with commands that both the computer and the programmer can understand. Different programming languages use different commands and different rules for entering those commands; similar to the way people speak different words to each other with the same meaning. One person may say "hello", while another says "hola", which appear different but express the same thought.

Computer programming languages can be similar to each other in the same way that human languages, such as French and Spanish, can be. Programming languages that are similar are usually referred to as related languages. Once a person learns a programming language, it is easier to then learn other programming languages, especially those related to the first one, as many similarities in structure are shared between languages, especially those with a common ancestor. The language taught here, BASIC, is easier to learn than others as its commands are similar to English and it has a simple set of rules for entering them.

= Program = A program is defined as an instruction set that describes the logical steps the computer will follow to solve a particular problem. With programming the user is able to understand and communicate with the computer.

title: User:Adolfo Martin Fuentes/sandbox


text:
Chess Opening Theory/1. d4/1...Nf6/2. Bf4/2...e6/3. e3/3...d5/4. Nd2/4...c5/5. c3/5...Nc6/6. Ngf3

= London System Main Line with Black ...e6 and ...c5 =

In essence, after '''1. d4 d5 2. Bf4 Nf6 3. e3 e6 4. Nd2 c5 5. c3 Nc6 6. Nf3''', White's strategy revolves around leveraging the solid pyramidal pawn structure, maximizing piece activity, particularly with the knight on e5, and creating scenarios where Black might inadvertently weaken their own king's safety. White has several strategic goals:

 * 1) Pyramidal Pawn Structure: The pawns on c3, d4, and e3 form a sturdy pyramid structure. This structure provides a strong central presence and serves as a foundation for White's piece activity. It not only bolsters the center but also supports the plans of advancing the central or kingside pawns.
 * 2) Knight to e5: With the knight developed to f3, White often aims to plant it on the e5 square, a key central outpost. The move Nf3 supports this idea, and the pyramidal structure aids in maintaining the knight's dominance on e5.
 * 3) Bishop Considerations: White's dark-squared bishop on f4 is a crucial piece. The option of capturing on d6, while tactically possible, often helps Black to harmonize development after ...Qxd6 or ...exd6. As a strategic alternative, retreating the bishop to g3 keeps the tension and presents Black with the dilemma of opening the h-file if they decide to capture on g3.
 * 4) Supporting the e5 Knight: In scenarios where the bishop is retreated to g3, White has the added benefit of supporting the knight on e5 with the pawn move f4. This enhances the stability of the knight on e5, making it a central bulwark.
 * 5) Central Pawn Wedge: If Black decides to challenge the knight on e5 prematurely and captures, White can recapture with the d-pawn. This results in a powerful central pawn wedge with pawns on e5 and e4, giving White more space and control in the center.
 * 6) Proactive Play Against the Black King: By maintaining tension and giving Black the option to open files, especially the h-file, White employs a strategy where Black might inadvertently expose their king. Creating potential vulnerabilities around the opponent's monarch can lead to tactical opportunities.


text:
Chess Opening Theory/1. d4/1...Nf6/2. c4/2...e6/3. Nf3/3...b6/4. Bf4

Queen's Indian Defence - London System (Miles Variation)
In essence, in this variation, White seeks central control and space, with potential kingside attacking ideas, while Black adopts a hypermodern defense, allowing White's central occupation but preparing to challenge and undermine it later.

White's Strategy:

 * 1) Central Control: With 1. d4 and 2. c4, White immediately asserts control over the center. The aim is to gain space and restrict Black's central pawn breaks.
 * 2) Piece Development: The knight on f3 and the bishop on f4 represent optimal development. The Nf3 knight supports the d4 pawn and prepares for e2-e3, while the Bf4 bishop is developed outside the pawn chain, exerting pressure on the c7 pawn.
 * 3) Flexibility: White's setup allows for various pawn structures and middle game plans, ranging from the traditional d4-c4 pawn duo, a potential d5 push, or even transitioning into other Queen's Pawn openings.
 * 4) Kingside Potential: With the bishop developed to f4 early, White can consider ideas like e2-e3 followed by Bd3, potentially supporting a later kingside pawn storm with moves like g2-g4, especially if Black has already castled kingside.

Black's Strategy:

 * 1) Hypermodern Approach: With ...Nf6, ...e6, and ...b6, Black takes a hypermodern approach, allowing White to occupy the center initially with the aim of counter-attacking and undermining White's center later.
 * 2) Flexible Pawn Structure: Black's setup, especially with ...b6, hints at the idea of fianchettoing the queen's bishop with ...Bb7. This places pressure on the e4 square and supports potential central pawn breaks like ...d5 or ...c5.
 * 3) Central Counterplay: Despite allowing White to occupy the center, Black aims for counterplay with moves like ...d5 or ...c5. The knight on f6 and the potential bishop on b7 work in tandem to challenge White's center.
 * 4) King Safety: Black often aims for a short castle, ensuring the king's safety while also connecting the rooks. Depending on the course of the game, Black might even consider a queenside castle if the situation allows.
 * 5) Active Piece Play: Black will look to develop the remaining minor pieces (e.g., ...Bb4+ or ...Bd6, and ...Nc6 or ...Nd7) to maximize their activity and coordinate potential counter-attacks.

Theory table
'''1. d4 Nf6 2. c4 e6 3. Nf3 b6 4. Bf4'''


text:
User:Dom walden/Bivariate Generating Functions

Introduction
Combinatorial class = C

Combinatorial parameter = \chi or \zeta

P(X = k) = #(y \in C | X(y) = k) / #C

So X, \chi, \zeta is both a variable and function...

Or, P(E) = \mu(E) = \sum_{e \in E} p(e)

f(x) (pdf)

F(x) = P(X \leq x) = \int_{-\infty}^x f(u)du (cdf)

For continuous variable:

Fourier/characteristic: \lambda_X(s) = \int_{\R} e^{sx} f(x) dx

Laplace: \phi_X(t) = \int_{\R} e^{itx} f(x) dx

(I don't necessarily believe the above...)

X* = \zeta - E(\zeta) / \sqrt{V(\zeta)}

If Y = X - \mu / \sigma then

\phi_Y(t) = e^{-\mu it} \phi_X(t/\sigma)

\lambda_Y(s) = e^{-\mu s} \lambda_X(s/\sigma)

Characteristic function of standard normal:

1/\sqrt{2\pi} \int_R e^{itz} e^{-z^2/2} dz

Discrete limit law
This applies when the mean and standard deviation of the random variable remain finite.

Theorem
If $$\Omega$$ is a subset of the unit disc with at least one point of accumulation in the interior of the disc. If $$p_n(u) = \sum_{k \geq 0} p_{n,k} u^k$$, $$q(u) = \sum_{k \geq 0} q_k u^k$$ and pointwise for each $$u \in \Omega$$

 * $$\lim_{n \to +\infty} p_n(u) = q(u)$$

then

 * $$\lim_{n \to +\infty} p_{n,k} = q_k$$ and $$\lim_{n \to +\infty} \sum_{j \leq k} p_{n,j} = \sum_{j \leq k} q_j$$

Proof
Applying Vitali's theorem, we take the sequence to be $$\{p_n(u)\}$$ and $$S$$ to be the unit disc. All $$p_n(u)$$ are analytic and bounded on $$S$$ (due to $$p_n(1) = 1$$). The theorem assumes that $$\{p_n(u)\}$$ converges to $$q(u)$$ in $$\Omega \sub S$$ which has an accumulation point in $$S$$.

Vitali's theorem states $$\{p_n(u)\}$$ uniformly converges to $$q(u)$$ on any compact subset of $$S$$, which we will take as the disc $$|u| \leq 1/2$$ and use Cauchy's coefficient formula:

 * $$q_k = \frac{1}{2i\pi} \int_{|u| = 1/2} q(u) \frac{du}{u^{k+1}} = \lim_{n \to \infty} \frac{1}{2i\pi} \int_{|u| = 1/2} p_n(u) \frac{du}{u^{k+1}} = \lim_{n \to \infty} p_{n,k}$$

Vitali's theorem
Theorem

Let $$\{f_n(z)\}$$ be a sequence of functions, all analytic on an open connected set $$S$$ and $$|f_n(z)| \leq M$$ for all $$n$$ and $$z$$ in $$S$$.

If the sequence $$\{f_n(z)\}$$ converges on a subset of $$S$$ with a point of accumulation in $$S$$, then $$\{f_n(z)\}$$ converges uniformly on every compact subset of $$S$$.

Proof

Let

 * $$f_n(z) = a_{0,n} + a_{1,n}z + \cdots$$

We want to prove that each $$a_{v,n}$$ converges to a limit.

We start with a disc centred at the origin of radius $$R$$ and point of accumulation as the origin. Then

 * $$|f_n(z) - f_n(0)| \leq |f_n(z)| + |f_n(0)| \leq 2M$$

Let $$z_0 \neq 0$$ be a point where the sequence converges. Then

 * $$|f_n(0) - f_{n+m}(0)| \leq |f_n(0) - f_n(z_0)| + |f_n(z_0) - f_{n+m}(z_0)| + |f_{n+m}(z_0) - f_{n+m}(0)| \leq \frac{4M|z_0|}{R} + |f_n(z_0) - f_{n+m}(z_0)|$$

because, by Schwarz's lemma, $$|f_n(0) - f_n(z_0)| \leq 2M|z_0|/R$$ and $$|f_{n+m}(z_0) - f_{n+m}(0)| \leq 2M|z_0|/R$$.

We choose $$z_0$$ such that the first term is arbitrarily small and $$n$$ large enough that the second term is arbitrarily small. Therefore, $$f_n(0) = a_{0,n}$$ converges to a limit.

Next, we define

 * $$g_n(z) = \frac{f_n(z) - a_{0,n}}{z} = a_{1,n} + a_{2,n}z + \cdots \leq \frac{2M}{R}$$

For $$|z| < R$$. $$g_n(z)$$ converges to a limit at $$z_0$$ as both $$f_n(z)$$ and $$a_{0,n}$$ converge to a limit. We repeat the argument above, which proved that $$f_n(0) = a_{0,n}$$ converges to a limit, to prove that $$g_n(0) = a_{1,n}$$ also converges to a limit. We keep repeating this to prove that $$a_{v,n}$$ converges for all $$v$$.

Since each term of $$f_n(z)$$ converges to a limit, $$f_n(z)$$ also converges to a limit for $$z < R$$. If we repeat the argument with another disc centred at any limit point (e.g. $$z_0$$), we can extend to any region bounded by $$S$$.

Schwarz's lemma
Lemma

If $$f(z)$$ is analytic and regular(?) for $$|z| \leq R$$, $$|f(z)| \leq M$$ for $$|z| = R$$ and $$f(0) = 0$$, then

 * $$f(re^{i\theta} \leq \frac{Mr}{R} \quad (0 \leq r \leq R)$$

Proof

$$f(z)/z$$ is regular for $$|z| \leq R$$ and $$|f(z)/z| \leq M/R$$ on the circle $$|z| = R$$. By the maximum modulus theorem(?) this inequality holds also inside the circle. Because $$|f(z)/z| = |f(z)|/r$$ we multiply both sides of the inequality by $$r$$ which gives us our lemma.

Example
The number $$k$$ of singleton cycles in a permutation of length $$n$$ is given by $$P(z, u) = \frac{e^{z (u - 1)}}{1 - z}$$.

For each $$u$$ we have a singularity at $$z = 1$$ of order 1. If we treat $$u$$ as a constant and apply our estimate for meromorphic functions

 * $$p_n(u) = [z^n]P(z, u) \sim \frac{(-1) e^{(u - 1)}}{-1} = e^{u-1}$$ as $$n \to \infty$$.

Therefore,

 * $$p_{n,k} \sim [u^k]e^{u-1} = \frac{1}{k! e}$$ as $$n \to \infty$$.

Continuous limit law
This applies when the mean and standard deviation of the random variable tend to infinity.

There are three cases/theorems:
 * Meromorphic
 * Singularity
 * Saddle

Meromorphic schema
Theorem

Let $$F(z, u)$$ be bivariate analytic at $$(z, u) = (0, 0)$$ with non-negative coefficients. Let $$F(z, 1)$$ be meromorphic in $$z \leq r$$ with only a simple pole $$\rho$$ for positive $$\rho < r$$. Assume:

 * 1) Meromorphic perturbation: there exists $$\epsilon > 0$$ and $$r > \rho$$ such that in the domain $$D = \{|z| \leq r\} \times \{|u - 1| < \epsilon\}$$:
 * $$F(z, u) = \frac{B(z, u)}{C(z, u)}$$
 * where $$B(z, u)$$ and $$C(z, u)$$ are analytic in $$D$$ and $$B(\rho, 1) \neq 0$$ and $$\rho$$ is a simple zero of $$C(z, 1)$$.
 * 1) Non-degeneracy: $$\partial_z C(\rho, 1) \partial_u C(\rho, 1) \neq 0$$.
 * 2) Variability: $$v\left(\frac{\rho(1)}{\rho(u)}\right) \neq 0$$.

Then, the standardised random variable $$X_n$$ converges to the Gaussian variable, with speed of convergence $$O(n^{-1/2})$$ and mean and standard deviation asymptotically linear in $$n$$.

Proof

Construct annular region composed of two concentric circles $$C_s$$ and $$C_r$$ of radius $$s$$ ($$\rho < s < r$$) and $$r$$, respectively. By the global Cauchy formula and residue theorem, for $$z$$ in the annular region and $$u$$ in a small enough domain around 1,

 * $$f_n(u) = \frac{1}{2\pi i} \int_{C_s} \frac{B(z, u)}{C(z, u)} \frac{dz}{z^{n+1}} + \frac{1}{2\pi i} \int_{C_r} F(z, u) \frac{dz}{z^{n+1}} = Res\left(\frac{B(z, u)}{C(z, u) z^{n+1}}; z = \rho(u) \right) + \frac{1}{2\pi i} \int_{C_r} F(z, u) \frac{dz}{z^{n+1}}$$

By Cauchy's inequality,

 * $$\int_{C_r} F(z, u) \frac{dz}{z^{n+1}} \leq \frac{\max_{|z| = r,|u-1|\leq\epsilon} |F(z, u)|}{r^n} = \frac{\sup_{|z| = r,|u-1|\leq\epsilon} |B(z, u)|}{\inf_{|z| = r,|u-1|\leq\epsilon} |C(z, u)| r^n} = \frac{K}{r^n} = O(r^{-n})$$

where $$K$$ is a finite constant, due to the fact that $$C(z, u)$$ is non-zero on $$|z| = r$$ and $$B(z, u)$$ is analytic and therefore bounded...

 * $$Res\left(\frac{B(z, u)}{C(z, u) z^{n+1}}; z = \rho(u) \right) = \frac{B(\rho(u), u)}{C_z^'(\rho(u), u) \rho(u)^{n+1}}$$

Therefore,

 * $$f_n(u) = \frac{B(\rho(u), u)}{C_z^'(\rho(u), u) \rho(u)^{n+1}} + O(r^{-n})$$

meaning it meets the conditions of the Quasi-powers theorem.

Saddle-point
Theorem

Assume

 * $$p_n(u) = e^{h_n(u)} (1 + o(1))$$

uniformly for $$u$$ in a fixed neighbourhood $$\Omega$$ of $$1$$ and each $$h_n(u)$$ analytic in $$\Omega$$. Assume also

 * $$h_n'(1) + h_n''(1) \to \infty$$

and

 * $$\frac{h_n'(u)}{(h_n'(1) + h_n(1))^{3/2}} \to 0$$

uniformly for $$u \in \Omega$$. Then

 * $$X_n^* = \frac{X_n - h_n'(1)}{(h_n'(1) + h_n''(1))^{1/2}}$$

converges in distribution to a Gaussian with mean 0 and variance 1.

Proof

Quasi-powers theorem
Theorem

Let the $$X_n$$ be non-negative discrete random variables and $$p_n(u)$$ be probability generating functions. Assume uniformly in a fixed complex neighbourhood of $$u = 1$$ for $$\beta_n, \kappa_n \to +\infty$$

 * $$p_n(u) = A(u) . B(u)^{\beta_n} \left( 1 + O\left(\frac{1}{\kappa_n}\right) \right)$$

where $$A(u), B(u)$$ are analytic at $$u = 1$$ and $$A(u) = B(u) = 1$$. Assume $$B(u)$$ satisfies the "variability condition"

 * $$v(B(u)) \equiv B''(1) + B'(1) - B'(1)^2 \neq 0$$

Then the mean and variance of $$X_n$$ satisfy

 * $$\mu_n \equiv E(X_n) = \beta_n m(B(u)) + m(A(u)) + O(\kappa_n^{-1})$$
 * $$\sigma_n^2 \equiv V(X_n) = \beta_n v(B(u)) + v(A(u)) + O(\kappa_n^{-1})$$

and

 * $$P\left( \frac{X_n - E(X_n)}{\sqrt{V(X_n)}} \leq x \right) = \Phi(x) + O\left( \frac{1}{\kappa_n} + \frac{1}{\sqrt{\beta_n}} \right)$$

where

 * $$\Phi(x) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^x e^{-w^2/2} dw$$.

Proof

Convert to a Laplace transform

 * $$\lambda_n(s) = e^{\beta_n \log B(s) + \log A(s)} (1 + O(\kappa_n^{-1}))$$

therefore

 * $$\log \lambda_n(s) = \beta_n \log B(s) + \log A(s) + O(\kappa_n^{-1})$$

 * $$\frac{d}{ds} \log \lambda_n(s) = \beta_n \frac{d}{ds} \log B(s) + \frac{d}{ds} \log A(s) + O(\kappa_n^{-1}) = \beta_n m(B(s)) + m(A(s)) + O(\kappa_n^{-1})$$

 * $$\frac{d^2}{ds^2} \log \lambda_n(s) = \beta_n \frac{d^2}{ds^2} \log B(s) + \frac{d^2}{ds^2} \log A(s) + O(\kappa_n^{-1}) = \beta_n v(B(s)) + v(A(s)) + O(\kappa_n^{-1})$$

Continuity of integral transforms
Theorem from Flajolet and Sedgewick.

Fourier

Also known as Lévy's continuity theorem.

If $$p_n(u)$$ and $$q(u)$$ have Fourier transforms $$\phi_n(t)$$ and $$\phi(t)$$, respectively, and $$q(u)$$ has a continuous distribution function, then

 * $$\lim_{n \to +\infty} p_n(u) = q(u)$$

if and only if, pointwise for each real $$t$$

 * $$\lim_{n \to +\infty} \phi_n(t) = \phi(t)$$

Laplace

Assume $$p_n(u)$$ and $$q(u)$$ have Laplace transforms $$\lambda_n(s)$$ and $$\lambda(s)$$, respectively, defined on $$s \in [-s_0, s_0]$$. If pointwise for each real $$s \in [-s_0, s_0]$$

 * $$\lim_{n \to +\infty} \lambda_n(u) = \lambda(u)$$

then

 * $$\lim_{n \to +\infty} p_n(u) = q(u)$$

Pointwise convergence
A sequence of functions $$\{f_n(z)\}$$ is said to converge pointwise to $$f(z)$$ on a set $$S$$ if for each point $$z \in S$$ and $$\epsilon > 0$$ there exists a number $$N$$ such that

 * $$|f_n(z) - f(z)| < \epsilon$$ for $$n > N$$

Compared to uniform convergence, $$N$$ is dependent on both $$z$$ and $$\epsilon$$. In other words, as the $$z$$ changes the $$N$$ may have to change as well.

Uniform convergence
A sequence of functions $$\{f_n(z)\}$$ is said to converge uniformly to $$f(z)$$ on a set $$S$$ if for any $$\epsilon > 0$$ there exists a number $$N$$ such that

 * $$|f_n(z) - f(z)| < \epsilon$$ for $$n > N$$ and for all $$z \in S$$

Compared to pointwise convergence, $$N$$ depends only on $$\epsilon$$. In other words, the same $$N$$ holds for all $$z$$.


text:
User:Mikedavid.1525

= Exploring the Power of Python Online Editors: A Seamless Coding Experience = Python is renowned for its simplicity and versatility, making it an excellent choice for both beginners and experienced developers. To harness the power of Python, you don't need to invest in complex software installations. Thanks to Python online editors like pythononlineditor.com, you can dive into Python coding with ease and convenience. In this article, we'll explore the world of Python online editors and provide a basic code example to get you started.

1. Getting Started with Python Online Editors
Python online editors are web-based platforms that allow you to write, test, and execute Python code instantly. They eliminate the need for local installations, making it possible to code from virtually any device with an internet connection.

2. A Simple Python Online Editor Example
Let's begin with a straightforward Python example using pythononlineditor.com. We'll write a program that calculates the sum of two numbers.

num = 5 # You can change this number to any positive integer factorial = 1 if num < 0: print("Sorry, factorial does not exist for negative numbers.") elif num == 0: print("The factorial of 0 is 1.") else: for i in range(1, num + 1): factorial *= i    print("The factorial of", num, "is", factorial) Certainly! This Python code calculates the factorial of a specified number. Let's break down how it works step by step:
 * 1) Python code to calculate the factorial of a number without user input
 * 1) Define the number for which to calculate the factorial
 * 1) Initialize the factorial to 1
 * 1) Calculate the factorial

1. Specify the Number to Calculate the Factorial For: num = 5 # You can change this number to any positive integer In this line, we initialize the variable  and set it to 5. You can change the value of  to any positive integer for which you want to calculate the factorial.

2. Initialize the Factorial Variable: factorial = 1 Here, we create a variable called  and set it to 1. This variable will store the result of the factorial calculation.

3. Check for Special Cases: if num < 0: print("Sorry, factorial does not exist for negative numbers.") elif num == 0: print("The factorial of 0 is 1.") These  and   statements handle two special cases:

 * If the value of  is negative, it prints a message saying that factorials are not defined for negative numbers.
 * If  is 0, it prints a message stating that the factorial of 0 is 1. This is a mathematical convention.

4. Calculate the Factorial: else: for i in range(1, num + 1): factorial *= i    print("The factorial of", num, "is", factorial) If  is a positive integer (greater than 0), this part of the code calculates its factorial. It uses a  loop that iterates from 1 to   (inclusive). During each iteration, it multiplies the current value of  by the current value of. This effectively calculates the product of all positive integers from 1 to, which is the factorial of. Finally, it prints the result, stating "The factorial of [num] is [factorial]."

So, when you run this code with a specific value of, it will calculate and display the factorial of that number. For example, with, it will calculate  , which is 5 factorial (5 × 4 × 3 × 2 × 1), and print "The factorial of 5 is 120."

3.Running the Code
Now, let's run this Python code using pythononlineditor.com:

 * 1) Visit pythononlineeditor.com in your web browser.
 * 2) Paste the code into the editor.
 * 3) Click the "Run" button.

You'll see the editor executing your code, and it will prompt you to enter the first and second numbers. After providing the inputs, you'll receive the sum as the output.

This simple example demonstrates how Python online editors provide an interactive coding experience with real-time execution. You can experiment, modify, and test your code with immediate feedback.

Conclusion
Python online editors are a fantastic way to start your Python journey or streamline your development process. They offer convenience, real-time execution, and accessibility. Whether you're a beginner or an experienced developer, give pythononlineditor.com a try to experience the convenience of coding in Python without the need for installations. Happy coding!

title: User:Mikedavid.1525


text:
Algebra/Chapter 1/Fractions

1.7: Applications of Fractions and Decimals

title: Algebra/Chapter 1/Fractions


text:
Algebra/Chapter 1/Decs&Fracs

1.3: Operations with Decimals and Fractions

title: Algebra/Chapter 1/Decs&Fracs