Practice: Numerical Solution of Differential Equations

Recognition · Error diagnosis

A student applies Euler's method to y ′ = − 20 y with y ( 0 ) = 1 on [ 0 , 1 ] , using h = 0.2 . The exact solution is y = e − 20 t , so y ( 1 ) ≈ 2.06 × 10 − 9 .

Their computation returns − 243 .

They conclude the step is a little too large and that any smaller step will improve matters. What is the better account?

2 hints available, least help first.

Hint 1: Retrieval cue

Write out the first few computed values by hand. What is each one times the previous?

Hint 2: Concept cue

Euler on y ′ = λ y multiplies by 1 + h λ each step. When does a geometric sequence stay bounded?

Direct application

Apply Euler's method to

y ′ = y − t 2 + 1 , y ( 0 ) = 0.5

with step size h = 0.5 .

What is the approximation to y ( 1 ) , that is, the value after two steps?

Enter the value. It is checked against the answer and the precision this task asks for.

2 hints available, least help first.

Hint 1: Retrieval cue

Each step is y new = y old + h × f ( t old , y old ) .

Hint 2: Concept cue

After the first step, t has advanced to 0.5 as well as y to 1.25 . Use both in the second evaluation.

Prediction

A fourth-order method (RK4) gives an error of 8 × 10 − 6 at step size h .

Approximately what error should be expected at step size h / 2 , assuming h is already small enough for the asymptotic behaviour to hold?

2 hints available, least help first.

Hint 1: Retrieval cue

Order p means the error is proportional to h p .

Hint 2: Concept cue

Substitute h / 2 into C h 4 and compare with C h 4 .

Direct application

Apply one step of the improved Euler (Heun) method to

y ′ = y − t 2 + 1 , y ( 0 ) = 0.5

with h = 0.5 .

What is the resulting approximation to y ( 0.5 ) ?

Enter the value. It is checked against the answer and the precision this task asks for.

3 hints available, least help first.

Hint 1: Retrieval cue

The method needs two slopes, and averages them.

Hint 2: Concept cue

The second slope is evaluated at the point an Euler step predicts, not at the starting value.

Hint 3: Partial setup

k 1 = 1.5 and the predicted endpoint is 1.25 . Now evaluate f ( 0.5 , 1.25 ) and average.

Direct application

Euler's method is applied to y ′ = − 50 y .

Stability requires | 1 + h λ | < 1 . What is the supremum of the step sizes h that satisfy this, that is, the value h must stay strictly below?

Enter the value. It is checked against the answer and the precision this task asks for.

2 hints available, least help first.

Hint 1: Retrieval cue

Substitute λ = − 50 into | 1 + h λ | < 1 and solve for h .

Hint 2: Concept cue

Removing the absolute value gives two inequalities; the binding one is 1 + h λ > − 1 .

Classification · Method selection

You must integrate y ′ = − 50 y from t = 0 to t = 1 with Euler's method, and one decimal place of accuracy would be enough.

What determines the step size you may use?

2 hints available, least help first.

Hint 1: Retrieval cue

Write the Euler update for y ′ = λ y as a multiplication and ask when the factor has magnitude below 1.

Hint 2: Concept cue

With λ = − 50 , solve | 1 + h λ | < 1 for h .

Recognition · Error diagnosis

A learner states: "Euler's method has error proportional to h , so the answer improves monotonically as h shrinks. There is no step size too small, only one too slow to compute."

Which response identifies what the claim overlooks?

2 hints available, least help first.

Hint 1: Retrieval cue

How many steps are taken to reach a fixed endpoint when the step size is h ?

Hint 2: Concept cue

Each step commits a small rounding error. Consider what 1 / h steps do to the accumulated total as h shrinks.

Construction · Direct application

(a) For y ′ = y − t 2 + 1 with y ( 0 ) = 0.5 , carry out four Euler steps with h = 0.5 to approximate y ( 2 ) . The exact solution is y = ( t + 1 ) 2 − 1 2 e t ; tabulate your values against it and say why the error grows at every step.

