Sei sulla pagina 1di 9

Euler Method for Solving Differential Equations

Description
Euler method is an integration elemantary numerical method of a
differential ecuation with initial conditions of the form:

dy
f(t , y )
dt
y (t 0) y 0
Where:

t 0 t t max .

In this method for the numerical evaluation of the derivative we use the
aproximation obtained from the first two terms of the Taylor series
expansion of y(t) is used.

Principle
We consider the following first order differential equation:

dy
f (t , y )
dt
y (0) y 0

with the solution y(t) a function of time defined on the interval [0, tmax].
The function y(t) is evaluated in the nodes 0 < t1 < t2 << tmax of the interval
t max
An integration step h
is chosen.
n
The nodes become in this case:
t0 = 0; t1 = h; t2 = 2h; ; tn = nh = tmax .

Principle

The Taylor series expansion of y(t) at the right of ti = ih is:


2
3
h
h
y (ti h) yi yi ' h yi ''
yi ''' ...
2
6

where yi = y(i) and yi = f(ti , yi).


By neglecting the terms of order greater or equal to 2 and by denoting
y(ti+h) = yi+1 the following approximation results:

yi 1 yi hf (ti, yi )

Euler method explicit formula

Principle

The Taylor series expansion of y(t) at the left of ti+1 = (i+1)h is:

y (ti 1 h) yi 1 yi 1' h yi 1''

3
h2
h
yi 1''' ...
2
6

where yi+1 = f(ti+1 , yi+1).


By neglecting the terms of order greater or equal to 2 results
the following approximation:

yi 1 yi hf (ti 1, yi 1)

Euler method implicit formula

Pseudocode
Explicit method

Pseudocode

The procedure has the following parameters:


- input:
x0 = lower limit of the integration interval;
xmax = upper limit of the integration interval;
y0 = initial condition;
h = integration step;
- output:
y(n) = solution vector
The procedure calls the function func which evaluates the function
f(t,y) in the right member of the equation for node i.

Pseudocode
Implicit method

Pseudocode

The procedure has the following parameters:


- input:
x0 = lower limit of the integration interval;
xmax = upper limit of the integration interval;
y0 = initial condition;
h = integration step;
err = maximum admitted error;
itmax = maximum number of iterations;
- output:
y(n) = solution vector
The procedure calls the function func which evaluates the
function f(t,y) in the right member of the equation for node i.

Potrebbero piacerti anche