Tutorials › Calculus I › Measuring Convergence by Refining the Step

Euler's Method and Numerical Solutions · Tutorial 1439 of 1495

Measuring Convergence by Refining the Step

Compare Euler errors on successively refined grids to estimate the observed order of convergence and judge whether the results show the expected first-order behavior.

Advanced 10 min read

What You'll Learn

  • Define the error ratio for Euler approximations at a fixed target time.
  • Estimate observed order using the base-two logarithm of successive error ratios.
  • Explain why halving the step size gives a ratio near two for first-order convergence.
  • Read the approach to the expected ratio in a numerical example.
  • Recognize why vanishing errors, sign changes, and pre-asymptotic results can mislead.

Why Compare Refined Euler Computations?

One Euler computation gives an approximation, but it does not by itself show how the method’s error changes when the calculation is refined. A useful diagnostic is to compute the solution at the same target time using step sizes \(h\), \(h/2\), \(h/4\), and so on, then compare the corresponding errors.

If halving the step size approximately halves the error, the data are consistent with first-order convergence. The comparison also helps distinguish an established convergence pattern from a coarse-grid result that has not yet settled into that pattern.

Key idea: Compare errors, not just approximations. For a method whose error behaves like a constant times \(h^p\), halving \(h\) makes the error ratio approach \(2^p\). For Euler’s method, the expected order is \(p=1\), so the ratio approaches \(2\) when the leading error is nonzero and the calculation is in the asymptotic regime.

Define the Error Ratio

Fix an initial-value problem, an initial time \(t_0\), and a target time \(T>t_0\). Suppose the exact solution value \(y(T)\) is known. Let \(Y_h(T)\) denote the Euler approximation at \(T\) using a uniform step size \(h\). When the interval is divided evenly, \(h=(T-t_0)/N\) for an integer \(N\). Halving the step size doubles the number of steps and still reaches the same target time.

Definition: The absolute error at step size \(h\) is \[ E(h)=|Y_h(T)-y(T)|. \] When \(E(h/2)>0\), the successive error ratio is \[ R(h)=\frac{E(h)}{E(h/2)}. \] The observed order from this pair of grids is \[ p_{\mathrm{obs}}(h)=\log_2 R(h), \] provided \(R(h)>0\).

The absolute value makes the error a nonnegative measure of distance from the exact value. The ratio asks how many times larger the coarser-grid error is than the error after halving the step. A ratio of \(2\) corresponds to an observed order of \(1\), because \(\log_2 2=1\). A ratio of \(4\) corresponds to order \(2\).

For comparisons across several refinements, use the same target time and the exact solution value at that time. Changing the endpoint changes the errors being compared and may change their leading behavior.

Why the Ratio Measures Order

Assume the error has a leading-order description \[ E(h)=C h^p+o(h^p) \] as \(h\) tends to zero, where \(C>0\), \(p>0\), and \(o(h^p)\) denotes a term whose ratio to \(h^p\) tends to zero. Equivalently, write \[ E(h)=C h^p(1+\varepsilon(h)), \] where \(\varepsilon(h)\) tends to zero. Then the error at half the step size is \[ E(h/2)=C(h/2)^p(1+\varepsilon(h/2)). \] Dividing gives \[ \frac{E(h)}{E(h/2)} = \frac{C h^p(1+\varepsilon(h))} {C h^p 2^{-p}(1+\varepsilon(h/2))} = 2^p\frac{1+\varepsilon(h)}{1+\varepsilon(h/2)}. \] As \(h\) tends to zero, both error terms tend to zero, so their factor tends to \(1\). Therefore \[ \lim_{h\to 0}\frac{E(h)}{E(h/2)}=2^p. \] Taking the base-two logarithm shows that \(p_{\mathrm{obs}}(h)\) tends to \(p\), under these assumptions.

This derivation explains both the usefulness and the limits of the test. A ratio near \(2^p\) is evidence for order \(p\) on the grids tested; it is not, by itself, a proof that the asymptotic error description applies. The global error bound for Euler’s method gives first-order accuracy under its stated conditions, but a bound alone need not imply that every finite-grid ratio is close to \(2\). The leading error can be small, or the selected endpoint can have special error cancellation.

For Euler: When the leading error is nonzero and the step sizes are sufficiently small for the leading-order behavior to dominate, first-order convergence predicts \[ E(h)\approx C h,\qquad \frac{E(h)}{E(h/2)}\approx 2,\qquad p_{\mathrm{obs}}(h)\approx 1. \]

Worked Examples

Worked Example: An Exact First-Order Error Ratio

