n t y dy/dt
Euler’s Method for ODEs
University of Washington Tacoma
Differential equation
an equation that relates an unknown function to its own derivative.
For example
\[y(t) = 3t + \frac{dy}{dt}\]
We’ve seen analytical solutions to differential equations.
For example, in the parachute problem, we used the solution to this differential equation: \[\frac{dv}{dt} = g -\frac{c}{m}v\]
which was:
\[ v(t) = \frac{gm}{c}(1 - e^{-ct/m})\]
But many differential equations don’t have closed-form (i.e., analytical) solutions.
For those, we need numerical methods to approximate solutions.

(1760’s) Euler developed a method that approximates the solution to a differential equation.
He realized that if
Then..




To solve a differential equation with Euler’s method we need to start with two things:
Given:
For \(n = 1, 2, 3 \ldots\): \[t_{n+1} = t_n + \Delta t\] \[y_{n+1} = y_n + \Delta t \cdot f(t_n, y_n)\]
Use the differential equation and initial condition below to find \(y\) when \(t=2.5\):
\[y(t) = 1 - \frac{dy}{dt},\quad y(0) = 3\]
Let’s use Euler’s method with \(\Delta t = 0.5\) to approximate \(y(2.5)\).
Let’s rearrange the differential equation so we have a “function for the derivative”:
\[\frac{dy}{dt} = 1 - y(t)\]
Given:
\(y(0) = 3\)
\(\Delta t = 0.5\)
\(\frac{dy}{dt} = 1 - y(t)\)
Euler equations:
\(t_{n+1} = t_n + \Delta t\)
\(y_{n+1} = y_n + \Delta t \cdot \frac{dy}{dt}\)
n t y dy/dt
0 0.0 3.0 -2.0
1 0.5 2.0 -1.0
2 1.0 1.5 -0.5
3 1.5 1.25 -0.25
4 2.0 1.125 -0.125
5 2.5 1.0625 -0.0625
y(2.5) is approximately 1.0625
