Beruflich Dokumente
Kultur Dokumente
Administrivia
Last time (in P265)
Eulers method
differential equation Intuitive Some other methods faster and more accurate Error on order of t
Eulers Method
tn = t0 + n t Pn = Pn-1 + f(tn-1, Pn-1) t
Runge-Kutta 2 method
Concept of method
Instead of slope of tangent line at (tn-1, Pn-1), want
slope of chord For t = 8, want slope of chord between (0, P(0)) and (8, P(8))
Concept of method
Then, estimate for 2nd point is ? (t, P(0) + slope_of_chord * t) (8, P(0) + slope_of_chord * 8)
Concept of method
Slope of chord average of slopes of tangents at
EPC
How to find the slope of tangent at P(8) when we do
of slope at t = 8
Average of slope at 0 and estimate of slope at 8 is 0.5(10 + 18) = 14 Corrected estimate of P1 is 100 + 8(14) = 212
Runge-Kutta 2 Algorithm
initialize simulationLength, population, growthRate, t numIterations simulationLength / t for i going from 1 to numIterations do the following:
growth growthRate * population estimating next point (Euler) Y population + growth * t t i*t population population+ 0.5*( growth + growthRate*Y)
averaging two slopes
Error
With P(8) = 15.3193 and Euler estimate = 180,
relative error = ?
Runge-Kutta 4
If you want increased accuracy, you can expand your
estimations out to further terms. base each estimation on the Euler estimation of the previous point.
Computer simulation
Having computer program imitate reality, in order to
Use simulations if
Not feasible to do actual experiments Not controllable (Galaxies) System does not exist Engineering Cost of actual experiments prohibitive Money Time Danger Want to test alternatives
cellular automaton devised by the British mathematician John Horton Conway in 1970.
The game takes place on a 2-D grid Each cells value is determined by the values of an expanded neighborhood (including diagonals) from the previous time-step. Initially, each cell is populated (1) or empty (0)
alterations of a society of living organisms, it belongs to a growing class of what are called simulation games (games that resemble real life processes).
Each cell with one or zero neighbors dies (loneliness) Each cell with four or more neighbors dies (overpopulation) Each cell with two or three neighbors survives
For a space that is 'empty' or 'unpopulated Each cell with three neighbors becomes populated
http://www.bitstorm.org/gameoflife/
HOMEWORK!
http://www.theatlantic.com/magazine/archive/2002/04/seeingaround-corners/2471/