Compute $$\int_0^1\frac{1}{1+x^2} \ dx$$ using Romberg integration and the trapezoidal formula with stepsize $h=0.125$.

I don't really understand because I can either use the trapezoidal formula with the given stepsize or I can start computing $R_{1,1}, \ R_{1,2}...,$ but how do I know when to stop?

Using only the trapezoidal formula I get that

$$T(0.125)=\frac{0.125}{2}\left(f(x_0)+f(x_8)+2\sum_{k=1}^7f(x_k)\right)\approx 0.7847471238.$$

But if I was to go for Romberg integration immediately I'd get

$$ \begin{align} R_{11} &=\frac{h_1}{2}(f(a)+f(b))=\frac{b-a}{2}(f(a)+f(b))=\frac{1}{2}\left(1+\frac{1}{2}\right)=\frac{3}{4}=0.75.\\ R_{21}&=\frac{h_2}{2}\left(f(a)+f(b)+2f\left(\frac{a+b}{2}\right)\right)=0.775.\\ R_{j1}&=\text{and so on...}\\ \end{align} $$

Now, clearly moving on with the $R$'s will take me closer and closer to the value of $T(0.125)$ and thus closer to the exact value of $\pi/4$. The question is, how do I know when to stop?

  • $\begingroup$ Here's good rule: If your floating point type has unit roundoff $\mu$, stop when the difference between two estimates is ~$10\mu$. $\endgroup$ – user14717 May 3 '18 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.