Romberg Integration

Romberg integration estimates a definite integral by computing trapezoidal rule estimates with 1, 2, 4, 8, … subintervals and improving them with Richardson extrapolation. Each new column of the Romberg table, R(k,j) = R(k,j-1) + \dfrac{R(k,j-1) - R(k-1,j-1)}{4^j - 1}, cancels another error term, so the estimates converge very quickly.

Before this lesson: Richardson Extrapolation, Trapezoidal Rule and Simpson’s Rule

The idea: extrapolate the trapezoidal rule

The trapezoidal rule T(h) with step h has an error of about Ch² for a smooth integrand. Better still, the error is a series in even powers only: C₁h² + C₂h⁴ + C₃h⁶ + ⋯. That pattern is exactly what Richardson extrapolation needs.

So we halve h again and again, which is cheap because each new trapezoidal estimate reuses all the old function values. One Richardson step removes the h² term, the next removes h⁴, and so on. The results fill a triangular table, read from left to right.

Romberg table with four rows for step sizes h = 1, 1/2, 1/4 and 1/8. Column 0 holds trapezoidal estimates 0.683940, 0.731370, 0.742984 and 0.745866 (error order h^2). Column 1 holds Simpson's rule values 0.747180, 0.746855 and 0.746827 (h^4). Column 2 holds Boole's rule values 0.746833 and 0.746825 (h^6). Column 3 holds 0.746825 (h^8). Arrows show that each entry is computed from the entry to its left and the entry diagonally above that one.
The Romberg table for the integral of e^(−x²) from 0 to 1 (Example 5): each column cancels one more error term.

Romberg integration formula

For \int_a^b f(x)\,dx, let hₖ = (b − a)/2ᵏ, so row k uses 2ᵏ subintervals. The first column holds trapezoidal estimates. Start with one interval:

R(0,0) = \dfrac{b - a}{2}\big(f(a) + f(b)\big)

Each later trapezoidal estimate reuses the one above it and adds only the new midpoints:

R(k,0) = \dfrac{1}{2}R(k-1,0) + h_k \sum_{i=1}^{2^{k-1}} f\big(a + (2i-1)h_k\big)

Every other entry comes from Richardson extrapolation with weight 4ʲ, because column j − 1 has error order h²ʲ:

R(k,j) = R(k,j-1) + \dfrac{R(k,j-1) - R(k-1,j-1)}{4^j - 1}, \qquad 1 \le j \le k
ColumnSame asError orderExact for polynomials of degree
j = 0Trapezoidal ruleh^2\le 1
j = 1Simpson’s ruleh^4\le 3
j = 2Boole’s ruleh^6\le 5
jLevel jh^{2j+2}\le 2j + 1

How to do Romberg integration

  1. Compute R(0,0) with one trapezoid.
  2. For k = 1, 2, …, find R(k,0) with the recursive formula (only the new midpoints are evaluated).
  3. Fill row k from left to right with R(k,j) = R(k,j − 1) + [R(k,j − 1) − R(k − 1,j − 1)]/(4ʲ − 1).
  4. Stop when two diagonal entries R(k − 1,k − 1) and R(k,k) agree to the accuracy you need.

Romberg integration examples

Example 1: A table that becomes exact

Use Romberg integration with three rows on \int_0^1 x^4\,dx = 0.2.

R(0,0) = \dfrac{1 - 0}{2}(0 + 1) = 0.5

One trapezoid: f(0) = 0 and f(1) = 1.

R(1,0) = \dfrac{0.5}{2} + 0.5(0.5)^4 = 0.25 + 0.03125 = 0.28125

h₁ = 0.5; the one new point is x = 0.5.

R(2,0) = \dfrac{0.28125}{2} + 0.25\big(0.25^4 + 0.75^4\big)

h₂ = 0.25; new points 0.25 and 0.75.

R(2,0) = 0.140625 + 0.25(0.00390625 + 0.31640625) = 0.220703125

