## Open discussion forum (free for all)

### Convergence criterion for Romberg integration

by Georg Hager -
Number of replies: 1

There was a question about the convergence criterion in Romberg integration: Why do we check |R_n,n-R_n-1,n-1|<eps as well as |R_n-1,n-1-r_n-2,n-2|<eps instead of only the former?

The reason for this is that sometimes it may happen that the integrand has a special symmetry or periodicity, which leads to the effect that refining the grid (i.e., going from h to h/2) does not change the approximation. If we only checked for the last step, this would lead to a zero difference and the algorithm would terminate, while in fact the next step would yield a better approximation.

A somewhat contrived example is the function f(x)=sin(x)/x. It has zeros at k*pi, and if the nodes for Romberg integration are chosen at 2*k*pi and at k*pi then the approximation will be zero, but one more refinement to k*pi/2 will yield a nonzero contribution. If this is too simple, imagine something along the lines of f(x)=sin(x)/x+exp(x). The sin(x)/x part will only show up if nodes are chosen that are not k*pi.

Of course, checking the two deviations is not fail-safe (as my very example shows), but it's better than checking just one.