Euler’s Method - Kenyon College

Download Report

Transcript Euler’s Method - Kenyon College

Slope Fields
This is the slope
field for
dP
P

 .2 P 1   .
dt
 20 
Equilibrium Solutions
We get an approx.
graph for a
solution by
starting at an
initial point and
following the
arrows.
Local Linearity and Approximation
(t1 , y1 )  (t0  t , y0  y )
(t1, y1) (t (t0 t
, yt, y0 f(t y))t )
0
f (t0 ) 
y
t
y  f (t0 )t
Slope = f’(t0)
(t0 , y0 )
t
(t0  t, y0 )
0
0
Euler’s Method
Suppose we have a DE that tells
us the value of the derivative of a
function at any point and an
initial condition.
We can build an approximate
graph of the solution using local
linearity to approximate over and
over again. This iterative
procedure is called Euler’s
Method.
Here’s how it works.
t
Implementing Euler’s Method
What’s needed to get Euler’s method started?
•Well, you need a differential equation of the form:
y’ = f (t , y)
•And an initial condition (t0,y0) that lies on the graph of
the solution function y(t).
A smaller step size will
lead to more accuracy, but
•Finally, you need
will also take more
a fixed step size
computations.
t.
New t = Old t + t
New y = Old y + y = Old y + f (Old t, Old y)) t
For instance, if
y’= sin(t2)
and (1,1) lies on the graph of y = y(t), then 1000
steps of length .01 yield the following graph of
the function y.
This graph is the
anti-derivative of
sin(t2); a function
which has no
elementary formula!
How do we accomplish this?
Suppose that y’ = t sin(y) and (1,1) lies on the graph.
Let t=.1.
Old Point
Slope at old Pt.
Change in y
New t
New y
Old t
Old y
y’(old t, old y)
y= y’*t
Old t + t
Oldy + y
1
1
.8414
.08414
1.1
1.084
1.1
1.084
.9723
.09723
1.2
1.181
1.2
1.181
1.1101
.11101
1.3
1.292
New t = Old t + t
New y = Old y + y = Old y + y’(Old t, Old y) t