(b) Take one improved Euler step on the same problem with h = 0.5 , showing where each slope is evaluated, and compare its error with Euler's at t = 0.5 . Say what evaluating the second slope at the current value instead would cost.

Write your answer, then compare it with the worked solution.

3 hints available, least help first.

Hint 1: Retrieval cue

Write down where each slope is evaluated before computing anything.

Hint 2: Concept cue

In (b), the second slope is taken at the endpoint an Euler step predicts, not at the starting value.

Hint 3: Partial setup

In (b), k 1 = 1.5 and the predicted endpoint is 1.25 . Evaluate f ( 0.5 , 1.25 ) and average the two slopes.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) Four Euler steps. With f ( t , y ) = y − t 2 + 1 , h = 0.5 , applying y n + 1 = y n + h f ( t n , y n ) : - f ( 0 ,   0.5 ) = 0.5 − 0 + 1 = 1.5 , so y 1 = 0.5 + 0.5 ( 1.5 ) = 1.25
- f ( 0.5 ,   1.25 ) = 1.25 − 0.25 + 1 = 2.0 , so y 2 = 1.25 + 0.5 ( 2.0 ) = 2.25
- f ( 1 ,   2.25 ) = 2.25 − 1 + 1 = 2.25 , so y 3 = 2.25 + 0.5 ( 2.25 ) = 3.375
- f ( 1.5 ,   3.375 ) = 3.375 − 2.25 + 1 = 2.125 , so y 4 = 3.375 + 0.5 ( 2.125 ) = 4.4375 | n | t n | Euler y n | Exact | Error |
|---|---|---|---|---|
| 0 | 0 | 0.500000 | 0.500000 | 0 |
| 1 | 0.5 | 1.250000 | 1.425639 | 0.175639 |
| 2 | 1.0 | 2.250000 | 2.640859 | 0.390859 |
| 3 | 1.5 | 3.375000 | 4.009155 | 0.634155 |
| 4 | 2.0 | 4.437500 | 5.305472 | 0.867972 | The approximation to y ( 2 ) is 4.4375 , low by 0.86797195 , about 16%. The error grows monotonically: each step adds a new error to those already carried, and since this solution curves upward, every tangent line falls below it. Check on the exact solution: y ( 0 ) = 1 − 0.5 = 0.5 , and y ′ = 2 ( t + 1 ) − 1 2 e t while y − t 2 + 1 = ( t + 1 ) 2 − 1 2 e t − t 2 + 1 = 2 t + 2 − 1 2 e t , identical. (b) One improved Euler step.

k 1 = f ( 0 ,   0.5 ) = 1.5 .

Predict the far endpoint with an Euler step: y 0 + h k 1 = 0.5 + 0.5 ( 1.5 ) = 1.25 . Evaluate the second slope there:

k 2 = f ( 0.5 ,   1.25 ) = 1.25 − 0.25 + 1 = 2.0 .

Average:

y 1 = 0.5 + 0.5 2 ( 1.5 + 2.0 ) = 0.5 + 0.25 ( 3.5 ) = 1.375 .

Comparison at t = 0.5 . Exact 1.425639 ; Heun's error 0.050639 , Euler's 0.175639 , better by a factor of about 3.5 for one extra evaluation of f . Where the slopes were taken. k 1 at the current point ( 0 ,   0.5 ) ; k 2 at ( 0.5 ,   1.25 ) , the predicted endpoint. Evaluating k 2 at the old value instead would give f ( 0.5 ,   0.5 ) = 1.25 and the wrong answer 1.1875 , and would forfeit the second-order accuracy, since averaging the slope at the two ends is what cancels the leading error term.

A complete answer does each of these:

  • applies euler step
  • applies higher order method

Transfer · Evaluation

A climate model integrates its equations with a fourth-order method. At the current step size the estimated error in a reported quantity is 8 × 10 − 6 .

The team halves the step size. What error should they expect, assuming the step is already small enough for the asymptotic behaviour to hold?

