The Computable Differential Equation Lecture ... - Bruce E. Shapiro
The Computable Differential Equation Lecture ... - Bruce E. Shapiro The Computable Differential Equation Lecture ... - Bruce E. Shapiro
90 CHAPTER 5. RUNGE-KUTTA METHODS error of h p . We also observe that O(h) Taylor method is equivalent to Euler’s method. The second order Taylor method has y n = y n−1 + hf + h2 2 (f t + f y f) (5.11) For the test equation y ′ = λy we have f = λy, f t = 0, f y = λ, and hence y n = y n−1 + hλy n + h2 2 λ2 y n (5.12) ) = (1 + hλ + (hλ)2 y n−1 (5.13) 2 Absolute stability occurs when ∣ y n ∣∣∣ (hλ)2 ∣ = y n−1 ∣1 + hλ + 2 ∣ ≤ 1 (5.14) To find the shape of this region, set z = hλ = re iθ , and square both sides of equation 5.14 using the identity |z| 2 = zz∗ to get (1 + re iθ + r2 e 2iθ ) (1 + re −iθ + r2 e −2iθ ) ≤ 1 (5.15) 2 2 1 + re −iθ + r2 e −2iθ + re iθ + r 2 + r 3 e −iθ r2 e 2iθ 2 2 ( e −iθ + e iθ ) 2r + r 2 e−2iθ + e 2iθ + r 3 e−iθ + e iθ 2 2 2 + r 3 e iθ + r4 4 ≤ 1 (5.16) + r 2 + r4 4 ≤ 0 (5.17) 2r cos θ + r 2 cos 2θ + r 3 cos θ + r 2 + r4 4 ≤ 0 (5.18) To plot this equation pick some small interval δθ and do the following: • Set θ = 0 • Repeat 1. Set θ = θ + δθ 2. Solve 5.18 for r, accepting only real solutions 3. Plot the point (r, θ) until θ = 2π In Mathematica we can use Solve to find the solution of 5.18. For example, to find r(π), f[r , theta ] := 2r * Cos[theta] + r^2 * Cos[2*theta] + r^3 Cos[theta] + 0.25* r^4 + r^2; Solve[f[r,Pi]==0] Math 582B, Spring 2007 California State University Northridge c○2007, B.E.Shapiro Last revised: May 23, 2007
CHAPTER 5. RUNGE-KUTTA METHODS 91 which returns a list of rules for r , {{r->0.},{r->1.-1.73205i}, {r->1.+1.73205i}, {r->2.}} To convert this to a list of numbers, replace the Solve with r/.Solve[f[r,Pi]==0] This returns {0.,1.-1.73205i, 1.+1.73205i, 2.} To get only the real roots, Select[r/.Solve[f[r,Pi]==0], And[Im[#] == 0, Re[#] >= 0]&] which now returns the list {0., 2.} Figure 5.1: Region of absolute stability for second-order Taylor series methods. Numerical solutions with hλ that fall inside this region are absolutely stable Putting the whole plotting algorithm together, the following will plot 100 points on the solution. points = {}; Cartesian[{r , theta }] := {r*Cos[theta], r*Sin[theta]}; For[theta = 0, theta = 0]&]; c○2007, B.E.Shapiro Last revised: May 23, 2007 Math 582B, Spring 2007 California State University Northridge
- 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
- Page 79 and 80: CHAPTER 4. IMPROVING ON EULER’S M
- Page 81 and 82: CHAPTER 4. IMPROVING ON EULER’S M
- Page 83 and 84: CHAPTER 4. IMPROVING ON EULER’S M
- Page 85 and 86: CHAPTER 4. IMPROVING ON EULER’S M
- Page 87 and 88: CHAPTER 4. IMPROVING ON EULER’S M
- Page 89 and 90: CHAPTER 4. IMPROVING ON EULER’S M
- Page 91 and 92: CHAPTER 4. IMPROVING ON EULER’S M
- Page 93 and 94: CHAPTER 4. IMPROVING ON EULER’S M
- Page 95: Chapter 5 Runge-Kutta Methods 5.1 T
- Page 99 and 100: CHAPTER 5. RUNGE-KUTTA METHODS 93 w
- Page 101 and 102: CHAPTER 5. RUNGE-KUTTA METHODS 95 5
- Page 103 and 104: CHAPTER 5. RUNGE-KUTTA METHODS 97 F
- Page 105 and 106: CHAPTER 5. RUNGE-KUTTA METHODS 99 T
- Page 107 and 108: CHAPTER 5. RUNGE-KUTTA METHODS 101
- Page 109 and 110: CHAPTER 5. RUNGE-KUTTA METHODS 103
- Page 111 and 112: CHAPTER 5. RUNGE-KUTTA METHODS 105
- Page 113 and 114: CHAPTER 5. RUNGE-KUTTA METHODS 107
- Page 115 and 116: CHAPTER 5. RUNGE-KUTTA METHODS 109
- Page 117 and 118: CHAPTER 5. RUNGE-KUTTA METHODS 111
- Page 119 and 120: CHAPTER 5. RUNGE-KUTTA METHODS 113
- Page 121 and 122: CHAPTER 5. RUNGE-KUTTA METHODS 115
- Page 123 and 124: Chapter 6 Linear Multistep Methods
- Page 125 and 126: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 127 and 128: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 129 and 130: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 131 and 132: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 133 and 134: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 135 and 136: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 137 and 138: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 139 and 140: CHAPTER 6. LINEAR MULTISTEP METHODS
- Page 141 and 142: Chapter 7 Delay Differential Equati
- Page 143 and 144: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
- Page 145 and 146: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
90 CHAPTER 5. RUNGE-KUTTA METHODS<br />
error of h p . We also observe that O(h) Taylor method is equivalent to Euler’s<br />
method.<br />
<strong>The</strong> second order Taylor method has<br />
y n = y n−1 + hf + h2<br />
2 (f t + f y f) (5.11)<br />
For the test equation y ′ = λy we have f = λy, f t = 0, f y = λ, and hence<br />
y n = y n−1 + hλy n + h2<br />
2 λ2 y n (5.12)<br />
)<br />
=<br />
(1 + hλ + (hλ)2 y n−1 (5.13)<br />
2<br />
Absolute stability occurs when<br />
∣ y n ∣∣∣ (hλ)2<br />
∣ =<br />
y n−1<br />
∣1 + hλ + 2 ∣ ≤ 1 (5.14)<br />
To find the shape of this region, set z = hλ = re iθ , and square both sides of equation<br />
5.14 using the identity |z| 2 = zz∗ to get<br />
(1 + re iθ + r2 e 2iθ ) (1 + re −iθ + r2 e −2iθ )<br />
≤ 1 (5.15)<br />
2<br />
2<br />
1 + re −iθ + r2 e −2iθ<br />
+ re iθ + r 2 + r 3 e −iθ r2 e 2iθ<br />
2<br />
2<br />
( e −iθ + e iθ )<br />
2r<br />
+ r 2 e−2iθ + e 2iθ<br />
+ r 3 e−iθ + e iθ<br />
2<br />
2<br />
2<br />
+ r 3 e iθ + r4<br />
4 ≤ 1 (5.16)<br />
+ r 2 + r4<br />
4 ≤ 0 (5.17)<br />
2r cos θ + r 2 cos 2θ + r 3 cos θ + r 2 + r4<br />
4 ≤ 0 (5.18)<br />
To plot this equation pick some small interval δθ and do the following:<br />
• Set θ = 0<br />
• Repeat<br />
1. Set θ = θ + δθ<br />
2. Solve 5.18 for r, accepting only real solutions<br />
3. Plot the point (r, θ)<br />
until θ = 2π<br />
In Mathematica we can use Solve to find the solution of 5.18. For example, to find<br />
r(π),<br />
f[r , theta ] := 2r * Cos[theta] + r^2 * Cos[2*theta] + r^3 Cos[theta]<br />
+ 0.25* r^4 + r^2;<br />
Solve[f[r,Pi]==0]<br />
Math 582B, Spring 2007<br />
California State University Northridge<br />
c○2007, B.E.<strong>Shapiro</strong><br />
Last revised: May 23, 2007