Evaluate the powers, add, then multiply by 0.25.

R(1,1) = 0.28125 + \dfrac{0.28125 - 0.5}{3} = \dfrac{5}{24} \approx 0.208333

j = 1: divide by 4 − 1 = 3.

R(2,1) = 0.220703125 + \dfrac{0.220703125 - 0.28125}{3} = \dfrac{77}{384} \approx 0.200521

j = 1 in row 2.

R(2,2) = \dfrac{77}{384} + \dfrac{77/384 - 5/24}{15} = \dfrac{77}{384} - \dfrac{1}{1920}

j = 2: divide by 16 − 1 = 15; 77/384 − 80/384 = −1/128 (see adding and subtracting fractions).

R(2,2) = \dfrac{385}{1920} - \dfrac{1}{1920} = \dfrac{384}{1920} = 0.2

Use the common denominator 1920.

Answer: R(2,2) = 0.2 exactly. Column 2 is Boole’s rule, which is exact for polynomials up to degree 5, while the best trapezoidal estimate, 0.2207, is still off by about 10%.

Example 2: Estimating ln 2

Use three rows of Romberg integration on \int_1^2 \dfrac{1}{x}\,dx = \ln 2 \approx 0.693147. Round to 6 decimal places.

R(0,0) = \dfrac{1}{2}\left(1 + \dfrac{1}{2}\right) = 0.75

One trapezoid on [1, 2].

R(1,0) = \dfrac{0.75}{2} + 0.5\cdot\dfrac{1}{1.5} = 0.375 + 0.333333 = 0.708333

New point x = 1.5.

R(2,0) = \dfrac{0.708333}{2} + 0.25\left(\dfrac{1}{1.25} + \dfrac{1}{1.75}\right)

New points 1.25 and 1.75.

R(2,0) = 0.354167 + 0.25(0.8 + 0.571429) = 0.354167 + 0.342857 = 0.697024

Evaluate and add.

R(1,1) = 0.708333 + \dfrac{0.708333 - 0.75}{3} = 0.708333 - 0.013889 = 0.694444

First extrapolation in row 1.

R(2,1) = 0.697024 + \dfrac{0.697024 - 0.708333}{3} = 0.697024 - 0.003770 = 0.693254

First extrapolation in row 2.

R(2,2) = 0.693254 + \dfrac{0.693254 - 0.694444}{15} = 0.693254 - 0.000079 = 0.693175

Second extrapolation.

Answer: R(2,2) ≈ 0.693175, off from ln 2 by about 0.000028. The trapezoidal estimate with the same 5 function values, R(2,0), is off by about 0.0039, so the table gained more than 100 times the accuracy at no extra cost.

Example 3: The integral of sin x

Use three rows on \int_0^{\pi} \sin x\,dx = 2.

R(0,0) = \dfrac{\pi}{2}(\sin 0 + \sin \pi) = 0

Both endpoint values are 0.

R(1,0) = \dfrac{0}{2} + \dfrac{\pi}{2}\sin\dfrac{\pi}{2} = \dfrac{\pi}{2} \approx 1.570796

New point π/2, where sin = 1.

R(2,0) = \dfrac{1.570796}{2} + \dfrac{\pi}{4}\left(\sin\dfrac{\pi}{4} + \sin\dfrac{3\pi}{4}\right)

New points π/4 and 3π/4.

R(2,0) = 0.785398 + 0.785398(1.414214) = 0.785398 + 1.110721 = 1.896119

Each sine is √2/2, so their sum is √2 (see unit circle).

R(1,1) = 1.570796 + \dfrac{1.570796 - 0}{3} = 1.570796 + 0.523599 = 2.094395

First extrapolation in row 1.

R(2,1) = 1.896119 + \dfrac{1.896119 - 1.570796}{3} = 1.896119 + 0.108441 = 2.004560

First extrapolation in row 2.

