Title: Eulers Method
1Eulers Method
Last time we had look at a Taylor series
expansion of v(t0)
where the error term is not explicitly known
Label the steps in t with ti t0 idt,
---gtgt sequence in y
For small stepsize dt, we have a scheme for
approximately solving the initial value problem.
---gt Explicit Euler Scheme
2Eulers Method for Higher Order Systems
So far we have considered 1st order ODEs
Many differential equations are however 2nd or
higher order
We can always reduce a higher order ODE into sets
of 1st order ODEs
can be split into two first order equations by
introducing a new variable
Resulting 1st order equations are equivalent to
the 2nd order equations
3Eulers Method for Higher Order Systems
Once we have obtained the set of two 1st order
equations, we can use Eulers Method using both
equations
Eulers Method is then in pseudo-code
Initial (x, y, z) yn1 yn fy(xn, yn, zn)
?x zn1 zn fz(xn, yn , zn) ?x xn1 xn
?x Repeat
4Simple Harmonic Motion
Lets assume an a pendulum of mass m is connected
by a massless string to a rigid support.
From Newtons 2nd law we know
Lets assume ? is small, so sin? ?
5Simple Harmonic Motion
Our basic equation of motion is the second order
ODE
To solve this numerically it is convenient to
rewrite this as two first-order ODEs
Next, convert these two equations into difference
equations, using a time step ?t
6Simple Harmonic Motion
Using the Euler method, we get
We use the values at time step i to estimate
their values at time step i1
with ?i and ?i be the angular displacement and
velocity at time step i.
7Simple Harmonic Motion
Example Length 1m Initial Displacement
10o Initial Velocity 0 m/s Time Step 0.02 s
8Simple Harmonic Motion
Time Step 0.02 s, 100 Points/Period
Exact Euler
9Simple Harmonic Motion
Time Step 0.01 s, 200 Points/Period
Exact Euler
10Simple Harmonic Motion
Time Step 0.01 s, 200 Points/Period
Exact Euler
11Simple Harmonic Motion
Time Step 0.001 s, 2000 Points/Period
Exact Euler
12Simple Harmonic Motion
Time Step 0.001 s, 2000 Points/Period
Exact Euler
13Euler Method and Conservation of Energy
It appears that the Euler Method does not
conserve the total energy for oscillatory motions
over each complete period!
The total energy of our pendulum is
Lets make mgl a unit of energy and ? -1 a unit
of time
14Conservation of Energy
Lets use the Euler Method
For our use of ? -1
Energy increases with time
15Euler-Cromer Method
Euler Method
Euler-Cromer Method
Do I 1, Nstep
End Do
16Simple Harmonic Motion
Time Step 0.02 s, 100 Points/Period
Exact Euler-Cromer
17For Comparison Euler Methos
Time Step 0.01 s, 200 Points/Period
Exact Euler
18Euler-Cromer Method
The local truncation error in the Euler-Cromer
Method is still of the order O(?t2).
The Euler-Cromer Method conserves the total
energy for oscillatory motions over each complete
period!
The total energy of our pendulum is
Lets make mgl a unit of energy and ? -1 a unit
of time
19Conservation of Energy
Lets use the Euler-Cromer Method
For our use of ? -1
20Conservation of Energy
Lets look at the term proportional to
We know
The change of the total energy over one complete
cycle is proportional to ?t3.