Numerical Solutions of ODEs: Euler's Method

20 min
0/4 practice checks

When an initial-value problem y=f(x,y),  y(x0)=y0y' = f(x, y),\; y(x_0) = y_0 has no closed-form solution, Euler's method marches forward in small steps of size hh:

yn+1=yn+hf(xn,yn),xn+1=xn+h.y_{n+1} = y_n + h\, f(x_n, y_n), \qquad x_{n+1} = x_n + h.

At each point you use the slope f(xn,yn)f(x_n, y_n) to take a short straight step, then re-evaluate the slope and repeat.

Worked example. For y=y,  y(0)=1,  h=0.5y' = y,\; y(0) = 1,\; h = 0.5: y1=1+0.5(1)=1.5y_1 = 1 + 0.5(1) = 1.5, then y2=1.5+0.5(1.5)=2.25.y_2 = 1.5 + 0.5(1.5) = 2.25. The exact answer at x=1x = 1 is e2.718e \approx 2.718, so Euler underestimates here — a reminder that it is only an approximation.

Apply one Euler step to y=yy' = y with y(0)=1y(0) = 1 and step size h=0.5h = 0.5. Find y1y_1.

Making the step size hh smaller in Euler's method generally…

Continue the previous problem: for y=yy' = y, y1=1.5y_1 = 1.5, h=0.5h = 0.5, find y2y_2.

For y=x+yy' = x + y with y(0)=1y(0) = 1 and h=0.1h = 0.1, take two Euler steps and find y2y_2.