R(2,2) = 2.004560 + \dfrac{2.004560 - 2.094395}{15} = 2.004560 - 0.005989 = 1.998571

Second extrapolation.

Answer: R(2,2) ≈ 1.998571, with error about 0.0014, while R(2,0) is off by about 0.10. A fourth row (4 more sine values) gives R(3,3) ≈ 2.000006.

Example 4: Distance from velocity readings (word problem)

A car’s speedometer is read every second: 0, 7.1, 13.0, 17.9 and 21.8 m/s at t = 0, 1, 2, 3 and 4 s. Distance is the integral of velocity. Use Romberg integration to estimate the distance traveled in 4 seconds.

R(0,0) = \dfrac{4}{2}(0 + 21.8) = 43.6

One trapezoid with h = 4.

R(1,0) = \dfrac{43.6}{2} + 2(13.0) = 21.8 + 26 = 47.8

h = 2; new reading at t = 2.

R(2,0) = \dfrac{47.8}{2} + 1(7.1 + 17.9) = 23.9 + 25 = 48.9

h = 1; new readings at t = 1 and t = 3.

R(1,1) = 47.8 + \dfrac{47.8 - 43.6}{3} = 47.8 + 1.4 = 49.2

First extrapolation in row 1.

R(2,1) = 48.9 + \dfrac{48.9 - 47.8}{3} \approx 48.9 + 0.366667 = 49.266667

First extrapolation in row 2.

R(2,2) = 49.266667 + \dfrac{49.266667 - 49.2}{15} \approx 49.266667 + 0.004444 = 49.271111

Second extrapolation.

Answer: about 49.3 m. The last two columns agree to within 0.005 m, far below the 0.1 m/s precision of the readings. With measured data, the number of rows is fixed by the data, and the readings must be equally spaced with 2ᵏ intervals.

Example 5: When to stop

The first three rows of the table for \int_0^1 e^{-x^2}\,dx are R(0,0) = 0.683940; R(1,0) = 0.731370, R(1,1) = 0.747180; R(2,0) = 0.742984, R(2,1) = 0.746855, R(2,2) = 0.746833. Add a fourth row and stop when two diagonal entries differ by less than 10⁻⁵.

e^{-0.125^2} + e^{-0.375^2} + e^{-0.625^2} + e^{-0.875^2} \approx 0.984496 + 0.868815 + 0.676634 + 0.465043

The four new midpoints, with h₃ = 0.125.

= 2.994988

Add.

R(3,0) = \dfrac{0.742984}{2} + 0.125(2.994988) = 0.371492 + 0.374374 = 0.745866

Recursive trapezoidal rule.

R(3,1) = 0.745866 + \dfrac{0.745866 - 0.742984}{3} = 0.745866 + 0.000961 = 0.746827

j = 1.

R(3,2) = 0.746827 + \dfrac{0.746827 - 0.746855}{15} = 0.746827 - 0.000002 = 0.746825

j = 2.

R(3,3) = 0.746825 + \dfrac{0.746825 - 0.746833}{63} = 0.746825 - 0.0000001 \approx 0.746825

j = 3: divide by 64 − 1 = 63.

|R(3,3) - R(2,2)| = |0.746825 - 0.746833| = 0.000008

Compare the last two diagonal entries.

Answer: 0.000008 is less than 10⁻⁵, so stop with about 0.746825 (the true value is 0.746824). This integral has no elementary antiderivative, so a numerical method is the only way to find it.

Common mistakes

MistakeExample of the errorFix
Recomputing every point in each rowEvaluating f at x = 0.5 again in row 2Use R(k,0) = ½R(k − 1,0) + hₖ · (sum of the new midpoints only).
Using 4 in every column\dfrac{R(2,1) - R(1,1)}{3} for R(2,2)Column j divides by 4ʲ − 1: 3, then 15, then 63.
Subtracting the wrong entryUsing R(k − 1,j) instead of R(k − 1,j − 1)Both entries in the difference come from column j − 1.
Using data with a number of intervals that is not a power of 2Readings at t = 0, 1, …, 6Romberg halves h each row, so it needs 1, 2, 4, 8, … intervals.
Trusting the table for a non-smooth integrand\int_0^4 \sqrt{x}\,dx converges slowlyThe error series in h² needs a smooth f; split the interval or use another method.

