Contents
xix
8.3.8 Incorporating Vaccination . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
8.3.9 Discontinuous Coefficients: A Vaccination Campaign . . . . 237
8.4 Oscillating 1D Systems: A Second Order ODE . . . . . . . . . . . . . . . . . 239
8.4.1 Derivation of a Simple Model . . . . . . . . . . . . . . . . . . . . . . . . 240
8.4.2 Numerical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
8.4.3 Programming the FE Scheme; the Special Case . . . . . . . . . . 242
8.4.4 A Magic Fix of the Numerical Method . . . . . . . . . . . . . . . . . 243
8.4.5 The Second-Order Runge-Kutta Method (or Heun’s
Method) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
8.4.6 Software for Solving ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . 249
8.4.7 The Fourth-Order Runge-Kutta Method . . . . . . . . . . . . . . . . 254
8.4.8 More Effects: Damping, Nonlinearity, and External
Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
8.4.9 Illustration of Linear Damping . . . . . . . . . . . . . . . . . . . . . . . . 260
8.4.10 Illustration of Linear Damping with Sinusoidal
Excitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
8.4.11 Spring-Mass System with Sliding Friction . . . . . . . . . . . . . . 264
8.4.12 A Finite Difference Method; Undamped, Linear Case . . . . 266
8.4.13 A Finite Difference Method; Linear Damping . . . . . . . . . . . 268
8.5 Rate of Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
8.5.1 Asymptotic Behavior of the Error . . . . . . . . . . . . . . . . . . . . . 270
8.5.2 Computing the Convergence Rate . . . . . . . . . . . . . . . . . . . . . 270
8.5.3 Test Function: Convergence Rates for the FE Solver . . . . . . 272
8.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
9 Solving Partial Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
9.1 Example: Temperature Development in a Rod . . . . . . . . . . . . . . . . . . 288
9.1.1 A Particular Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
9.2 Finite Difference Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
9.2.1 Reduction of a PDE to a System of ODEs . . . . . . . . . . . . . . 290
9.2.2 Construction of a Test Problem with Known Discrete
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
9.2.3 Implementation: Forward Euler Method . . . . . . . . . . . . . . . . 293
9.2.4 Animation: Heat Conduction in a Rod . . . . . . . . . . . . . . . . . 295
9.2.5 Vectorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
9.2.6 Using Odespy to Solve the System of ODEs . . . . . . . . . . . . 299
9.2.7 Implicit Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
9.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
A Installation and Use of Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
A.1 Recommendation: Install Anaconda and Odespy . . . . . . . . . . . . . . . . 311
A.2 Required Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
A.3 Anaconda and Spyder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
A.3.1 Spyder on Mac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
A.3.2 Installation of Additional Packages . . . . . . . . . . . . . . . . . . . . 313
A.4 How to Write and Run a Python Program . . . . . . . . . . . . . . . . . . . . . . 314
A.4.1 Spyder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
A.4.2 Text Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Précédent

- 18/350

Suivant