Computing an integral numerically to n correct significant digits

283 Views Asked by At

I have an assignment where I have to compute the following integral $$\int_1^{1.71}\frac {\cos \sqrt[4]{x}}{1+x\sqrt{x}}dx$$ to twelve correct significant digits.

What is the best method to achieve this when computation time is not a big issue? How do I know how many digits are correct?

3

There are 3 best solutions below

1
On BEST ANSWER

If you consider performances, you are correct with the problem of the square and fourth root.

Independently of the selected numerical method, I should let $x=t^4$ to make $$\int_1^{1.71}\frac {\cos \sqrt[4]{x}}{1+x\sqrt{x}}dx=4\int_1^{\sqrt[4]{1.71}}\frac{ t^3 }{t^6+1}\cos (t)\,dt$$ Now, you face a smaller integration range and the second integrand is much closer to linearity than the first one.

You could even use series expansion around $t=1$ to $O\left((t-1)^{n+1}\right)$ and it would converge quite fast $$\left( \begin{array}{cc} n & \text{result} \\ 0 & 0.13776738977500630815 \\ 1 & 0.13244166602060158949 \\ 2 & 0.13379101200456405488 \\ 3 & 0.13389678244323662667 \\ 4 & 0.13381286137858445987 \\ 5 & 0.13381750204286473434 \\ 6 & 0.13382176024778008614 \\ 7 & 0.13382093814245070512 \\ 8 & 0.13382078258061243158 \\ 9 & 0.13382085458575250985 \\ 10 & 0.13382085507917192293 \\ 11 & 0.13382085032932136977 \\ 12 & 0.13382085092985845912 \\ 13 & 0.13382085116591896269 \\ 14 & 0.13382085109375183538 \\ 15 & 0.13382085108748612023 \\ 16 & 0.13382085109326772813 \\ 17 & 0.13382085109291259286 \\ 18 & 0.13382085109256093758 \\ 19 & 0.13382085109263371344 \\ 20 & 0.13382085109264832238 \\ \cdots & \cdots \\ \infty &0.13382085109264158173 \end{array} \right)$$

2
On

Get a bound on the derivative on the domain. This in turn gives you a relationship with the Lipschitz constant L. This tells you how much point estimates can vary. So if you sample points in an interval I of size t, the error in calculating f(x) in I is at most Lt. Comment if more elaboration needed.

Note, this only works here as we can understand the derivative of your integrand.

0
On

The "best" simple method is Romberg integration. Let $M(n)$ denote the midpoint integration with $2^n$ intervals, $T(n)$ the trapezoidal integration and $S(n)$ the Simpson method. Then one can quickly check that $T(n)+M(n)=2T(n+1)$ and by Richardson extrapolation $$ S(n) = \frac{4T(n+1)-T(n)}3=\frac{T(n)+2M(n)}3 $$ The Simpson method has error order 4, so that the next step in the Romberg integration produces the numbers $\frac{16S(n+1)-S(n)}{15}$ with error order 6 and so on. $$\small \begin{array}{l|lllll} n& p=2&p=4&p=6&p=8&p=10\\\hline 0 & 0.1413610117349 \\ 1 & 0.1357347551451& 0.1338593362819 \\ 2 & 0.1343011488019& 0.1338232800209& 0.1338208762701 \\ 3 & 0.1339410393737& 0.1338210028976& 0.1338208510894& 0.1338208506897 \\ 4 & 0.1338509052773& 0.1338208605785& 0.1338208510906& 0.1338208510906& 0.1338208510922 \\ 5 & 0.1338283650834& 0.1338208516855& 0.1338208510926& 0.1338208510926& 0.1338208510926 \\ 6 & 0.1338227296181& 0.1338208511297& 0.1338208510926& 0.1338208510926& 0.1338208510926 \\ 7 & 0.1338213207258& 0.1338208510950& 0.1338208510926& 0.1338208510926& 0.1338208510926 \\ \end{array} $$

One can take the the next value down in the table as reference to compute an error estimate.