Related methods

Simpson’s and Boole’s rules inside the table

Column 1 of the Romberg table is exactly the composite Simpson’s rule with the same points, and column 2 is Boole’s rule. Romberg integration is a way to build these higher-order rules automatically, and the gaps between neighboring entries give a built-in error estimate.

Other ways to integrate numerically

Romberg integration uses equally spaced points chosen in advance. Gaussian quadrature, the next lesson, instead chooses the points and weights for the highest accuracy, which suits functions that can be evaluated anywhere. For a quick rough estimate from a few points, Riemann sums or the trapezoidal rule may be enough.

Practice problems

  1. Use two rows of Romberg integration on \int_0^2 x^2\,dx. Is R(1,1) exact?
  2. Find R(1,1) for \int_0^2 x^3\,dx and compare it with Simpson’s rule using h = 1.
  3. A table starts with R(0,0) = 0.8, R(1,0) = 0.92 and R(2,0) = 0.952. Find R(1,1), R(2,1) and R(2,2).
  4. For \int_0^1 \dfrac{4}{1 + x^2}\,dx = \pi, R(0,0) = 3, R(1,0) = 3.1 and R(2,0) = 3.131176. Find R(1,1) and R(2,1).
  5. For \int_0^2 x^3\,dx, R(1,0) = 5. Use the recursive formula to find R(2,0).
  6. A river is 20 m wide. Its depth is 0, 1.8, 2.6, 2.0 and 0 m at 0, 5, 10, 15 and 20 m from one bank. Use Romberg integration to estimate the cross-sectional area.
  7. For \int_0^4 \sqrt{x}\,dx = \dfrac{16}{3}, R(0,0) = 4, R(1,0) = 4.828427 and R(2,0) = 5.146264. Find R(2,2) and explain why it is not very accurate.
  8. How many function values does it take to fill a Romberg table through R(4,4)?
  9. In Example 2, use |R(2,2) − R(1,1)| as an error estimate. Is it larger or smaller than the true error?
  10. Why is R(2,2) exact in Example 1?
Show answers

1.

R(0,0) = \dfrac{2}{2}(0 + 4) = 4

One trapezoid.

R(1,0) = \dfrac{4}{2} + 1(1^2) = 3

New point x = 1, h₁ = 1.

R(1,1) = 3 + \dfrac{3 - 4}{3} = \dfrac{8}{3}

Extrapolate.

Answer: R(1,1) = 8/3, which is exact, since the integral is 2³/3 = 8/3 (Simpson’s rule is exact for quadratics)

2.

R(0,0) = \dfrac{2}{2}(0 + 8) = 8,\quad R(1,0) = \dfrac{8}{2} + 1(1^3) = 5

Trapezoidal estimates.

R(1,1) = 5 + \dfrac{5 - 8}{3} = 4

Extrapolate.

\dfrac{1}{3}\big(0 + 4(1) + 8\big) = 4

Simpson’s rule with h = 1.

Answer: both give 4, the exact value; R(1,1) is Simpson’s rule

3.

R(1,1) = 0.92 + \dfrac{0.92 - 0.8}{3} = 0.92 + 0.04 = 0.96

Row 1.

R(2,1) = 0.952 + \dfrac{0.952 - 0.92}{3} = 0.952 + 0.010667 = 0.962667

Row 2, column 1.

R(2,2) = 0.962667 + \dfrac{0.962667 - 0.96}{15} = 0.962667 + 0.000178 = 0.962845

Row 2, column 2.

Answer: 0.96, 0.962667 and 0.962845

4.

R(1,1) = 3.1 + \dfrac{3.1 - 3}{3} = 3.133333

