0% found this document useful (0 votes)
74 views5 pages

Module 1

The document describes Euler's method, a numerical method for solving initial value problems for ordinary differential equations. It provides three key steps: 1) The interval over which the solution is sought is divided into smaller sub-intervals of equal length h. 2) An initial approximation y0 is made at x0. 3) Successive approximations yn+1 are made by advancing from yn using the tangent line with slope f(xn,yn) over each sub-interval of length h. Two examples are provided to illustrate applying Euler's method to find an approximate solution to initial value problems and how accuracy improves with smaller step sizes h.

Uploaded by

arz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views5 pages

Module 1

The document describes Euler's method, a numerical method for solving initial value problems for ordinary differential equations. It provides three key steps: 1) The interval over which the solution is sought is divided into smaller sub-intervals of equal length h. 2) An initial approximation y0 is made at x0. 3) Successive approximations yn+1 are made by advancing from yn using the tangent line with slope f(xn,yn) over each sub-interval of length h. Two examples are provided to illustrate applying Euler's method to find an approximate solution to initial value problems and how accuracy improves with smaller step sizes h.

Uploaded by

arz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

MODULE 1

Solving Differential Equations Numerically: Euler’s Method

We assume that the initial-value problem


dy (1)
=f ( x , y) y ( x 0 )= y 0
dx
x 0 , x 1=x 0 +h , x 2=x 0+ 2h , … , x n=x 0 +nh

The method provides a value y k that is an approximation of the exact value y (x k ) for k =0 , 1 ,… , n

dy
=f ( x , y )
dx
dy =f ( x , y ) dx
x1 x1

∫ dy=¿∫ f ( x , y ) dx ¿
x0 x0

x1
dy
y ( x 1) − y ( x 0 )=∫ dx
x0
dx
x1

y 1− y 0 =∫ f ( x , y ) dx
x0
(2)

y 1− y 0 =f ( x , y ) ¿

y 1− y 0 =f ( x 0 , y 0 ) [x 1−x 0 ]

y 1= y 0 + f ( x 0 , y 0 ) ( h ) where h=x 1−x 0

To obtain:

y 2= y 1 + f ( x1 , y 1) ( h )

y 3= y 2 + f ( x2 , y 2 ) ( h )

Definition Euler’s Method

y n+ 1= y n +h[f ( x n , y n ) ] (3)

The geometric meaning of Equation (3) is easily seen by considering the direction field of differential
equation (1): we are simply following the tangent to the solution curve passing through (x n , y n ) for a small
horizontal distance.
Looking at Figure 1.9, where the smooth curve is the unknown exact solution to the initial value
problem (1), we see how equation (3) approximates the exact solution.

Since f ( x 0 , y 0 ) is the slope of the exact solution at (x 0 , y 0 ), we follow this line to the point (x 1 , y 1 ). Some
solution to the differential equation passes through this point. We follow its tangent line at this point to reach
(x 2 , y 2 ), and so on.
The difference ∆ x are errors at the left stage in the process.

EXAMPLE 1: Using Euler’s method with different value of h. Estimate y(1) where y(x) satisfies the initial value
problem.
dy
=y y(0) = 1
dx

Using Differential Equation


dy = ydx
dy
∫ y
=∫ dx

ln y=x + c
x+c
y=e
x c
y=e e
x
y=c e (G.S.)
If y 0=1 , x 0=0
0
1=c e
1=c( 1)
c=1
Therefore,
x
y=e (P.S.)

What is y(1)

y=e(1)=e=2.718281828 …
Using Euler’s Method
1
We begin by dividing the interval [0,1] into five (5) sub-intervals. Then h= =0.2 and f ( x n , y n )= y n .
5
Thus we obtain, successively.

y n+ 1= y n +h f ( x n , y n)

y 0= y 0=1

y 1= y 0 +0.2 y 0= (1+ 0.2 ) y 0= (1.2 )( 1 )=1.2


2
y 2= y 1 +0.2 y 1=( 1.2 ) y 1=( 1.2 )( 1.2 )= (1.2 )

y 3= y 2 +0.2 y 2=( 1.2 ) y 2=( 1.2 ) (1.2 )2 =( 1.2 )3

y 4 = y 3 +0.2 y 3=( 1.2 ) y 3 =( 1.2 )( 1.2 )3=( 1.2 )4

y 5= y 4 +0.2 y 4=( 1.2 ) y 4 =( 1.2 )( 1.2 )4 =( 1.2 )5

y 5=¿ 2.48832

error =true value−approximation


error =2.71828−2.48832
error =0.22996(if step ¿ ¿ 0.2)
What happens if we double the number of sub-intervals. If n=10 then h = 0.1, and, computing as before,
we obtain y(1) = y 10 = (1.1)10 = 2.59374

error =2.71828−2.59374=0.12454

EXAMPLE 2: Approximating the solution of an initial-value problem using Euler’s Method. Find an approximate
value for y(1) if y(x) satisfies the initial value problem
dy
= y +x 2 y(0) = 1
dx
1 1
Use five sub-intervals in your approximation. H or h is equal to = =0.2
n 5

Using Differential Equation


dy
= y + x2
dx
dy 2
− y=x
dx
dy 2
−1( y )=x
dx

Recall: First Order Linear Differential Equations


dy
+[P ( x ) ] y=Q( x )
dx
Integrating Factor
v=e∫ =e∫
P ( x ) dx −1 dx −x
=e
Substitute

y e−x =∫ (e ¿¿−x)(x 2)dx ¿

Integration by parts
2 −x −x
u=x du=2 xdx v =e dv=−e

You might also like