The true solution stays on a circle
For x′ = v and v′ = −x the rate of x² + v² is 2x·x′ + 2v·v′ = 2x·v − 2v·x = 0. So x² + v² is constant along a solution: from the start (1, 0) the solution is (cos t, −sin t) and stays on the circle of radius 1.
The oscillator x′ = v, v′ = −x has solutions that move on a circle, and x² + v² never changes. Euler's method applied to it does not keep that quantity: each step multiplies x² + v² by exactly 1 + h², so the polygon spirals outward. The fractions the lab prints are exact, and they show an exactly wrong answer.
Core ideas
Three ideas: what the equation conserves, what one Euler step does to it, and why exact fractions do not repair it.
For x′ = v and v′ = −x the rate of x² + v² is 2x·x′ + 2v·v′ = 2x·v − 2v·x = 0. So x² + v² is constant along a solution: from the start (1, 0) the solution is (cos t, −sin t) and stays on the circle of radius 1.
One step replaces (x, v) by (x + h·v, v − h·x). Squaring and adding, the cross terms 2h·x·v and −2h·x·v cancel and what is left is (1 + h²)·(x² + v²). The factor is greater than 1 for every positive h.
The lab prints every point as an exact fraction. The growth by 1 + h² is not a rounding effect: it is the exact value of the recipe. A smaller step makes the factor closer to 1, and the factor never reaches it.
The material
The conserved quantity, a proof that a step multiplies it by 1 + h², the first two steps by hand, and the three step sizes the lab compares.
The oscillator x″ + x = 0 written as a system is x′ = v, v′ = −x. Its solutions from (1, 0) are x = cos t and v = −sin t, so that x² + v² = cos² t + sin² t = 1 at every t. The quantity can be shown to be constant without the solutions at all: its rate is 2x·v + 2v·(−x) = 0. That is what the equation conserves.
Euler's method steps the system by the recipe xₙ₊₁ = xₙ + h·vₙ and vₙ₊₁ = vₙ − h·xₙ, with both formulas using the old values. Differential Equations and Euler's Method ran the same recipe on a single equation; here it runs on a pair, and the lab prints the pair at every step as exact fractions.
For the Euler step xₙ₊₁ = xₙ + h·vₙ, vₙ₊₁ = vₙ − h·xₙ, xₙ₊₁² + vₙ₊₁² = (1 + h²)·(xₙ² + vₙ²) for every xₙ and vₙ.
Expand both squares: (xₙ + h·vₙ)² = xₙ² + 2h·xₙ·vₙ + h²·vₙ² and (vₙ − h·xₙ)² = vₙ² − 2h·xₙ·vₙ + h²·xₙ².
Adding, the middle terms cancel, and what remains is xₙ² + vₙ² + h²·(xₙ² + vₙ²) = (1 + h²)·(xₙ² + vₙ²). The argument is algebra and holds for any starting point.
□
Start at (1, 0) with h = 1/4. The first step gives x₁ = 1 + (1/4)·0 = 1 and v₁ = 0 − (1/4)·1 = −1/4, so x₁² + v₁² = 1 + 1/16 = 17/16. The second gives x₂ = 1 + (1/4)(−1/4) = 15/16 and v₂ = −1/4 − (1/4)·1 = −1/2, so x₂² + v₂² = 225/256 + 64/256 = 289/256, which is (17/16)².
Every step multiplies the last column by 17/16, and the point is outside the circle after the first step. The polygon the lab draws spirals out of the circle the true solution stays on, which the lab draws behind it in floating point and labels as drawn. The lab names the origin of the true system a centre, a point with closed circles round it, and a polygon that does not close is exactly what Euler's method makes of one.
The three presets run to the same time, t = 6: h = 1/2 for 12 steps, h = 1/4 for 24 and h = 1/8 for 48. The lab prints the ratio of the last radius squared to the one before: 5/4, 17/16 and 65/64, each 1 + h² exactly. The total gain is that factor to the power of the number of steps, so it falls as h falls, and it never reaches 1.
With h = 1/4 the radius squared after 24 steps is (17/16)²⁴, which is ≈ 4.28444, rounded. With h = 1/8 it is (65/64)⁴⁸ ≈ 2.10476, also rounded, and with h = 1/2 it is (5/4)¹² ≈ 14.5519.
The natural logarithm of the total gain, which is the growth rate in an exponent, falls from ≈ 2.67772 to ≈ 1.45499 to ≈ 0.744201, all rounded: it roughly halves each time h does, the behaviour of a method whose error is proportional to h. A smaller step slows the growth and cannot remove it.
Interactive
Trace, determinant, eigenvalues and exact Euler steps
Method
Five moves. The factor is known before any step is taken.
x′ = v and v′ = −x. For the true solution x² + v² is constant, so the target is a circle.
Each step multiplies x² + v² by 1 + h². Compute it from the step size before reading the lab.
Use the old values in both formulas. Check that the second radius squared is the square of the factor.
The lab's ratio is the last radius squared over the one before. It should equal the factor you predicted exactly.
The total gain over n steps is the factor to the power n. Compare two step sizes that end at the same t.
Two Euler steps by hand, then the factor for the whole run.
Each line uses the old point, so the second step starts from (1, −1/4) and not from a mixture of old and new values. The last column of the table in the lesson shows the factor again.
The true solution has radius squared 1 at every time. The polygon's value is exactly 17/16 after the first step, and this is the method, not the arithmetic.
You should be able to take Euler steps on a pair of equations with old values on the right, show that x² + v² is multiplied by 1 + h² per step, read the ratio from the lab, and compare two step sizes that end at the same time.
Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.
No recommendations yet for this lesson.