Give your answer in units of 10 − 7 .

Enter the value. It is checked against the answer and the precision this task asks for.

2 hints available, least help first.

Hint 1: Retrieval cue

Order p means the error is proportional to h p .

Hint 2: Concept cue

Substitute h / 2 into C h 4 and compare with C h 4 .

Construction · Evaluation · Explanation

(a) Euler applied to y ′ = y , y ( 0 ) = 1 gives errors at t = 1 of 0.27687558 with n = 4 and 0.15249731 with n = 8 . State the order this indicates, predict the error at n = 16 , and say why the observed ratios climb toward their limit rather than attaining it.

(b) Euler is applied to y ′ = − 20 y , y ( 0 ) = 1 with h = 0.2 and returns − 243 at t = 1 , where the true value is about 2 × 10 − 9 . Explain what has gone wrong, derive the condition on h , and give the largest usable step.

(c) You must integrate y ′ = − 50 y to one decimal place of accuracy. Say what caps the step size, and why.

(d) At a budget of 32 evaluations of f , Euler with 32 steps gives error 4.13 × 10 − 2 , improved Euler with 16 steps gives 1.69 × 10 − 3 , and RK4 with 8 steps gives 4.98 × 10 − 6 . Explain why the method taking the coarsest step wins, and name a circumstance that would overturn the ranking.

(e) The equation y ′ = t 2 + y 2 with y ( 0 ) = 0 has no elementary solution. RK4 gives y ( 1 ) = 0.3502337418 with 10 steps, 0.3502318445 with 100, and 0.3502318443 with both 1000 and 10000. Say how many digits you would trust and why, then explain what a numerical solution provides and what it does not.

Write your answer, then compare it with the worked solution.

3 hints available, least help first.

Hint 1: Retrieval cue

In (a), divide one error by the next and compare with 2 p .

Hint 2: Concept cue

In (b) and (c), write the Euler update for y ′ = λ y as a multiplication and ask when the factor has magnitude below 1.

Hint 3: Strategy cue

In (e), the difference between two runs estimates the error of the coarser one, and three runs agreeing says more than two.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) Order from the error ratio.

0.27687558 0.15249731 = 1.8156 .

The ratio is near 2, so halving the step roughly halves the error: first order, p = 1 , as expected for Euler. Prediction at n = 16 . Dividing by about 2 gives roughly 0.076 to 0.080 . The computed value is 0.08035333 , a ratio of 1.8978 . Why the ratios climb. Order is an asymptotic statement: the error behaves like C h p as h → 0 , with corrections of higher order in h that are not negligible at coarse steps. Those corrections shrink as h does, so the observed ratio approaches the limit from below: 1.53 , 1.69 , 1.82 , 1.90 , 1.95 , 1.97 , 1.99 for n up to 128. The same pattern appears for RK4, whose ratios run 10.63 , 13.01 , 14.42 , 15.19 toward 16. A ratio short of the limit is evidence that h is not yet small, not that the order is wrong. (b) Instability. Euler on y ′ = λ y gives y n + 1 = ( 1 + h λ ) y n , so after n steps y n = ( 1 + h λ ) n y 0 , a geometric sequence with ratio 1 + h λ . With λ = − 20 and h = 0.2 the ratio is 1 − 4 = − 3 , so the computed values are 1 , − 3 , 9 , − 27 , 81 , − 243 : growing because | − 3 | > 1 , and alternating in sign because the ratio is negative. The true solution e − 20 t decays monotonically and stays positive, reaching 2.061153622439 × 10 − 9 at t = 1 . So this is not inaccuracy but qualitative failure: wrong sign, and wrong by eleven orders of magnitude. The arithmetic is correct; the recurrence has stopped tracking the equation. The condition. Boundedness requires

| 1 + h λ | < 1 ⟺ − 1 < 1 − 20 h < 1 ⟺ 0 < h < 2 20 = 0.1 .

