Euler*s Method

advertisement
Euler’s Method
Leonhard Euler
•
•
•
•
Pronounced like Leon-ard Oiler
Swiss mathematician and physicist
Introduced the idea of a function f(x)
Wrote the work Optics which
became the preeminent theory on
light until quantum light theory
• Nine point circle
What is Euler’s Method?
Equation using slopes and values at various
points of an equation to approximate the
next value of said equation.
dy
Used when the given slope or
can not
dx
be integrated
How It Works
• ynew = yold + f’(x)*Δx
• A new y value can be
approximated by taking
the old value and
adding the slope
multiplied by the step
size, which is the
difference between two
x values.
First Example!
dy
Given a point (1,2) and dx = x+y,
approximate f(2) with two equal
step sizes of .5
1. Write down equation:
ynew = yold + f’(x)*Δx
f(1.5) = f(1) + f’(1)(0.5)
First Example, Cont’d.
2. Plug in relative values:
f(1.5) = 2 + (1+2)(.5)
3. Solve: f(1.5) = 3.5 or 7/2
4. Plug in for new values:
f(2) = 3.5 + f’(1.5)(.5)
f(2) = 3.5 + 5(0.5) = 6
Second Example
• Using two equal step sizes of .1,
approximate f(.8) given dy =  y  y  2
 2 

 

and f(1)=2
dx
How to Do it
1. Write down the equation ynew=yold+(m)Δx
2. Plug in values for f(.9)
1. ynew=2-(.1)(.5)(3)
1. f(.9)= 1.85
3. Plug in values for f(.8)
1. ynew=1.85-(.1)(.925)(3.85)
1. f(.8)=1.493875
Be Careful!
• Using Euler’s method gives an approximation,
not an actual solution.
• Depending on whether or not the equation is
concave up or down, the Euler’s solution could
be higher or lower than the actual one.
Oh no! So what
about that last
example?
Concavity
• In the last example, f’(x) = x + y.
f”(x), therefore, is equal to 1.
• The concavity is always going to
be positive, which means that the
approximate value given by
Euler’s method will be lower than
the real value.
Now it’s Your Turn!
• f’(x) =
x2
2 yx
• Find f(3) given point (1,3)
• Two equal step sizes
Did You Get it Right?
• f(2) = f(1) + f’(1) * (1)
– f’(1) = 1 + 2 = 0.5
2(1)(3)
• f(2) = 3 + 0.5 = 3.5
• f(3) = f(2) + f’(2) * (1)
– f’(2) = 3.5 + 2 = 11
2(2)(3.5) 28
• f(3) = 3.5 + 11/28 = 109/28
Download