Euler’s Method for Ordinary Differential Equations
After reading this chapter, you should be able to: develop Euler’s Method for solving ordinary differential equations, determine how the step size affects the accuracy of a solution, derive Euler’s formula from Taylor series, and use Euler’s method to find approximate values of integrals.
1.
2.
3.
4.
What is Euler’s method?
Euler’s method is a numerical technique to solve ordinary differential equations of the form dy (1)
= f (x, y ), y (0) = y 0 dx So only first order ordinary differential equations can be solved by using Euler’s method. In another chapter we will discuss how Euler’s method is used to solve higher order ordinary differential equations or coupled (simultaneous) differential equations. How does one write a first order differential equation in the above form?
Example 1
Rewrite
in
dy
+ 2 y = 1.3e − x , y (0 ) = 5 dx dy
= f ( x, y ), y (0) = y 0 form. dx Solution dy + 2 y = 1.3e − x , y (0 ) = 5 dx dy
= 1.3e − x − 2 y, y (0 ) = 5 dx In this case
08.02.1
08.02.2
Chapter 08.02 f ( x, y ) = 1.3e − x − 2 y
Example 2
Rewrite
ey
in
dy
+ x 2 y 2 = 2 sin(3 x), y (0 ) = 5 dx dy
= f ( x, y ), y (0) = y 0 form. dx Solution dy + x 2 y 2 = 2 sin(3 x), y (0 ) = 5 dx dy 2 sin(3 x) − x 2 y 2
=
, y (0 ) = 5 dx ey
In this case
2 sin(3 x) − x 2 y 2 f ( x, y ) = ey ey
Derivation of Euler’s method
At x = 0 , we are given the value of y = y 0 . Let us call x = 0 as x0 . Now since we know the slope of y with respect to x , that is, f ( x, y ) , then at x = x0 , the slope is f ( x0 , y 0 ) .
Both x0 and y 0 are known from the initial condition y (x0 ) = y 0 . y True value
( x0 , y 0 )
Φ
y1,
Predicted
value
Step size, h x1 Figure 1 Graphical interpretation of the first step of Euler’s method.
x
Euler’s Method
08.02.3
So the slope at x = x0 as shown in Figure 1 is
Rise
Slope =
Run