The largest usable step is anything strictly below 0.1 . The endpoint matters: at h = 0.1 exactly the ratio is − 1 , giving 1 , − 1 , 1 , − 1 , … , which never decays, and the computed y ( 1 ) is + 1.000000 . At h = 0.05 the ratio is 0 and the method returns 0; at h = 0.025 , 9.09 × 10 − 13 ; at h = 0.01 , 2.04 × 10 − 10 . (c) What caps the step for y ′ = − 50 y . The stability limit, not the accuracy requirement. With λ = − 50 , boundedness needs h < 2 / 50 = 0.04 . One decimal place is an undemanding accuracy target and would permit a much coarser step on a well-behaved equation, but at h = 0.2 the ratio 1 + h λ = − 9 makes the output grow and alternate in sign while the true solution decays to e − 50 ≈ 2 × 10 − 22 . The bound depends on the decay rate alone. An equation with λ = − 1000 forces h < 0.002 however few digits are wanted. Such equations are called stiff, and they motivate implicit methods, which carry no such restriction. (d) Equal work, different methods. Comparing per step is misleading, because one RK4 step costs four evaluations of f and one Euler step costs one. Evaluating f is usually the expensive part, so the fair comparison fixes the number of evaluations, which is what the budget of 32 does. RK4 takes the coarsest step and still wins by a factor of about 8300 over Euler and 340 over improved Euler. The exponent beats the step size: error behaves like C h p , so quadrupling h costs a factor of 4 4 = 256 for RK4 while the extra order buys far more. Doubling the budget widens the gap, since each doubling buys Euler a factor of 2, improved Euler about 3.9, and RK4 about 15.2. Circumstances that overturn the ranking. If f is not smooth, the order theorem's hypotheses fail and RK4's four samples straddle the kink, collapsing its advantage toward first order. If the equation is stiff, the step is capped by stability rather than accuracy, the extra accuracy per step is wasted, and an implicit method beats all three. And for one or two digits by hand, Euler's simplicity can be worth more than RK4's accuracy. (e) Reading a computed answer. How many digits to trust. The coarsest two estimates differ by 1.9 × 10 − 6 , which measures the error of the coarser run rather than the finer. The evidence is the agreement across refinements: 100 steps gives 0.3502318445 , and 1000 and 10000 steps both give 0.3502318443 , unchanged in the digits shown. Agreement across three refinements supports ten decimal places: y ( 1 ) = 0.3502318443 . This is the standard technique when no exact solution exists, since there is nothing to compare against. What it provides. Values at chosen points, for one set of inputs, with an error that must be estimated rather than known. Here a ten-digit number for a quantity no formula in this corpus can express. What it does not provide. A function. Nothing here says how y depends on t in general, what happens for a different initial value, or how the answer shifts if a parameter changes; each requires another run. Nor does it reveal structure: a formula like 3 e x 2 displays its growth rate and behaviour at infinity at a glance. A numerical method also never announces that the solution has ceased to exist, so for y ′ = y 2 with y ( 0 ) = 1 , which blows up at t = 1 , the arithmetic returns numbers past that point just as readily, and they mean nothing.

A complete answer does each of these:

  • predicts error scaling
  • applies stability limit
  • selects method and step
  • interprets approximation
Practice data

Your practice record is stored in this browser only. Clearing it removes every answer and every scheduled review, and cannot be undone.

Results update as you type. Use the up and down arrow keys to move between results, Enter to open one, and Escape to close.

Type to search.

Settings

Appearance

Interface density

Your record

Your progress is stored in this browser and nowhere else: an identifier, the answers you have given, the mastery states and review schedule derived from them, and the lesson you last opened. Clearing it makes you a new learner on this device. It cannot be undone, and it will not affect your appearance or density settings.

Focus timer

Focus--minutes remaining

Phase

Kept in this browser only, and used to label the session in your own history.

Today

Nothing recorded yet. Finish a focus session and it will appear here.

Settings

Focus sessions between long breaks.

Sessions you are aiming for in a day.

Notifications

Your history

Sessions are stored in this browser and nowhere else. They are not evidence and never reach your mastery record.