Euler’s Method CS 170: Computing for the Sciences and Mathematics.
-
Upload
hilary-franklin -
Category
Documents
-
view
216 -
download
0
Transcript of Euler’s Method CS 170: Computing for the Sciences and Mathematics.
![Page 1: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/1.jpg)
Euler’s Method
CS 170:Computing for the Sciences
and Mathematics
![Page 2: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/2.jpg)
Administrivia
Last time (in P265) Basics of Algorithms and computation
Today More Maple Euler’s method HW #6 Due! HW #7 assigned
![Page 3: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/3.jpg)
Euler’s method
Simplest simulation technique for solving
differential equation
Intuitive
Some other methods faster and more
accurate
Error on order of ∆t
Cut ∆t in half cut error by half
![Page 4: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/4.jpg)
Euler’s Method
Euler’s Method is a simulation technique.
Example: unconstrained growth dP/dt =
0.1P with P0 = 100
P(t) = P(t - ∆t) + growth(t)∆t (new = old + change)
growth(t) is dP/dt = 0.1P(t - ∆t) (change = r*Pold)
![Page 5: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/5.jpg)
Example
dP/dt = 0.1P with P0 = 100 and ∆t = 8
![Page 6: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/6.jpg)
Approximating Unconstrained Growth
initialize simulationLength, population, growthRate, ∆t
numIterations simulationLength / ∆t
for i going from 1 to numIterations do the following:growth growthRate * populationpopulation population + growth * ∆tt t + ∆t
![Page 7: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/7.jpg)
Approximating Unconstrained Growth (Better)
initialize simulationLength, population, growthRate, ∆t
numIterations simulationLength / ∆t
for i going from 1 to numIterations do the following:growth growthRate * populationpopulation population + growth * ∆tt i*∆t
![Page 8: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/8.jpg)
Error
Analytical solution: P = 100 e0.10t
After 100 time units: P = 2,202,647
Smaller ∆t better estimation
∆t = 1 estimate of P = 1,378,061
∆t = 0.25 estimate of P = 1,947,808
∆t = 0.01 estimate of P = 2,191,668
∆t = 0.005 estimate of P = 2,197,149
![Page 9: Euler’s Method CS 170: Computing for the Sciences and Mathematics.](https://reader036.fdocuments.net/reader036/viewer/2022082613/5697bfb71a28abf838c9eb86/html5/thumbnails/9.jpg)
HOMEWORK!
Homework 7 Maple Tutorial 2 Complete the worksheet’s questions and turn it in Also complete Module 5.2’s Project 1 on page 167. Due 11/1/2010
Thursday’s Class in P115