Consider \(y'=t\), \(y(0)=0\), and approximate the solution at \(T=1\). The exact solution is \(y(t)=t^2/2\), since its derivative is \(t\) and it satisfies the initial condition. Thus \(y(1)=1/2\).

With \(N\) uniform Euler steps, \(h=1/N\). At the left endpoint of step \(k\), the time is \(kh\), and the Euler increment is \(h(kh)\). Summing for \(k=0,\ldots,N-1\) gives \[ Y_h(1)=h^2\sum_{k=0}^{N-1}k =h^2\frac{N(N-1)}{2} =\frac{N-1}{2N}. \] The absolute error is therefore \[ E(h)=\left|\frac{N-1}{2N}-\frac12\right| =\left|-\frac{1}{2N}\right| =\frac{1}{2N} =\frac h2. \]

For \(N=1,2,4,8\), the Euler approximations are respectively \(0,\;1/4,\;3/8,\;7/16\). Their errors are \(1/2,\;1/4,\;1/8,\;1/16\). Each refinement halves the error: \[ \frac{1/2}{1/4}=2,\qquad \frac{1/4}{1/8}=2,\qquad \frac{1/8}{1/16}=2. \] Each observed order is \(\log_2 2=1\). As a check, the Euler update at a left endpoint \(kh\) adds \(h(kh)\), so the summed values above are exactly the values produced by the Euler steps; subtracting each from \(y(1)=1/2\) gives the stated errors.

Worked Example: Ratios Approaching Two

Consider \(y'=y\), \(y(0)=1\), at \(T=1\). The exact solution is \(y(t)=e^t\), so \(y(1)=e\). For \(N\) Euler steps, each step multiplies the current value by \(1+1/N\). Consequently, \[ Y_{1/N}(1)=\left(1+\frac1N\right)^N. \] The table compares these values with \(e\). Values are rounded to six decimal places, and the errors and ratios are calculated from unrounded values.

Steps \(N\)Step size \(h\)Euler value \(Y_h(1)\)Error \(E(h)\)Ratio from preceding row
112.0000000.718282—
21/22.2500000.4682821.533
41/42.4414060.2768761.692
81/82.5657850.1524971.816
161/162.6379280.0803531.897

For example, at \(N=4\), \[ Y_{1/4}(1)=\left(\frac54\right)^4=\frac{625}{256}=2.44140625. \] Its error is \[ E(1/4)=|2.44140625-2.718281828\ldots| =0.276875578\ldots. \] The error ratio for the \(N=2\) and \(N=4\) grids is \[ \frac{E(1/2)}{E(1/4)} =\frac{0.468281828\ldots}{0.276875578\ldots} \approx 1.692. \] Its observed order is approximately \(\log_2(1.692)\approx0.759\). The later ratios give observed orders approximately \(0.861\) and \(0.924\), moving toward \(1\). Thus the coarsest grids do not yet show a ratio of \(2\), while the refined grids are more consistent with the expected first-order pattern.

As a check on the error calculations, subtracting the displayed Euler value from the exact value \(e\approx2.718281828\) gives the listed errors to six decimal places. Dividing consecutive unrounded errors gives the listed ratios to three decimal places. These computations illustrate why an observed order is estimated from a sequence of refinements rather than inferred from one coarse ratio.

Worked Example: Zero Error Makes the Ratio Undefined

Consider \(y'=1\), \(y(0)=2\), and \(T=1\). The exact solution is \(y(t)=2+t\), since its derivative is \(1\) and \(y(0)=2\). Hence \(y(1)=3\).

With \(N\) Euler steps, each step adds \(h\cdot 1=1/N\). After \(N\) steps, \[ Y_{1/N}(1)=2+N\left(\frac1N\right)=3. \] For \(N=1,2,4\), the approximations are all \(3\), and the absolute errors are all \(0\). Substitution confirms the exact solution has the required derivative and initial value, and the Euler sum confirms each endpoint value.

Here the successive ratio is \(0/0\), which is undefined, so the observed-order formula cannot be used. It would be incorrect to call the observed order infinite: these data simply provide no error ratio. A method can be exact for a particular problem even though Euler’s general convergence order is first order.

Read the Evidence Carefully

A ratio close to \(2\) across several refinements supports first-order behavior, but individual ratios may differ for understandable reasons. On coarse grids, terms beyond the leading error can be substantial. At a particular endpoint, leading contributions can partly cancel. If the error changes sign, signed-error ratios can be negative even though both approximations are converging. For these reasons, this tutorial defines ratios using absolute errors.

There are also practical requirements. The target time must match across computations, the exact solution value must be available to calculate the actual errors, and the errors must be nonzero for the ratio to be defined. If errors are extremely small, limited numerical precision can distort their ratio. A stable pattern across multiple refinements is more informative than a single value.

Common Mistake: Dividing Approximation Values

The ratio of approximations is not the ratio of errors. In the first example, the Euler values for \(N=2\) and \(N=4\) are \(1/4\) and \(3/8\). Dividing them gives \[ \frac{3/8}{1/4}=\frac32, \] which is not the error ratio and does not estimate the convergence order. The exact value is \(1/2\), so the actual errors are \(1/4\) and \(1/8\), and the correct ratio is \[ \frac{1/4}{1/8}=2. \] The correction is to subtract the exact endpoint value from each approximation, take absolute values, and only then form the ratio.

Practical Interpretation

1
Fix the endpoint.
Compute every Euler approximation at the same target time.
2
Find absolute errors.
Subtract the exact solution value at that endpoint from each approximation and take the absolute value.
3
Form successive ratios.
Divide the error at step size \(h\) by the error at step size \(h/2\), checking that the denominator is nonzero.
4
Interpret the pattern.
For first-order behavior, look for ratios tending toward \(2\), or observed orders tending toward \(1\), across several refinements.

Measured convergence order is a diagnostic, not a replacement for the assumptions behind a convergence theorem. The central comparison is simple: halve the step, compare the resulting errors at the same endpoint, and interpret the ratios in light of the expected order and the limitations of finite computations.

Check Your Understanding

Use the definitions and reasoning in this tutorial to answer the following questions.

  1. If the error is proportional to \(h^2\), what ratio should successive errors approach when \(h\) is halved?
  2. Why must the Euler approximations being compared use the same target time?
  3. If the error ratio is \(2\), what is the corresponding observed order?
  4. Why can a coarse-grid ratio differ noticeably from \(2\) even when Euler’s method has first-order convergence?
  5. What should you conclude if both successive absolute errors are zero?

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon