0% found this document useful (0 votes)
73 views12 pages

Euler's Method

This document introduces Euler's method for numerically solving ordinary differential equations. It provides the formulation of Euler's method, which approximates the solution of a differential equation as a recurrence relation. Several examples are worked out step-by-step to demonstrate how to apply Euler's method to problems with different functions and initial conditions. The document concludes by outlining four examples solved using Euler's method with varying stepsizes and differential equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views12 pages

Euler's Method

This document introduces Euler's method for numerically solving ordinary differential equations. It provides the formulation of Euler's method, which approximates the solution of a differential equation as a recurrence relation. Several examples are worked out step-by-step to demonstrate how to apply Euler's method to problems with different functions and initial conditions. The document concludes by outlining four examples solved using Euler's method with varying stepsizes and differential equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Introduction

Euler’s Method

Engineering Computations
Numerical Ordinary Differential Equations

Dr.Wisam Haitham

Computer Engineering Department


College of Engineering
Al-Mustansiriyah University

July/2020

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 1 / 11


Introduction
Euler’s Method

Agenda

1 Introduction

2 Euler’s Method

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 2 / 11


Introduction
Euler’s Method

Introduction
Many problems in science and engineering when formulated mathe-
matically are readily expressed in terms of ordinary differential equa-
tions (ODE) with initial and boundary condition.
Consider the problem of solving the first-order differential equation
dy
= f(t, y)
dt
such that we know the rate of change of a quantity as a function
of time and the quantity itself. The problem is to obtain a solution
for y(t), possibly in a general form, but in practical problems usually
where an initial condition y(t0 ) = y0 is known. In many problems
this can be solved analytically. In general such an integration is not
possible, for example, the differential equation dy/dt = −y2 − t,
and we have to solve the equation numerically, which usually means
obtaining a sequence of numerical values y1 , y2 , ... corresponding to
specified values t1 , t2 , ....
Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 3 / 11
Introduction
Euler’s Method

The figure below shows the nature of the numerical solution of a


differential equation

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 4 / 11


Introduction
Euler’s Method

Agenda

1 Introduction

2 Euler’s Method

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 5 / 11


Introduction
Euler’s Method

Euler’s Method

Euler method is one of the oldest numerical methods used for inte-
grating the ordinary differential equations. Though this method is
not used in practice, its understanding will help us to gain insight
into nature of predictor-corrector method.
To find the solution of the given Differential Equation in the form
of a recurrence relation
ym+1 = ym + hf(tm , ym ) Is called Euler Method

FORMULA DERIVATION
Consider the differential Equation of the first order
dy
dx = f(t, y) and y(t0 ) = y0
Let (t0 , y0 ) and (t1 , y1 ) be two points of approximation curve. Then
y1 − y0 = m(x1 − x0 ) ....... (i)(point Slope form)
Given That dy dx = f(t, y)

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 6 / 11


Introduction
Euler’s Method

y1 − y0 = f(t0 , y0 )(x1 − x0 )
So y1 = y0 + f(t0 , y0 )(x1 − x0 )
Similarly
y2 = y1 + f(t1 , y1 )(x2 − x1 )
y3 = y2 + f(t2 , y2 )(x3 − x2 )
. . .
. . .
. . .
ym+1 = ym + f(tm , ym )(xm+1 − xm )

ym+1 = ym + hf(tm , ym ) (m = 0, 1, ..)

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 7 / 11


Introduction
Euler’s Method

Example 1 :
Use Euler’s method with h = 0.1 to solve the initial value problem
dy 2 2
dx = x + y with y(0)=0 in the range 0 6 x 6 0.5.
Solution:
Here
f(x, y) = x2 + y2 , x0 = 0, y0 = 0, h = 0.1
Hence
x1 = x0 + h = (0 + 0.1) = 0.1, x2 = x1 + h = (0.1 + 0.1) = 0.2,
x3 = x2 + h = 0.3, x4 = x3 + h = 0.4, x5 = x4 + h = 0.5
ym+1 = ym + hf(tm , ym )
y1 = y0 + 0.1(x20 + y20 ) = 0 + 0.1(0 + 0) = 0
y2 = y1 + 0.1(x21 + y21 ) = 0 + 0.1((0.1)2 + 0) = 0.001
y3 = y2 + 0.1(x22 + y22 ) = 0.001 + 0.1((0.2)2 + (0.001)2 ) = 0.005
y4 = y3 + 0.1(x23 + y23 ) = 0.005 + 0.1((0.3)2 + (0.005)2 ) = 0.014
y5 = y4 +0.1(x24 +y24 ) = 0.014+0.1((0.4)2 +(0.014)2 ) = 0.0300196

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 8 / 11


