Follow the gradient, in straight lines
Stepping along a differential equation you cannot solve, and how wrong the answer is.
The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.
Four quick ones from earlier work. Try each on paper before you open the answer; a slip here shows you what to watch for later in the lesson.
2(1) β 3 = β1. Put both letters in: the gradient depends on x and on y, and the x is the one that gets left out.
Multiply first: 0.2 Γ (β4) = β0.8, then add: 3 β 0.8 = 2.2. Adding 3 + 0.2 first gives a different, wrong answer.
Move 0.4 along and 2.5 Γ 0.4 = 1 up, so y = 7. This is one Euler step: old y plus step times gradient.
Below. The curve peels away upwards from the tangent. Euler walks along tangents, so this decides which way the error goes.
Predict first. The dashed curve is the exact solution and the red line is Euler. With the number of steps set low, will the red line end above or below the dashed curve? And will adding more steps ever reverse that, or only shrink the gap? Decide, and say why, before you press the button.
Now press Add steps and compare the Euler value with the exact value in the readings. Does the gap close completely at 20 steps? If your prediction was wrong, go back to the question about tangents in the warm-up.
You know the gradient everywhere, so start at the given point and walk in a straight line for a short step. Recalculate. Walk again. Add steps and watch the staircase close on the true curve.
Every segment starts on the right gradient and then drifts, because the curve keeps bending away.
yn+1 = yn + h Γ f(xn, yn) and xn+1 = xn + h
In words: new y equals old y plus step times gradient at the old point. The gradient is always worked out where you are, never where you are going, and that is exactly why the method drifts.
Solve dydx = x + y with y = 1 at x = 0, using h = 0.1.
| n | xn | yn | f = x + y | yn+1 = yn + 0.1f |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 1.1 |
| 1 | 0.1 | 1.1 | 1.2 | 1.22 |
| 2 | 0.2 | 1.22 | 1.42 | 1.362 |
| 3 | 0.3 | 1.362 | 1.662 | 1.5282 |
| 4 | 0.4 | 1.5282 | 1.9282 | 1.72102 |
So the estimate at x = 0.5 is 1.721. The exact solution is y = 2ex β x β 1, which gives 1.7974, so Euler is low by about 0.076.
Keep the full accuracy in the table. Rounding each y to 3 decimal places and feeding it back in is a different calculation, and the errors compound. Round once, at the end.
Still to come in this lesson:
In the full lesson every figure moves as you drag it, and every answer you type is checked, with a note on what each wrong answer means.
One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Pay by card on Gumroad, then come back here and type the email you paid with: we email you a sign-in link. For a refund, reply to your Gumroad receipt or email hello@ksmaths.com.
Try a free sample lesson in every unit, and the whole Skill Tree. See this unit.
Already have a revision pack or the Years 7 to 11 plan? Move up and the unused part of what you paid comes off.
Teaching students who need extra support? Student codes for 5, 10 or 30 students.