everyone, I am new to these subjects and I would like to clarify a subject that is little covered in my textbook.

It tells me that fixed an n, a number of sub-intervals to use to calculate the integral using the composite trapezoidal or Simpson rule, we can calculate the error for $$E_n$$ and $$E_{2n}$$ that is relative to the same integral considering the n sub-intervals and 2n sub-intervals. In this way we can obtain a more accurate estimate of the error, it says. Could someone explain me better what is meant? And especially if I do $$E_n/E_{2n}$$, what information do I get?

• Please do look up "Richardson extrapolation" and report back if this answers your question. The advanced topic is then "Romberg integration". Commented Apr 10, 2020 at 6:49

If you apply the trapezoidal rule with $$N=n, 2n, 4n$$ segments, then you get a value

$$I_N = I_* + c_2 N^{-2} + c_4 N^{-4} + ...$$ The estimation of the terms of this expansion from two or more numerical evaluations for different $$N$$ is called Richardson extrapolation or Romberg integration (successively eliminating the terms for $$n^{-2k}$$).

Now if you compute the error from two integrations for $$N=n,2n$$ by eliminating the exact value $$I_*$$, you get $$I_n-I_{2n}=c_2n^{-2}(1-2^{-2})+c_4n^{-4}(1-2^{-4})+$$ so that you get the error estimate $$E_n=\frac43(I_n-I_{2n}) = c_2n^{-2} + \frac54 c_4n^{-4}+...$$

If you now compute $$\frac{E_n}{E_{2n}} =\frac{c_2 + \frac54 c_4n^{-2}+...}{c_22^{-2} + \frac54 c_42^{-4}n^{-2}+...} =4+\frac{\frac{15}{4}c_4n^{-2}+...}{c_2+\frac5{16}c_4n^{-2}+...}$$ you can see from the numerical value of this fraction that if it is far away from $$4$$ that with some high probability there is some error in the implementation.

If you compute a series of these fractions, you should find some middle region of values for $$n$$ where the quotient is close to $$4$$. For large values of $$n$$ one has to add the floating point noise of size $$\mu\cdot n$$ to the error, it will dominate the error for $$n>1/\sqrt[3]\mu\sim 10^5$$, where $$\mu=2^{-52}\sim 10^{-16}$$ is the machine constant of the floating point data type. Thus for large $$n$$ the error will increase again in a vaguely linear way and the quotient will fluctuate randomly.

If such a middle region does not exist, then the coefficient $$c_4$$ or a higher one is very large against $$c_2$$, the function is then either rapidly growing or highly oscillatory and you will need more adapted methods.

See also similar observations in a BDF ODE solver, a fourth order Taylor ODE solver, classical RK4, and one-sided and symmetric and further improved difference quotients.

• I didn't understand one thing. In general, should the fraction be a value close to 4? If so, should I get a value around 15 for Simpson's method? And if I get (from Simpson) 1 because the estimates used in the ratio are the same number?
– user432382
Commented Apr 10, 2020 at 9:05
• Simpson is Richardson extrapolation from trapezoidal, eliminating the $c_2n^{-2}$ term. As the leading error term is then $\tilde c_4n^{-4}$, the quotient should be $2^4=16$. However, the influence of the floating point noise starts here already at $n\sim 1/\sqrt[5]\mu\simeq 10^3$ (approximately, deviations by a factor of $10$ are possible). Commented Apr 10, 2020 at 9:09
• Yeah, I meant 16. A typo... So I shouldn't worry if for very high n values, the error ratio with Simpson's method gives me values close to 1?
– user432382
Commented Apr 10, 2020 at 9:16
• Yes. If you want to extend the experiment to those higher $n$ values, you need a correspondingly smaller $\mu$, that is, you need to perform all computations including the function evaluation using a multi-precision data type. Commented Apr 10, 2020 at 9:23
• You get the order estimate directly. Nice but nothing really new. Commented Apr 10, 2020 at 16:42