euler’s method building the function from the derivative

6
Euler’s Method Building the function from the derivative

Upload: lora-kennedy

Post on 20-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Euler’s Method Building the function from the derivative

Euler’s Method

Building the function from the derivative

Page 2: Euler’s Method Building the function from the derivative

Local Linearity and Approximation

f xy

x( )0

x( , )x y0 0( , )x x y0 0

0( )f x x y

1 1 0 0

0 0 0

( , ) ( , )

( , ( ) )

x y x x y y

x x y f x x

0Slope= ( )f x

1 1 0 0( , ) ( , )x y x x y y

Page 3: Euler’s Method Building the function from the derivative

Euler’s Method

t

Suppose we know the value of the derivative of a function at every point and we know the value of the function at one point.

We can build an approximate graph of the function using local linearity to approximate over and over again. This iterative procedure is called Euler’s Method.

Here’s how it works.

Page 4: Euler’s Method Building the function from the derivative

Implementing Euler’s Method

New t = Old t + tNew y = Old y + y = Old y + (slope at (Old t, Old y)) t

•Well, you need a differential equation of the form:y’ = some expression in t and y

•Finally, you need a fixed step size

t.

•And a point (t0,y0) that lies on the graph of the solution function y = f (t). A smaller step size will

lead to more accuracy, but will also take more computations.

What’s needed to get Euler’s method started?

Page 5: Euler’s Method Building the function from the derivative

For instance, if y’= sin(t2)

and (1,1) lies on the graph of y =f (t), then 1000 steps of length .01 yield the following graph of the function f.

This graph is the anti-derivative of sin(t2); a function which has no elementary formula!

Page 6: Euler’s Method Building the function from the derivative

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

How do we accomplish this? Suppose that y’ = t sin(y) and (1,1) lies on the graph.Let t =.1.