The Computable Differential Equation Lecture ... - Bruce E. Shapiro
The Computable Differential Equation Lecture ... - Bruce E. Shapiro The Computable Differential Equation Lecture ... - Bruce E. Shapiro
22 CHAPTER 1. CLASSIFYING THE PROBLEM Math 582B, Spring 2007 California State University Northridge c○2007, B.E.Shapiro Last revised: May 23, 2007
CHAPTER 1. CLASSIFYING THE PROBLEM 23 Here is a more LISP-like implementation that returns the same, identical results: EulersMethod2[f , t0 , y0 , tmax , h ] := Module[{Euler}, Euler[{x , u }] := {x + h, u + h * f[x, u]}; ⇐= Return[NestList[Euler, {t0, y0}, Round[tmax/h]]] ] ⇐= This makes use of the function NestList . NestList implements fixed point iteration in Mathematica. For example, NestList[f, a, 3] returns three fixed point iterations of the function f starting at the point a: {a, f[a], f[f[a]], f[f[f[a]]]} In EulersMethod2 the fixed point iteration is being performed on the locally defined function Euler. Eulertakes a pair of numbers {t, y} and returns a new pair of numbers {t + h, y + hf(t, y)} These are same two numbers that are calculated at each step during the previous Euler’s method implementation. They are then used recursively by NestList as the new values of the parameters x and u. The number of iterations of NestList is determined by rounding the ratio t max /h, which might not otherwise be an integer. c○2007, B.E.Shapiro Last revised: May 23, 2007 Math 582B, Spring 2007 California State University Northridge
- Page 1 and 2: The Computable Differential Equatio
- Page 3 and 4: Contents 1 Classifying The Problem
- Page 5 and 6: CONTENTS v Timeline on Computable D
- Page 7 and 8: Chapter 1 Classifying The Problem 1
- Page 9 and 10: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 11 and 12: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 13 and 14: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 15 and 16: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 17 and 18: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 19 and 20: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 21 and 22: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 23 and 24: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 25 and 26: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 27: CHAPTER 1. CLASSIFYING THE PROBLEM
- Page 31 and 32: Chapter 2 Successive Approximations
- Page 33 and 34: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 35 and 36: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 37 and 38: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 39 and 40: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 41 and 42: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 43 and 44: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 45 and 46: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 47 and 48: CHAPTER 2. SUCCESSIVE APPROXIMATION
- Page 49 and 50: Chapter 3 Approximate Solutions 3.1
- Page 51 and 52: CHAPTER 3. APPROXIMATE SOLUTIONS 45
- Page 53 and 54: CHAPTER 3. APPROXIMATE SOLUTIONS 47
- Page 55 and 56: CHAPTER 3. APPROXIMATE SOLUTIONS 49
- Page 57 and 58: CHAPTER 3. APPROXIMATE SOLUTIONS 51
- Page 59 and 60: CHAPTER 3. APPROXIMATE SOLUTIONS 53
- Page 61 and 62: CHAPTER 3. APPROXIMATE SOLUTIONS 55
- Page 63 and 64: CHAPTER 3. APPROXIMATE SOLUTIONS 57
- Page 65 and 66: CHAPTER 3. APPROXIMATE SOLUTIONS 59
- Page 67 and 68: CHAPTER 3. APPROXIMATE SOLUTIONS 61
- Page 69 and 70: CHAPTER 3. APPROXIMATE SOLUTIONS 63
- Page 71 and 72: CHAPTER 3. APPROXIMATE SOLUTIONS 65
- Page 73 and 74: CHAPTER 3. APPROXIMATE SOLUTIONS 67
- Page 75 and 76: Chapter 4 Improving on Euler’s Me
- Page 77 and 78: CHAPTER 4. IMPROVING ON EULER’S M
CHAPTER 1. CLASSIFYING THE PROBLEM 23<br />
Here is a more LISP-like implementation that returns the same, identical results:<br />
EulersMethod2[f , t0 , y0 , tmax , h ] :=<br />
Module[{Euler},<br />
Euler[{x , u }] := {x + h, u + h * f[x, u]}; ⇐=<br />
Return[NestList[Euler, {t0, y0}, Round[tmax/h]]]<br />
]<br />
⇐=<br />
This makes use of the function NestList . NestList implements fixed point<br />
iteration in Mathematica. For example,<br />
NestList[f, a, 3]<br />
returns three fixed point iterations of the function f starting at the point a:<br />
{a, f[a], f[f[a]], f[f[f[a]]]}<br />
In EulersMethod2 the fixed point iteration is being performed on the locally defined<br />
function Euler. Eulertakes a pair of numbers {t, y} and returns a new pair of<br />
numbers<br />
{t + h, y + hf(t, y)}<br />
<strong>The</strong>se are same two numbers that are calculated at each step during the previous<br />
Euler’s method implementation. <strong>The</strong>y are then used recursively by NestList<br />
as the new values of the parameters x and u. <strong>The</strong> number of iterations of<br />
NestList is determined by rounding the ratio t max /h, which might not otherwise<br />
be an integer.<br />
c○2007, B.E.<strong>Shapiro</strong><br />
Last revised: May 23, 2007<br />
Math 582B, Spring 2007<br />
California State University Northridge