Euler's method: following the slope

Trace the solution of a differential equation in small steps and measure the error. About 8 minutes, University.

What you will do

  1. A slope at every point. A differential equation such as dydx = x + y tells you the slope of the curve at every point. Knowing where it starts, you can follow it.
  2. Step along the tangent. Take a small step h along the current slope: y_n+1 = y_n + h\,f(x_n, y_n).
  3. How good is it?. The estimate drifts off curving solutions. Compare it with a finer method to see the error.
  4. Smaller steps, better answer. The exact solution of dydx = y, y(0) = 1 is e^x, so at x = 0.5 it is about 1.6487. Halve the step and the Euler estimate moves closer.

Loading SumClash…