Introduction
Euler’s Method

Hence
y(0)=0 y(0.1)=0 y(0.2)=0.001 y(0.3)=0.005
y(0.4)=0.014 y(0.5)=0.0300196
Example 2 :
Using Euler method solve the equation dy dx = 2xy + 1 with y(0)=0,
h = 0.02, for x=0.1
Solution:
Here
f(x, y) = 2xy + 1, x0 = 0, y0 = 0, h = 0.02
Hence
x1 = x0 + h = (0 + 0.02) = 0.02,
x2 = x1 + h = (0.02 + 0.02) = 0.04, x3 = x2 + h = 0.06,
x4 = x3 + h = 0.08, x5 = x4 + h = 0.1
ym+1 = ym + hf(tm , ym )
y1 = y0 + 0.02(2x0 y0 + 1) = 0 + 0.02(0 + 1) = 0.02
y2 = y1 + 0.02(2x1 y1 + 1) = 0.02 + 0.02(2 ∗ 0.02 ∗ 0.02 + 1) = 0.04
y3 = y2 + 0.02(2x2 y2 + 1) = 0.04 + 0.02(2 ∗ 0.04 ∗ 0.04 + 1) = 0.06
Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 9 / 11
Introduction
Euler’s Method

y4 = y3 + 0.02(2x3 y3 + 1) = 0.005 + 0.02(2 ∗ 0.06 ∗ 0.06 + 1) = 0.08


y5 = y4 + 0.02(2x4 y4 + 1) = 0.014 + 0.02(2 ∗ 0.08 ∗ 0.08 + 1) = 0.1
Hence
y(0)=0 y(0.02)=0.02 y(0.04)=0.04 y(0.06)=0.06
y(0.08)=0.08 y(0.1)=0.1
That is the approximate value of y(0.1) is 0.1
Example 3 :
Using Euler’s method, compute y in the range 0 6 x 6 0.5, if y
dy
satisfies dx = 3x + y2 with y(0)=1, h=0.1
Solution:
Here
f(x, y) = 3x + y2 , x0 = 0, y0 = 1, h = 0.1
Hence
x1 = x0 + h = 0.1, x2 = x1 + h = 0.2, x3 = x2 + h = 0.3,
x4 = x3 + h = 0.4, x5 = x4 + h = 0.5
ym+1 = ym + hf(tm , ym )
Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 10 / 11
Introduction
Euler’s Method

y1 = y0 + 0.1(3x0 + y20 ) = 1.1


y2 = y1 + 0.1(3x1 + y21 ) = 1.251
y3 = y2 + 0.1(3x2 + y22 ) = 1.4675
y4 = y3 + 0.1(3x3 + y23 ) = 1.7728
y5 = y4 + 0.1(3x4 + y24 ) = 2.2071
Hence
y(0)=1 y(0.1)=1.1 y(0.2)=1.251 y(0.3)=1.4675
y(0.4)=1.7728 y(0.5)=2.2071

Example 4 :
dy
Given dx = y−x
y+x , with y=1 for x=0 . Find y approximately for
x=0.1 by Euler’s method in five steps, choosing h=0.002.
Solution:
Here
f(x, y) = y−x
y+x , x0 = 0, y0 = 1, h = 0.002

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 11 / 11


Introduction
Euler’s Method

y1 = y0 + 0.002( yy00 −x
+x0 ) = 1.02
0

y2 = y1 + 0.002( yy11 −x
+x1 ) = 1.0392
1

y3 = y2 + 0.002( yy22 −x
+x2 ) = 1.0577
2

y4 = y3 + 0.002( yy33 −x
+x3 ) = 1.0756
3

y5 = y4 + 0.002( yy44 −x
+x4 ) = 1.0928
4

Hence
y=1.0928 and x=0.1

Al-Mustansiriyah University, College of Engineering NUMERICAL ORDINARY DIFFERENTIAL EQUATIONS 12 / 11

You might also like