Tutorials › Calculus II › Adaptive Step Sizes from Taylor Error Estimates

Taylor Methods in Computation · Tutorial 896 of 998

Adaptive Step Sizes from Taylor Error Estimates

Use the leading omitted Taylor term to judge an ODE step and adjust its size to meet a local error tolerance.

Advanced 10 min read

What You'll Learn

  • Identify the leading neglected term in a Taylor step of order p.
  • Distinguish estimated local error from accumulated global error.
  • Apply an error tolerance to accept or reject a trial step.
  • Derive the step-size adjustment exponent from the Taylor order.
  • Use safety factors and recognize when an estimate may be unreliable.

Why Adjust the Step Size?

A Taylor method advances an approximate solution of an initial-value problem over a step of length \(h\). A large step can be efficient, but it can also make the local approximation inaccurate. A small step usually reduces the local truncation error, at the cost of requiring more steps to cover the interval.

Adaptive step-size control uses an estimate of the error on a proposed step to decide whether to keep that step and how to choose the next one. For a Taylor method, the first term omitted from the Taylor polynomial gives a natural estimate. The estimate is not automatically a guaranteed error bound, but it can be a useful control signal when the Taylor expansion is behaving regularly.

The Leading Neglected Term

Consider the scalar initial-value problem \(y'=f(x,y)\), with current approximate value \(y_n\) at \(x_n\). A Taylor method of order \(p\) advances by retaining terms through degree \(p\):

$$ y_{n+1} = y_n+\sum_{k=1}^{p} \frac{h^k}{k!}y^{(k)}(x_n), \qquad x_{n+1}=x_n+h. $$

Here the derivatives are evaluated using the differential equation and its derivative recurrences. The exact solution’s Taylor expansion contains the next term, \(h^{p+1}y^{(p+1)}(x_n)/(p+1)!\), followed by higher-order terms.

Definition: The leading-term estimate of the local error for an order-\(p\) Taylor step is \(E(h)=\left|\frac{h^{p+1}}{(p+1)!}y^{(p+1)}(x_n)\right|\). It estimates the magnitude of the first omitted term, using the current step’s starting data.

The local error here means the discrepancy for one step when the step starts from the exact value at \(x_n\). In an actual computation, \(y_n\) is generally approximate, and previous step errors may already be present. Therefore, meeting a local tolerance does not by itself guarantee that the total error over a long interval meets the same tolerance.

If the prescribed local tolerance is \(\tau>0\), the basic decision is to accept the step when \(E(h)\leq\tau\), and reject it when \(E(h)>\tau\). For a specified absolute tolerance, use that value for \(\tau\). A common scalar mixed tolerance is \(\tau_n=\mathrm{atol}+\mathrm{rtol}\max(|y_n|,|y_{\mathrm{trial}}|)\), where \(\mathrm{atol}\) and \(\mathrm{rtol}\) are nonnegative absolute and relative tolerances, not both zero.

How the Estimate Determines a New Step

Suppose that over the range of the step, the leading coefficient \(C=|y^{(p+1)}(x_n)|/(p+1)!\) is approximately constant and nonzero. Then the estimate has the form \(E(h)\approx Ch^{p+1}\). If the current estimate is \(E\), the step length that would make this model estimate equal to \(\tau\) is found by solving \(E(h_{\mathrm{new}}/h)^{p+1}=\tau\).

$$ h_{\mathrm{new}} = h\left(\frac{\tau}{E}\right)^{1/(p+1)}. $$

The exponent is the reciprocal of the power of \(h\) in the leading neglected term. For example, an order-2 Taylor method has a leading error proportional to \(h^3\), so its step adjustment uses a cube root. A safety factor \(s\), usually chosen below 1, makes the proposed step more cautious:

$$ h_{\mathrm{new}} = s h\left(\frac{\tau}{E}\right)^{1/(p+1)}. $$

Implementations commonly limit how much a step may grow or shrink in one adjustment. Such bounds prevent abrupt changes when an estimate is unusually small or large. If \(E=0\), the ratio formula is undefined; an implementation needs a separate rule, such as increasing the step only by a chosen maximum growth factor. A zero leading term may mean the next nonzero Taylor term has higher order, but it does not prove that all omitted terms vanish.

Important: The leading-term estimate is asymptotic: it is most informative when the step is small enough that higher neglected terms are less influential. It is an estimate, not generally a rigorous upper bound on the true one-step error.

Worked Example: Rejecting and Resizing an Order-2 Step

Worked Example: Rejecting and Resizing an Order-2 Step

Consider \(y'=y\), starting at \(x_n=0\), \(y_n=1\), with an order-2 Taylor method. The equation gives \(y'=y\), \(y''=y\), and \(y^{(3)}=y\). Thus the method’s trial value is \(y_{n+1}=1+h+h^2/2\), and its leading neglected term has magnitude \(E(h)=h^3/6\).

Try \(h=0.2\). The trial value is \(1+0.2+0.2^2/2=1+0.2+0.02=1.22\). The error estimate is \(0.2^3/6=0.008/6=0.0013333\ldots\). With tolerance \(\tau=0.0011\), this estimate exceeds the tolerance, so reject the step.

For comparison, the exact value after this step is \(e^{0.2}\approx1.221402758\). The actual one-step error is \(1.221402758-1.22=0.001402758\), which also exceeds the tolerance. This check agrees with the rejection.

Use safety factor \(s=0.9\) to select a new step:

$$ h_{\mathrm{new}} = 0.2\left(\frac{0.0011}{0.0013333\ldots}\right)^{1/3}0.9 \approx 0.1688. $$

The new estimate is \(0.1688^3/6\approx0.000800\), below \(0.0011\), so the resized step passes the leading-term test. Its Taylor trial value is \(1+0.1688+(0.1688)^2/2=1+0.1688+0.01424768=1.18304768\). The exact value is \(e^{0.1688}\approx1.183884\), giving an actual error of about \(0.000836\), also below the tolerance. The accepted trial has a smaller estimated error than the original step.

Worked Example: An Order-1 Method with a Known Error

Worked Example: An Order-1 Method with a Known Error

Consider \(y'=x\), starting from \(x_n=1\), \(y_n=0\), and use the order-1 Taylor method (Euler’s method). Here \(y'=x\) and \(y''=1\), so the leading neglected term is \(h^2/2\). Set the local tolerance to \(\tau=0.0008\).

For a trial step \(h=0.05\), the Euler value is \(y_{\mathrm{trial}}=0+0.05(1)=0.05\). Its estimated error is \(0.05^2/2=0.0025/2=0.00125\), which exceeds the tolerance. Reject this step.

With safety factor \(0.9\), the proposed replacement is \(h_{\mathrm{new}}=0.05(0.0008/0.00125)^{1/2}(0.9)\). The ratio is \(0.64\), its square root is \(0.8\), and therefore \(h_{\mathrm{new}}=0.05(0.8)(0.9)=0.036\).

At \(h=0.036\), the Euler trial value is \(0+0.036(1)=0.036\). Its estimate is \(0.036^2/2=0.001296/2=0.000648\), which is below \(0.0008\), so accept it. In this example the exact solution has step increment \(\int_1^{1+h}x\,dx=h+h^2/2\). For \(h=0.036\), that increment is \(0.036+0.001296/2=0.036648\). The actual local error is \(0.036648-0.036=0.000648\), exactly the leading-term estimate. This agreement occurs because the solution’s Taylor expansion has no terms beyond degree 2.

Worked Example: Step Adjustment at Higher Order

Worked Example: Step Adjustment at Higher Order

Return to \(y'=y\), with \(y_n=1\), but now use an order-3 Taylor method. Since every derivative of \(y\) equals \(y\), the fourth derivative at the step’s start is \(1\). The trial value is \(1+h+h^2/2+h^3/6\), and the leading error estimate is \(E(h)=h^4/24\).

For \(h=0.5\), the trial value is \(1+0.5+0.5^2/2+0.5^3/6=1+0.5+0.125+0.0208333\ldots=1.6458333\ldots\). The estimate is \(0.5^4/24=0.0625/24=0.00260417\ldots\). This exceeds \(\tau=0.001\), so reject the step.

With \(s=0.9\), the order-3 adjustment is \(h_{\mathrm{new}}=0.5(0.001/0.00260417\ldots)^{1/4}(0.9)\approx0.354\). Using \(h_{\mathrm{new}}\approx0.354\), the estimate is \(0.354^4/24\approx0.000654\), below the tolerance. The step is accepted by the estimate. As a check, the exact one-step error is \(e^{0.354}-(1+0.354+0.354^2/2+0.354^3/6)\), approximately \(0.00070\), also below \(0.001\). The fourth root in the step adjustment is essential: the estimate scales with the fourth power of the step length.

Why the Step-Size Rule Works

The adjustment follows from the leading term’s dependence on \(h\), rather than from a guess about how much to change the step. For fixed starting data and a nonzero leading coefficient, write \(E(h)=Ch^{p+1}\), where \(C>0\). For a proposed new step \(qh\), with \(q>0\), the model gives \(E(qh)=C(qh)^{p+1}=q^{p+1}E(h)\). Setting this predicted error equal to the target \(\tau\) gives \(q^{p+1}E(h)=\tau\), hence \(q=(\tau/E(h))^{1/(p+1)}\). Multiplying the old step by \(q\) gives the adjustment formula. Multiplying further by \(s<1\) deliberately aims below the target to allow for changes in the coefficient and higher-order terms.

Takeaway: For an order-\(p\) Taylor method, the leading neglected term scales like \(h^{p+1}\). Consequently, a local error estimate changes by approximately a factor of \(q^{p+1}\) when the step changes by a factor of \(q\).

A Practical Accept-or-Reject Procedure

At each step, use the same Taylor approximation and error estimate to make a decision. If a step is rejected, keep the current point and solution value; retry from them with a smaller step. If it is accepted, advance the point and solution, then recompute the derivatives needed for the next step at the new state.

1
Form a trial step.
Compute the order-\(p\) Taylor trial value using step length \(h\).
2
Estimate the omitted term.
Evaluate \(E=|h^{p+1}y^{(p+1)}(x_n)|/(p+1)!\) from the current starting data.
3
Compare with the tolerance.
Accept when \(E\leq\tau\); otherwise reject and do not advance the solution.
4
Choose a new step size.
Use \(s h(\tau/E)^{1/(p+1)}\), with a safety factor and any chosen growth or shrinkage limits. Retry after rejection.

In computation, the estimate depends on the local behavior of the solution. A coefficient that changes sharply within a step, a step that is too large for the local Taylor expansion to be informative, or cancellation in the computed derivative can make the leading term misleading. Repeated rejection or unexpectedly large estimates are reasons to reduce the step cautiously and reassess, not reasons to assume the formula guarantees accuracy.

Common Pitfall: Using the Wrong Exponent

A frequent error is to adjust the step linearly by the ratio \(\tau/E\), even when the estimated error is proportional to a higher power of \(h\). For an order-2 method, if the error estimate is too large by a factor of 8, dividing the step by 8 is unnecessarily aggressive. Since the estimate scales as \(h^3\), dividing the step by 2 divides the estimated error by \(2^3=8\).

$$ \text{Wrong: } h_{\mathrm{new}}=h\frac{\tau}{E}, \qquad \text{Correct model: } h_{\mathrm{new}}=h\left(\frac{\tau}{E}\right)^{1/3} \quad\text{for an order-2 method.} $$

The correction is to identify the power \(p+1\) in the leading omitted term before choosing the adjustment exponent. Also distinguish the estimate from the true error: acceptance means the estimate passed the chosen test, not that every omitted contribution has been rigorously bounded.

Check Your Understanding

Use the leading-term estimate and the stated order to answer each question.

  1. For an order-4 Taylor method, what power of \(h\) appears in the leading neglected term, and what exponent appears in the step adjustment?
  2. An order-1 method has current estimate \(E=0.004\) and tolerance \(\tau=0.001\). Ignoring a safety factor, by what factor should the step length change under the leading-term model?
  3. What should a solver do with its current \(x_n\) and \(y_n\) when a trial step is rejected?
  4. Why is the leading omitted term an estimate rather than automatically a rigorous error bound?
  5. If the computed leading omitted term is zero, why is the usual ratio-based adjustment undefined, and what could the zero indicate?

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