Step by step
The question
Question: use Euler's method on dy/dx = x + 2y, with y(0) = 1, step 0.1, to find y(0.3).
1 The idea
We cannot solve it exactly here.
So we walk: from a point, follow its slope for a short step h.
Then look at the slope again.
New y = old y + h times the slope.
2 The step size
From x = 0 to x = 0.3, in steps of 0.1: that is 3 steps.
3 Go to x = 0.1
The slope at our point (0, 1): put x and y into x + 2y.
It is 2.
New y = old y + h times the slope: 1 + 0.1 × 2, which is 1.2.
Now we are at x = 0.1.
Careful!
Times the step size h!
We only move 0.1 to the right, so y changes by 0.1 times the slope.
4 Go to x = 0.2
The slope at (0.1, 1.2) is 2.5.
New y: 1.2 + 0.1 × 2.5 = 1.45.
5 Go to x = 0.3
The slope at (0.2, 1.45) is 3.1.
New y: 1.45 + 0.1 × 3.1 = 1.76.
All the points in a table.
So y(0.3) ≈ 1.76.
6 Check
Let's check: a calculator with very tiny steps gives about 1.8776.
Close to our 1.76.
Euler is a bit low: the slope changes during each step.
Smaller steps get closer.
Right!
Let's look back.
First: the idea.
Then: the step size.
Then: go to x = 0.1.
Then: go to x = 0.2.
Then: go to x = 0.3.
Last: check.