Euler’s Method
Numerical Method use in solving Ordinary Differential Equation
• The first derivative
provides a direct estimate
of the slope at ti
• Here f (ti, yi) is the
differential equation
evaluated at ti and yi . This
estimate can be substituted ,
• This formula is referred to as Euler’s method (or the Euler-Cauchy or
point-slope method).
• A new value of y is predicted using the slope (equal to the first
derivative at the original value of t) to extrapolate linearly over the
step size h.
Problem:
Use Euler’s method to integrate dy/dt = 4e0.8t − 0.5y from t = 0 to 4
with a step size of 1. The initial condition at t = 0 is y = 2 or y(0) = 2
Note that the exact solution can be determined analytically as,
Step 1: Identify given data
dy/dt = 4e0.8t − 0.5y
h = 1, t = 0 to 4 , y(0) = 2
Step 2: Determine the required
y (4) = ?
Step 3: Draw a table with the following columns and fill in given data
Iteration ti yi f (ti,yi) Y Euler Y True a (%)
1 0 2
2 1
3 2
4 3
5 4
Step 4: Solve for f (ti , yi) and y i+1
f (0, 2) = 4e0 − 0.5(2) = 3.0000
y1 = y0+ f (ti,yi) h
y1 = y0 + f (0,2)(1)
= 2 + 3 (1)
= 5.0000
Step 5: Solve for the value of analytical value of y or ytrue. Fill in data.
Iteration ti yi f (ti,yi) Y euler Y true a (%)
1 0 2 3.0000 5.0000 2.0000
2 1 5.0000 6.4021 11.4022 6.1946
Take note of the analytical solution: 4
𝑦= 𝑒 .8 0
− 𝑒 −0.5 0
+ 2 𝑒 −0.5 0
= 2.0000
1.3
Step 5: Complete the table
Iteration ti yi f (ti,yi) Y Euler Y True a (%)
1 0 2 3.0000 5.0000 2.0000 150 %
2 1 5.0000 6.4021 11.4022 6.1946 84.07 %
3 2 11.40216 14.1111 25.5132 14.8439 71.88 %
4 3 … … … … …
5 4 … … … … …
4
𝑦= 𝑒 .8 2
− 𝑒 −0.5 2
+ 2 𝑒 −0.5 2
= 14.84392
1.3