The Computable Differential Equation Lecture ... - Bruce E. Shapiro
The Computable Differential Equation Lecture ... - Bruce E. Shapiro The Computable Differential Equation Lecture ... - Bruce E. Shapiro
182 CHAPTER 9. DIFFERENTIAL ALGEBRAIC EQUATIONS In practice it is better not to compute the inverse, but instead to use a linear solver to compute the update, however, this program is for illustrative purposes and the inverse is sufficient. Finally, we can implement the solver. Of course we also need to give values to the parameters α, β, γ. {A n , B n , X n , e n } = {1, 0, 0, 1}; h = 0.01; α=10; β=γ=1; data = {{0, A n , B n , X n , e n }}; For[t = 0, t < 3, t += h, {A n , B n ,X n , e n } = nextStep[h, {A n , B n , X n , e n }]; data = Append[data, {t+h, A n , B n , X n , e n }]; ]; This will generate a table of values of ordered sets of values {{t 0 , A 0 , B 0 , X 0 , e 0 }, {t 1 , A 1 , B 1 , X 1 , e 1 }, . . . at each of the mesh points. To see the data we could type TableForm[data] Mathematica would respond with (only some of the data is shown): 0 1 0 0 1 0.01 0.916713 0.0824626 0.000824626 0.917537 0.02 0.84639 0.151273 0.00233735 0.0848727 . etc To plot all the curves on a single graph using ListPlot we write the function plotDataTable, plotDataTable[d ,styles ] := Module[{nvars, makedata, plt, data, plots}, nvars = Length[d[[1]]] - 1; data = Transpose[d]; makedata[i ] := {data[[1]], data[[i + 1]]}; plt[i ] := ListPlot[makedata[i] Transpose, PlotJoined -> True, PlotStyle -> styles[[i]], DisplayFunction -> Identity]; plots = plt /@ Range[nvars]; Show[plots, DisplayFunction -> $DisplayFunction]; ] The to actually generate the plot, plotDataTable[data, {{Red, Dashing[{.006, 0.008}]}, {Blue, Thickness[.006], Dashing[{0.01}]}, {Green, Thickness[.005]}, Purple}] Math 582B, Spring 2007 California State University Northridge c○2007, B.E.Shapiro Last revised: May 23, 2007
CHAPTER 9. DIFFERENTIAL ALGEBRAIC EQUATIONS 183 Each curve will be plotted in its own style: the first column of data (A) as a thin, dashed, red line; the second (B) as a thick blue dashed line; the third (X) as a thick green line; and the forth (e) as a thin purple line: The figure shows how all of the substrate (A, thin, red, dashed curve) is eventually converted to the product (B, thick green). The concentration of enzyme dips, and the concentration of intermediate (X, thick blue dashes) while the conversion is taking place, but as the process reaches completion they return to their steady state values. Unfortunately, the simple process of writing 0 = F ( t n , y n , y ) n − y n−1 h (9.164) (or using any other discretization method besides backwards Euler) does not always work. For some equations, it is even possible to find any discretization formula at all. Consider, for example, the index-2 differential-algebraic equation The exact solution is x ′ − ty ′ = 0 (9.165) x − ty = f(t) (9.166) x = f(t) − tf ′ (t) (9.167) y = −f ′ (t) (9.168) which may be verified by substitution. Backward Euler gives the formulas x n − x n−1 h − t n y n − y n−1 h = 0 (9.169) x n − t n y n = f(t n ) (9.170) c○2007, B.E.Shapiro Last revised: May 23, 2007 Math 582B, Spring 2007 California State University Northridge
- 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
- Page 147 and 148: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
- Page 149 and 150: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
- Page 151 and 152: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
- Page 153 and 154: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
- Page 155 and 156: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
- Page 157 and 158: CHAPTER 7. DELAY DIFFERENTIAL EQUAT
- Page 159 and 160: Chapter 8 Boundary Value Problems 8
- Page 161 and 162: CHAPTER 8. BOUNDARY VALUE PROBLEMS
- Page 163 and 164: CHAPTER 8. BOUNDARY VALUE PROBLEMS
- Page 165 and 166: CHAPTER 8. BOUNDARY VALUE PROBLEMS
- Page 167 and 168: CHAPTER 8. BOUNDARY VALUE PROBLEMS
- Page 169 and 170: CHAPTER 8. BOUNDARY VALUE PROBLEMS
- Page 171 and 172: CHAPTER 8. BOUNDARY VALUE PROBLEMS
- Page 173 and 174: Chapter 9 Differential Algebraic Eq
- Page 175 and 176: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 177 and 178: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 179 and 180: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 181 and 182: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 183 and 184: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 185 and 186: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 187: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 191 and 192: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 193 and 194: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 195 and 196: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 197 and 198: CHAPTER 9. DIFFERENTIAL ALGEBRAIC E
- Page 199 and 200: Chapter 10 Appendix on Analytic Met
- Page 201 and 202: CHAPTER 10. APPENDIX ON ANALYTIC ME
- Page 203 and 204: CHAPTER 10. APPENDIX ON ANALYTIC ME
- Page 205 and 206: Bibliography [1] Ascher, Uri M., Ma
CHAPTER 9. DIFFERENTIAL ALGEBRAIC EQUATIONS 183<br />
Each curve will be plotted in its own style: the first column of data (A) as a thin,<br />
dashed, red line; the second (B) as a thick blue dashed line; the third (X) as a thick<br />
green line; and the forth (e) as a thin purple line:<br />
<strong>The</strong> figure shows how all of the substrate (A, thin, red, dashed curve) is eventually<br />
converted to the product (B, thick green). <strong>The</strong> concentration of enzyme dips, and<br />
the concentration of intermediate (X, thick blue dashes) while the conversion is<br />
taking place, but as the process reaches completion they return to their steady state<br />
values.<br />
Unfortunately, the simple process of writing<br />
0 = F<br />
(<br />
t n , y n , y )<br />
n − y n−1<br />
h<br />
(9.164)<br />
(or using any other discretization method besides backwards Euler) does not always<br />
work. For some equations, it is even possible to find any discretization formula at<br />
all. Consider, for example, the index-2 differential-algebraic equation<br />
<strong>The</strong> exact solution is<br />
x ′ − ty ′ = 0 (9.165)<br />
x − ty = f(t) (9.166)<br />
x = f(t) − tf ′ (t) (9.167)<br />
y = −f ′ (t) (9.168)<br />
which may be verified by substitution. Backward Euler gives the formulas<br />
x n − x n−1<br />
h<br />
− t n<br />
y n − y n−1<br />
h<br />
= 0 (9.169)<br />
x n − t n y n = f(t n ) (9.170)<br />
c○2007, B.E.<strong>Shapiro</strong><br />
Last revised: May 23, 2007<br />
Math 582B, Spring 2007<br />
California State University Northridge