Row 1.

R(2,1) = 3.131176 + \dfrac{3.131176 - 3.1}{3} = 3.131176 + 0.010392 = 3.141568

Row 2.

Answer: 3.133333 and 3.141568 (π ≈ 3.141593)

5.

h_2 = \dfrac{2}{4} = 0.5

Row 2 uses 4 subintervals.

R(2,0) = \dfrac{5}{2} + 0.5\big(0.5^3 + 1.5^3\big) = 2.5 + 0.5(0.125 + 3.375)

New points 0.5 and 1.5.

= 2.5 + 1.75 = 4.25

Add.

Answer: R(2,0) = 4.25

6.

R(0,0) = \dfrac{20}{2}(0 + 0) = 0,\quad R(1,0) = 0 + 10(2.6) = 26

h = 20, then h = 10.

R(2,0) = \dfrac{26}{2} + 5(1.8 + 2.0) = 13 + 19 = 32

h = 5.

R(1,1) = 26 + \dfrac{26 - 0}{3} \approx 34.666667,\quad R(2,1) = 32 + \dfrac{32 - 26}{3} = 34

Column 1.

R(2,2) = 34 + \dfrac{34 - 34.666667}{15} \approx 34 - 0.044444 = 33.955556

Column 2.

Answer: about 34 m²

7.

R(1,1) = 4.828427 + \dfrac{0.828427}{3} = 5.104569,\quad R(2,1) = 5.146264 + \dfrac{0.317837}{3} = 5.252210

Column 1.

R(2,2) = 5.252210 + \dfrac{5.252210 - 5.104569}{15} = 5.252210 + 0.009843 = 5.262053

Column 2.

Answer: about 5.262, still off by 0.071 from 16/3 ≈ 5.333; √x has an infinite slope at 0, so its trapezoidal error is not a series in h² and the extrapolation weights are wrong

8.

2^4 = 16

Row 4 uses 16 subintervals.

16 + 1 = 17

Count the endpoints of the subintervals.

Answer: 17 values (every other entry reuses them)

9.

|0.693175 - 0.694444| = 0.001269

Error estimate.

|0.693147 - 0.693175| = 0.000028

True error.

Answer: the estimate 0.0013 is larger than the true error 0.000028, so it is a safe (pessimistic) estimate

10.

Answer: column 2 is Boole’s rule, which is exact for every polynomial of degree 5 or less, and x⁴ has degree 4

Romberg integration FAQ

What is Romberg integration?

It is a numerical integration method that applies Richardson extrapolation to trapezoidal rule estimates with step sizes h, h/2, h/4, … and arranges the results in a triangular table.

How is Romberg integration related to Simpson’s rule?

The first extrapolated column of the Romberg table is exactly the composite Simpson’s rule, and the second is Boole’s rule. Later columns are even higher-order rules.

How accurate is Romberg integration?

For a smooth integrand, column j has error of order h²ʲ⁺², so each new column and row gains accuracy fast. A table with 17 function values often gives 8 or more correct digits.

When should I not use Romberg integration?

Avoid it when the integrand or one of its low derivatives is not smooth on the interval, such as √x at 0 or a function with a corner, and when data are noisy or not spaced in powers of 2. Split the interval at trouble spots or use another method.

Summary

  • Row k of the Romberg table starts with the trapezoidal estimate using 2ᵏ subintervals.
  • R(k,0) = ½R(k − 1,0) + hₖ · (sum of f at the new midpoints), so no function value is computed twice.
  • R(k,j) = R(k,j − 1) + [R(k,j − 1) − R(k − 1,j − 1)]/(4ʲ − 1).
  • Column 1 is Simpson’s rule and column 2 is Boole’s rule.
  • Stop when neighboring diagonal entries agree to the accuracy you need.

Previous lesson: Richardson Extrapolation

Next lesson: Gaussian Quadrature

Back to the Numerical Methods Index