Euler's Step-by-Step Method and Slope Fields | Analysis and Approaches IB Maths notes

Free preview: Euler's Step-by-Step Method and Slope Fields

Euler's Method: Walking Along the Tangent

Analysis and approaches: HL only (AHL 5.18). Applications and interpretation: HL only (AHL 5.15 slope fields, AHL 5.16 Euler's method)

Let's start with the problem. Some differential equations can be solved exactly, by separating the variables. But most equations, like dydx=x2+y2, have no exact solution you can write down. We can still build the solution curve numerically, one small step at a time.

  • We have a first-order differential equation dydx=f(x,y) and a starting point (x0,y0) (the initial condition).
  • At any point the equation tells us the gradient of the solution curve through that point.
  • Idea: walk a short distance h in x along that gradient (the tangent), then work out the new gradient and repeat.

yr+1=yr+hf(xr,yr),xr+1=xr+h

๐Ÿ’ก In plain words

  • New y = old y + step ร— gradient at the old point.
  • Rise = run ร— gradient, exactly like moving along a straight line.

The recipe

  1. Set up a table with columns r, xr, yr, gradient f(xr,yr), new y. Why: each row feeds the next, and the marks are for the rows.
  2. Work out the gradient at the current point. Why: Euler always uses the gradient at the start of the step.
  3. New y = old y + h ร— gradient; new x = old x + h.
  4. Repeat until you reach the x you want. Why: number of steps = (target x โˆ’ start x) รท h.

๐Ÿ‘€ Watch me do it: dy/dx = x + y, y(0) = 1, h = 0.1: estimate y(0.3)

What I writeWhy I do it
r = 0: gradient 0+1=1; y1=1+0.1(1)=1.1Start at (0, 1).
r = 1: gradient 0.1+1.1=1.2; y2=1.1+0.12=1.22Now at (0.1, 1.1).
r = 2: gradient 0.2+1.22=1.42; y3=1.22+0.142=1.362Now at (0.2, 1.22).
y(0.3)≈1.362Three steps of 0.1 reach x = 0.3.
Exact (by integrating factor) y=2ex−x−1: y(0.3)=1.399718.Our error is about โˆ’0.038.
rxryrf(xr,yr)=xr+yryr+1=yr+0.1f
00111.1
10.11.11.21.22
20.21.221.421.362
30.31.362

โœ๏ธ YOUR TURN 1

Try this first:

Use Euler's method with h = 0.2 to estimate y(0.6) for dydx=xy, y(0)=1. The exact solution is y=ex2/2; find the error.

Answer:

  • r = 0: gradient 0 ร— 1 = 0, so y1=1.
  • r = 1: gradient 0.2 ร— 1 = 0.2, so y2=1+0.04=1.04.
  • r = 2: gradient 0.4 ร— 1.04 = 0.416, so y3=1.04+0.0832=1.1232.
  • Exact e0.18=1.1972. Error about โˆ’0.074.

Why Euler Drifts

The exact curve y = 2e^x โˆ’ x โˆ’ 1 from x = 0 to 1, and Euler's method with h = 0.25 as a chain of straight segments through (0, 1), (0.25, 1.25), (0.5, 1.625), (0.75, 2.1563) and (1, 2.8828), falling further below the curve at each step

Following the diagram

  • The exact curve y=2ex−x−1 from x = 0 to 1, and Euler's method with h = 0.25 as a chain of straight segments.
  • Each pink segment starts with the gradient at the start of the step: from (0, 1) the gradient is 0 + 1 = 1, so we reach (0.25, 1.25).
  • But the true curve gets steeper during the step (it bends upwards), so the segment ends up below it.
  • The next step starts from the wrong point, so the errors build up: at x = 1, Euler gives 2.8828 against the exact 3.4366.
  • Notice the dashed gaps get bigger at every step.

Diagram: Here is the opposite case, as a made-up example: dydx = 1 - y, y(0) = 0, h = 0.5. The exact solution y = 1 - e^-x bends downwards.

What the picture shows

  • Here is the opposite case, as a made-up example: dydx=1−y, y(0) = 0, h = 0.5. The exact solution y=1−e−x bends downwards.
  • Euler uses the gradient at the start of each step. On a curve that flattens out, that gradient is too steep, so each pink segment ends above the curve.
  • The errors build up: at x = 2 Euler gives 0.9375 against the exact 1−e−2=0.8647.
  • So Euler undershoots when the curve bends up and overshoots when it bends down.

๐Ÿ‘€ Watch me do it: follow the overshoot for dydx=1−y, y(0)=0, h=0.5

What I writeWhy I do it
Gradient 1−0=1; y1=0+0.5(1)=0.5Exact 1−e−0.5=0.3935: already too high.
Gradient 1−0.5=0.5; y2=0.5+0.25=0.75Exact 1−e−1=0.6321.
Gradient 0.25; y3=0.875. Gradient 0.125; y4=0.9375Each step uses the steeper gradient from the start of the step.
At x = 2: 0.9375 against 0.8647.The curve flattens as it goes, so the start-of-step gradient is always too steep: overshoot.

๐Ÿ“ Here's the trap

Unlock the full note: start 7 days free.

Log in or subscribe to read the rest of this note. Members also get the AI tutor, practice quizzes, mock exams and flashcards for this topic.

Log in ยท Subscribe ยท Start free trial

All notes in HL: Differential equations and Maclaurin series (AHL 5.18, 5.19)

  1. Solving Separable Differential Equations
  2. Homogeneous Differential Equations: the Substitution y = vx
  3. First-Order Differential Equations: Families of Solutions and the Integrating Factor
  4. Euler's Step-by-Step Method and Slope Fields
  5. Maclaurin Series: Building a Polynomial from Derivatives at Zero
  6. The Standard Maclaurin Series, Their Ranges of Validity and Composite Expansions
  7. Series Solutions and Substitutions for Differential Equations

What's inside for this topic

7 teacher notes, 64 practice questions, 40 flashcards, 2 quizzes.

Get the full notes, every practice question, flashcards, quizzes and mock papers.

Start your free 7-day trial

Questions? Chat with us on WhatsApp ยท Try one live lesson

Previous note: First-Order Differential Equations: Families of Solutions and the Integrating Factor Next note: Maclaurin Series: Building a Polynomial from Derivatives at Zero

All Analysis and Approaches IB Maths topics ยท IB Maths