You are on page 1of 18

Euler Method

Let’s say we have a model:

X = population of rabbits
b = birth and death rate of rabbits
X
x  bx  bX
t
Euler Method
dX
 bX derivative
dt
Anyone know how to solve this:
Euler Method
dX
 bX derivative
dt
Anyone know how to solve this:

dX  bX  dt Multiply dt to both sides

 dX   bX  dt Integrate both sides

This is called a Seperable differentia…


Euler Method
dX
 bX derivative
dt
Anyone know how to solve this:

dX  bX  dt Multiply dt to both sides

 dX   bX  dt Integrate both sides

This is called a Seperable differentia…


Use Berkeley Madonna!!
Euler Method
Euler’s method is a numerical integration
method used to approximate solutions for
differential equations.

X  t  h   X (t )  h  X (t )
Euler Method

V
X new  X old  t 
t
Euler Method
Euler Method
X  to   1000 init X = 1000

X(to)

t
Euler Method

dX
X(to) dt

t
Euler Method

Xold Xnew
dX
dt
t
Euler Method

dX
dt
X

Xnew

Xold

t
Euler Method
Euler Method

Error
Euler Method
The error from using Euler’s Method is:

2
1d v 2
2
t  O (  t 3
)
2 dt

t is being squared and cubed


Euler Method
So Euler Method is pretty inaccurate
especially if dt is very large and after
multiple iterations.

Luckily, Berkeley Madonna has multiple


numerical integration methods you can
use.
Euler Method
Other methods:
Runga-Kutta
Adaptive Time Step
Rosenbrock

But note, all methods have their own


strengths and weaknesses.
Euler Method
Take home message:

If your simulation isn’t running, try running


your code again with a smaller dt or with a
different integration method.

You might also like