|
|
1 | (92) |
|
1.1 Finite Difference Discretization |
|
|
1 | (3) |
|
1.1.1 A Basic Model for Vibrations |
|
|
1 | (1) |
|
1.1.2 A Centered Finite Difference Scheme |
|
|
2 | (2) |
|
|
4 | (7) |
|
1.2.1 Making a Solver Function |
|
|
4 | (2) |
|
|
6 | (4) |
|
|
10 | (1) |
|
1.3 Visualization of Long Time Simulations |
|
|
11 | (10) |
|
1.3.1 Using a Moving Plot Window |
|
|
11 | (2) |
|
|
13 | (2) |
|
1.3.3 Using Bokeh to Compare Graphs |
|
|
15 | (3) |
|
1.3.4 Using a Line-by-Line Ascii Plotter |
|
|
18 | (1) |
|
1.3.5 Empirical Analysis of the Solution |
|
|
19 | (2) |
|
1.4 Analysis of the Numerical Scheme |
|
|
21 | (8) |
|
1.4.1 Deriving a Solution of the Numerical Scheme |
|
|
21 | (1) |
|
1.4.2 The Error in the Numerical Frequency |
|
|
22 | (2) |
|
1.4.3 Empirical Convergence Rates and Adjusted ω |
|
|
24 | (1) |
|
1.4.4 Exact Discrete Solution |
|
|
24 | (1) |
|
|
24 | (1) |
|
|
25 | (1) |
|
|
26 | (1) |
|
1.4.8 About the Accuracy at the Stability Limit |
|
|
27 | (2) |
|
1.5 Alternative Schemes Based on 1st-Order Equations |
|
|
29 | (7) |
|
1.5.1 The Forward Euler Scheme |
|
|
29 | (1) |
|
1.5.2 The Backward Euler Scheme |
|
|
30 | (1) |
|
1.5.3 The Crank-Nicolson Scheme |
|
|
30 | (2) |
|
1.5.4 Comparison of Schemes |
|
|
32 | (1) |
|
1.5.5 Runge-Kutta Methods |
|
|
33 | (1) |
|
1.5.6 Analysis of the Forward Euler Scheme |
|
|
34 | (2) |
|
1.6 Energy Considerations |
|
|
36 | (4) |
|
1.6.1 Derivation of the Energy Expression |
|
|
36 | (2) |
|
1.6.2 An Error Measure Based on Energy |
|
|
38 | (2) |
|
1.7 The Euler-Cromer Method |
|
|
40 | (6) |
|
1.7.1 Forward-Backward Discretization |
|
|
40 | (2) |
|
1.7.2 Equivalence with the Scheme for the Second-Order ODE |
|
|
42 | (1) |
|
|
43 | (2) |
|
1.7.4 The Stormer-Verlet Algorithm |
|
|
45 | (1) |
|
|
46 | (4) |
|
1.8.1 The Euler-Cromer Scheme on a Staggered Mesh |
|
|
46 | (2) |
|
1.8.2 Implementation of the Scheme on a Staggered Mesh |
|
|
48 | (2) |
|
1.9 Exercises and Problems |
|
|
50 | (7) |
|
1.10 Generalization: Damping, Nonlinearities, and Excitation |
|
|
57 | (9) |
|
1.10.1 A Centered Scheme for Linear Damping |
|
|
57 | (1) |
|
1.10.2 A Centered Scheme for Quadratic Damping |
|
|
58 | (1) |
|
1.10.3 A Forward-Backward Discretization of the Quadratic Damping Term |
|
|
59 | (1) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
61 | (1) |
|
|
62 | (1) |
|
1.10.8 The Euler-Cromer Scheme for the Generalized Model |
|
|
63 | (1) |
|
1.10.9 The Stormer-Verlet Algorithm for the Generalized Model |
|
|
64 | (1) |
|
1.10.10 A Staggered Euler-Cromer Scheme for a Generalized Model |
|
|
64 | (1) |
|
1.10.11 The PEFRL 4th-Order Accurate Algorithm |
|
|
65 | (1) |
|
1.11 Exercises and Problems |
|
|
66 | (1) |
|
1.12 Applications of Vibration Models |
|
|
67 | (21) |
|
1.12.1 Oscillating Mass Attached to a Spring |
|
|
67 | (2) |
|
1.12.2 General Mechanical Vibrating System |
|
|
69 | (1) |
|
1.12.3 A Sliding Mass Attached to a Spring |
|
|
70 | (1) |
|
1.12.4 A Jumping Washing Machine |
|
|
71 | (1) |
|
1.12.5 Motion of a Pendulum |
|
|
71 | (3) |
|
1.12.6 Dynamic Free Body Diagram During Pendulum Motion |
|
|
74 | (5) |
|
1.12.7 Motion of an Elastic Pendulum |
|
|
79 | (4) |
|
1.12.8 Vehicle on a Bumpy Road |
|
|
83 | (2) |
|
|
85 | (1) |
|
1.12.10 Two-Body Gravitational Problem |
|
|
85 | (3) |
|
1.12.11 Electric Circuits |
|
|
88 | (1) |
|
|
88 | (5) |
|
|
93 | (114) |
|
2.1 Simulation of Waves on a String |
|
|
93 | (6) |
|
2.1.1 Discretizing the Domain |
|
|
94 | (1) |
|
2.1.2 The Discrete Solution |
|
|
94 | (1) |
|
2.1.3 Fulfilling the Equation at the Mesh Points |
|
|
94 | (1) |
|
2.1.4 Replacing Derivatives by Finite Differences |
|
|
95 | (1) |
|
2.1.5 Formulating a Recursive Algorithm |
|
|
96 | (2) |
|
2.1.6 Sketch of an Implementation |
|
|
98 | (1) |
|
|
99 | (5) |
|
2.2.1 A Slightly Generalized Model Problem |
|
|
99 | (1) |
|
2.2.2 Using an Analytical Solution of Physical Significance |
|
|
99 | (1) |
|
2.2.3 Manufactured Solution and Estimation of Convergence Rates |
|
|
100 | (2) |
|
2.2.4 Constructing an Exact Solution of the Discrete Equations |
|
|
102 | (2) |
|
|
104 | (10) |
|
2.3.1 Callback Function for User-Specific Actions |
|
|
104 | (1) |
|
2.3.2 The Solver Function |
|
|
105 | (1) |
|
2.3.3 Verification: Exact Quadratic Solution |
|
|
106 | (1) |
|
2.3.4 Verification: Convergence Rates |
|
|
107 | (1) |
|
2.3.5 Visualization: Animating the Solution |
|
|
108 | (4) |
|
|
112 | (1) |
|
2.3.7 Working with a Scaled PDE Model |
|
|
113 | (1) |
|
|
114 | (8) |
|
2.4.1 Operations on Slices of Arrays |
|
|
115 | (2) |
|
2.4.2 Finite Difference Schemes Expressed as Slices |
|
|
117 | (1) |
|
|
118 | (1) |
|
2.4.4 Efficiency Measurements |
|
|
119 | (2) |
|
2.4.5 Remark on the Updating of Arrays |
|
|
121 | (1) |
|
|
122 | (3) |
|
2.6 Generalization: Reflecting Boundaries |
|
|
125 | (10) |
|
2.6.1 Neumann Boundary Condition |
|
|
126 | (1) |
|
2.6.2 Discretization of Derivatives at the Boundary |
|
|
126 | (1) |
|
2.6.3 Implementation of Neumann Conditions |
|
|
127 | (1) |
|
|
128 | (2) |
|
2.6.5 Verifying the Implementation of Neumann Conditions |
|
|
130 | (2) |
|
2.6.6 Alternative Implementation via Ghost Cells |
|
|
132 | (3) |
|
2.7 Generalization: Variable Wave Velocity |
|
|
135 | (6) |
|
2.7.1 The Model PDE with a Variable Coefficient |
|
|
135 | (1) |
|
2.7.2 Discretizing the Variable Coefficient |
|
|
136 | (1) |
|
2.7.3 Computing the Coefficient Between Mesh Points |
|
|
137 | (1) |
|
2.7.4 How a Variable Coefficient Affects the Stability |
|
|
138 | (1) |
|
2.7.5 Neumann Condition and a Variable Coefficient |
|
|
138 | (1) |
|
2.7.6 Implementation of Variable Coefficients |
|
|
139 | (1) |
|
2.7.7 A More General PDE Model with Variable Coefficients |
|
|
140 | (1) |
|
2.7.8 Generalization: Damping |
|
|
140 | (1) |
|
2.8 Building a General 1D Wave Equation Solver |
|
|
141 | (7) |
|
2.8.1 User Action Function as a Class |
|
|
142 | (2) |
|
2.8.2 Pulse Propagation in Two Media |
|
|
144 | (4) |
|
|
148 | (7) |
|
2.10 Analysis of the Difference Equations |
|
|
155 | (12) |
|
2.10.1 Properties of the Solution of the Wave Equation |
|
|
155 | (2) |
|
2.10.2 More Precise Definition of Fourier Representations |
|
|
157 | (1) |
|
|
158 | (2) |
|
2.10.4 Numerical Dispersion Relation |
|
|
160 | (3) |
|
2.10.5 Extending the Analysis to 2D and 3D |
|
|
163 | (4) |
|
2.11 Finite Difference Methods for 2D and 3D Wave Equations |
|
|
167 | (4) |
|
2.11.1 Multi-Dimensional Wave Equations |
|
|
167 | (1) |
|
|
168 | (1) |
|
|
169 | (2) |
|
|
171 | (10) |
|
2.12.1 Scalar Computations |
|
|
172 | (2) |
|
2.12.2 Vectorized Computations |
|
|
174 | (2) |
|
|
176 | (1) |
|
|
177 | (4) |
|
|
181 | (2) |
|
2.14 Applications of Wave Equations |
|
|
183 | (12) |
|
|
183 | (3) |
|
2.14.2 Elastic Waves in a Rod |
|
|
186 | (1) |
|
2.14.3 Waves on a Membrane |
|
|
186 | (1) |
|
2.14.4 The Acoustic Model for Seismic Waves |
|
|
186 | (2) |
|
2.14.5 Sound Waves in Liquids and Gases |
|
|
188 | (1) |
|
|
189 | (1) |
|
2.14.7 The Linear Shallow Water Equations |
|
|
190 | (2) |
|
2.14.8 Waves in Blood Vessels |
|
|
192 | (2) |
|
2.14.9 Electromagnetic Waves |
|
|
194 | (1) |
|
|
195 | (12) |
|
|
207 | (116) |
|
3.1 An Explicit Method for the 1D Diffusion Equation |
|
|
208 | (10) |
|
3.1.1 The Initial-Boundary Value Problem for 1D Diffusion |
|
|
208 | (1) |
|
3.1.2 Forward Euler Scheme |
|
|
208 | (2) |
|
|
210 | (2) |
|
|
212 | (3) |
|
3.1.5 Numerical Experiments |
|
|
215 | (3) |
|
3.2 Implicit Methods for the 1D Diffusion Equation |
|
|
218 | (11) |
|
3.2.1 Backward Euler Scheme |
|
|
219 | (4) |
|
3.2.2 Sparse Matrix Implementation |
|
|
223 | (1) |
|
3.2.3 Crank-Nicolson Scheme |
|
|
224 | (2) |
|
3.2.4 The Unifying θ Rule |
|
|
226 | (1) |
|
|
227 | (1) |
|
3.2.6 The Laplace and Poisson Equation |
|
|
227 | (2) |
|
3.3 Analysis of Schemes for the Diffusion Equation |
|
|
229 | (13) |
|
3.3.1 Properties of the Solution |
|
|
229 | (4) |
|
3.3.2 Analysis of Discrete Equations |
|
|
233 | (1) |
|
3.3.3 Analysis of the Finite Difference Schemes |
|
|
233 | (1) |
|
3.3.4 Analysis of the Forward Euler Scheme |
|
|
234 | (2) |
|
3.3.5 Analysis of the Backward Euler Scheme |
|
|
236 | (1) |
|
3.3.6 Analysis of the Crank-Nicolson Scheme |
|
|
237 | (1) |
|
3.3.7 Analysis of the Leapfrog Scheme |
|
|
237 | (1) |
|
3.3.8 Summary of Accuracy of Amplification Factors |
|
|
238 | (1) |
|
3.3.9 Analysis of the 2D Diffusion Equation |
|
|
239 | (2) |
|
3.3.10 Explanation of Numerical Artifacts |
|
|
241 | (1) |
|
|
242 | (3) |
|
3.5 Diffusion in Heterogeneous Media |
|
|
245 | (9) |
|
|
245 | (1) |
|
|
246 | (1) |
|
3.5.3 Stationary Solution |
|
|
247 | (1) |
|
3.5.4 Piecewise Constant Medium |
|
|
247 | (1) |
|
3.5.5 Implementation of Diffusion in a Piecewise Constant Medium |
|
|
248 | (3) |
|
3.5.6 Axi-Symmetric Diffusion |
|
|
251 | (1) |
|
3.5.7 Spherically-Symmetric Diffusion |
|
|
252 | (2) |
|
|
254 | (33) |
|
|
254 | (1) |
|
3.6.2 Numbering of Mesh Points Versus Equations and Unknowns |
|
|
255 | (4) |
|
3.6.3 Algorithm for Setting Up the Coefficient Matrix |
|
|
259 | (1) |
|
3.6.4 Implementation with a Dense Coefficient Matrix |
|
|
260 | (4) |
|
3.6.5 Verification: Exact Numerical Solution |
|
|
264 | (1) |
|
3.6.6 Verification: Convergence Rates |
|
|
265 | (1) |
|
3.6.7 Implementation with a Sparse Coefficient Matrix |
|
|
266 | (4) |
|
3.6.8 The Jacobi Iterative Method |
|
|
270 | (3) |
|
3.6.9 Implementation of the Jacobi Method |
|
|
273 | (1) |
|
3.6.10 Test Problem: Diffusion of a Sine Hill |
|
|
274 | (2) |
|
3.6.11 The Relaxed Jacobi Method and Its Relation to the Forward Euler Method |
|
|
276 | (1) |
|
3.6.12 The Gauss-Seidel and SOR Methods |
|
|
277 | (1) |
|
3.6.13 Scalar Implementation of the SOR Method |
|
|
277 | (1) |
|
3.6.14 Vectorized Implementation of the SOR Method |
|
|
278 | (4) |
|
3.6.15 Direct Versus Iterative Methods |
|
|
282 | (3) |
|
3.6.16 The Conjugate Gradient Method |
|
|
285 | (2) |
|
3.6.17 What Is the Recommended Method for Solving Linear Systems? |
|
|
287 | (1) |
|
|
287 | (21) |
|
|
288 | (1) |
|
3.7.2 Statistical Considerations |
|
|
288 | (2) |
|
3.7.3 Playing Around with Some Code |
|
|
290 | (3) |
|
3.7.4 Equivalence with Diffusion |
|
|
293 | (1) |
|
3.7.5 Implementation of Multiple Walks |
|
|
294 | (6) |
|
3.7.6 Demonstration of Multiple Walks |
|
|
300 | (1) |
|
3.7.7 Ascii Visualization of 1D Random Walk |
|
|
300 | (3) |
|
3.7.8 Random Walk as a Stochastic Equation |
|
|
303 | (1) |
|
|
304 | (1) |
|
3.7.10 Random Walk in Any Number of Space Dimensions |
|
|
305 | (2) |
|
3.7.11 Multiple Random Walks in Any Number of Space Dimensions |
|
|
307 | (1) |
|
|
308 | (8) |
|
3.8.1 Diffusion of a Substance |
|
|
308 | (1) |
|
|
309 | (3) |
|
|
312 | (1) |
|
3.8.4 Potential Fluid Flow |
|
|
312 | (1) |
|
3.8.5 Streamlines for 2D Fluid Flow |
|
|
313 | (1) |
|
3.8.6 The Potential of an Electric Field |
|
|
313 | (1) |
|
3.8.7 Development of Flow Between Two Flat Plates |
|
|
313 | (1) |
|
3.8.8 Flow in a Straight Tube |
|
|
314 | (1) |
|
3.8.9 Tribology: Thin Film Fluid Flow |
|
|
315 | (1) |
|
3.8.10 Propagation of Electrical Signals in the Brain |
|
|
316 | (1) |
|
|
316 | (7) |
|
4 Advection-Dominated Equations |
|
|
323 | (30) |
|
4.1 One-Dimensional Time-Dependent Advection Equations |
|
|
323 | (21) |
|
4.1.1 Simplest Scheme: Forward in Time, Centered in Space |
|
|
324 | (3) |
|
4.1.2 Analysis of the Scheme |
|
|
327 | (1) |
|
4.1.3 Leapfrog in Time, Centered Differences in Space |
|
|
328 | (3) |
|
4.1.4 Upwind Differences in Space |
|
|
331 | (2) |
|
4.1.5 Periodic Boundary Conditions |
|
|
333 | (1) |
|
|
333 | (4) |
|
4.1.7 A Crank-Nicolson Discretization in Time and Centered Differences in Space |
|
|
337 | (2) |
|
4.1.8 The Lax-Wendroff Method |
|
|
339 | (1) |
|
4.1.9 Analysis of Dispersion Relations |
|
|
340 | (4) |
|
4.2 One-Dimensional Stationary Advection-Diffusion Equation |
|
|
344 | (5) |
|
4.2.1 A Simple Model Problem |
|
|
344 | (1) |
|
4.2.2 A Centered Finite Difference Scheme |
|
|
345 | (2) |
|
4.2.3 Remedy: Upwind Finite Difference Scheme |
|
|
347 | (2) |
|
4.3 Time-dependent Convection-Diffusion Equations |
|
|
349 | (1) |
|
4.3.1 Forward in Time, Centered in Space Scheme |
|
|
349 | (1) |
|
4.3.2 Forward in Time, Upwind in Space Scheme |
|
|
349 | (1) |
|
4.4 Applications of Advection Equations |
|
|
350 | (1) |
|
4.4.1 Transport of a Substance |
|
|
350 | (1) |
|
4.4.2 Transport of Heat in Fluids |
|
|
350 | (1) |
|
|
351 | (2) |
|
|
353 | (56) |
|
5.1 Introduction of Basic Concepts |
|
|
353 | (15) |
|
5.1.1 Linear Versus Nonlinear Equations |
|
|
353 | (1) |
|
5.1.2 A Simple Model Problem |
|
|
354 | (1) |
|
5.1.3 Linearization by Explicit Time Discretization |
|
|
355 | (1) |
|
5.1.4 Exact Solution of Nonlinear Algebraic Equations |
|
|
356 | (1) |
|
|
357 | (1) |
|
|
357 | (2) |
|
5.1.7 Linearization by a Geometric Mean |
|
|
359 | (1) |
|
|
360 | (1) |
|
|
361 | (1) |
|
5.1.10 Implementation and Experiments |
|
|
362 | (3) |
|
5.1.11 Generalization to a General Nonlinear ODE |
|
|
365 | (2) |
|
|
367 | (1) |
|
5.2 Systems of Nonlinear Algebraic Equations |
|
|
368 | (5) |
|
|
369 | (1) |
|
|
369 | (2) |
|
|
371 | (1) |
|
5.2.4 Example: A Nonlinear ODE Model from Epidemiology |
|
|
372 | (1) |
|
5.3 Linearization at the Differential Equation Level |
|
|
373 | (5) |
|
5.3.1 Explicit Time Integration |
|
|
373 | (1) |
|
5.3.2 Backward Euler Scheme and Picard Iteration |
|
|
374 | (1) |
|
5.3.3 Backward Euler Scheme and Newton's Method |
|
|
375 | (2) |
|
5.3.4 Crank-Nicolson Discretization |
|
|
377 | (1) |
|
5.4 1D Stationary Nonlinear Differential Equations |
|
|
378 | (6) |
|
5.4.1 Finite Difference Discretization |
|
|
378 | (1) |
|
5.4.2 Solution of Algebraic Equations |
|
|
379 | (5) |
|
5.5 Multi-Dimensional Nonlinear PDE Problems |
|
|
384 | (3) |
|
5.5.1 Finite Difference Discretization |
|
|
384 | (2) |
|
5.5.2 Continuation Methods |
|
|
386 | (1) |
|
5.6 Operator Splitting Methods |
|
|
387 | (14) |
|
5.6.1 Ordinary Operator Splitting for ODEs |
|
|
387 | (1) |
|
5.6.2 Strang Splitting for ODEs |
|
|
388 | (1) |
|
5.6.3 Example: Logistic Growth |
|
|
388 | (3) |
|
5.6.4 Reaction-Diffusion Equation |
|
|
391 | (1) |
|
5.6.5 Example: Reaction-Diffusion with Linear Reaction Term |
|
|
392 | (8) |
|
5.6.6 Analysis of the Splitting Method |
|
|
400 | (1) |
|
|
401 | (8) |
|
|
409 | (6) |
|
A.1 Finite Difference Operator Notation |
|
|
409 | (1) |
|
A.2 Truncation Errors of Finite Difference Approximations |
|
|
410 | (1) |
|
A.3 Finite Differences of Exponential Functions |
|
|
411 | (1) |
|
A.4 Finite Differences of tn |
|
|
411 | (4) |
|
|
412 | (3) |
|
B Truncation Error Analysis |
|
|
415 | (36) |
|
B.1 Overview of Truncation Error Analysis |
|
|
415 | (2) |
|
B.1.1 Abstract Problem Setting |
|
|
415 | (1) |
|
|
416 | (1) |
|
B.2 Truncation Errors in Finite Difference Formulas |
|
|
417 | (5) |
|
B.2.1 Example: The Backward Difference for u'(t) |
|
|
417 | (1) |
|
B.2.2 Example: The Forward Difference for u'(t) |
|
|
418 | (1) |
|
B.2.3 Example: The Central Difference for u'(t) |
|
|
419 | (1) |
|
B.2.4 Overview of Leading-Order Error Terms in Finite Difference Formulas |
|
|
420 | (1) |
|
B.2.5 Software for Computing Truncation Errors |
|
|
421 | (1) |
|
B.3 Exponential Decay ODEs |
|
|
422 | (12) |
|
B.3.1 Forward Euler Scheme |
|
|
422 | (1) |
|
B.3.2 Crank-Nicolson Scheme |
|
|
423 | (1) |
|
|
424 | (1) |
|
B.3.4 Using Symbolic Software |
|
|
424 | (1) |
|
B.3.5 Empirical Verification of the Truncation Error |
|
|
425 | (5) |
|
B.3.6 Increasing the Accuracy by Adding Correction Terms |
|
|
430 | (2) |
|
B.3.7 Extension to Variable Coefficients |
|
|
432 | (2) |
|
B.3.8 Exact Solutions of the Finite Difference Equations 433 B.3.9 Computing Truncation Errors in Nonlinear Problems |
|
|
434 | (1) |
|
|
434 | (6) |
|
B.4.1 Linear Model Without Damping |
|
|
434 | (3) |
|
B.4.2 Model with Damping and Nonlinearity |
|
|
437 | (1) |
|
B.4.3 Extension to Quadratic Damping |
|
|
438 | (1) |
|
B.4.4 The General Model Formulated as First-Order ODEs |
|
|
439 | (1) |
|
|
440 | (5) |
|
B.5.1 Linear Wave Equation in 1D |
|
|
440 | (1) |
|
B.5.2 Finding Correction Terms |
|
|
441 | (1) |
|
B.5.3 Extension to Variable Coefficients |
|
|
442 | (2) |
|
B.5.4 Linear Wave Equation in 2D/3D |
|
|
444 | (1) |
|
|
445 | (2) |
|
B.6.1 Linear Diffusion Equation in 1D |
|
|
445 | (1) |
|
B.6.2 Nonlinear Diffusion Equation in 1D |
|
|
446 | (1) |
|
|
447 | (4) |
|
C Software Engineering; Wave Equation Model |
|
|
451 | (42) |
|
C.1 A 1D Wave Equation Simulator |
|
|
451 | (4) |
|
|
451 | (1) |
|
C.1.2 Numerical Discretization |
|
|
451 | (1) |
|
|
452 | (3) |
|
C.2 Saving Large Arrays in Files |
|
|
455 | (4) |
|
C.2.1 Using savez to Store Arrays in Files |
|
|
455 | (2) |
|
C.2.2 Using joblib to Store Arrays in Files |
|
|
457 | (1) |
|
C.2.3 Using a Hash to Create a File or Directory Name |
|
|
458 | (1) |
|
C.3 Software for the 1D Wave Equation |
|
|
459 | (3) |
|
C.3.1 Making Hash Strings from Input Data |
|
|
460 | (1) |
|
C.3.2 Avoiding Rerunning Previously Run Cases |
|
|
460 | (1) |
|
|
461 | (1) |
|
C.4 Programming the Solver with Classes |
|
|
462 | (13) |
|
|
463 | (2) |
|
|
465 | (1) |
|
|
465 | (3) |
|
|
468 | (3) |
|
|
471 | (4) |
|
C.5 Migrating Loops to Cython |
|
|
475 | (5) |
|
C.5.1 Declaring Variables and Annotating the Code |
|
|
476 | (2) |
|
C.5.2 Visual Inspection of the C Translation |
|
|
478 | (1) |
|
C.5.3 Building the Extension Module |
|
|
479 | (1) |
|
C.5.4 Calling the Cython Function from Python |
|
|
480 | (1) |
|
C.6 Migrating Loops to Fortran |
|
|
480 | (5) |
|
C.6.1 The Fortran Subroutine |
|
|
481 | (1) |
|
C.6.2 Building the Fortran Module with f2py |
|
|
482 | (1) |
|
C.6.3 How to Avoid Array Copying |
|
|
483 | (2) |
|
C.7 Migrating Loops to C via Cython |
|
|
485 | (3) |
|
C.7.1 Translating Index Pairs to Single Indices |
|
|
485 | (1) |
|
C.7.2 The Complete C Code |
|
|
486 | (1) |
|
C.7.3 The Cython Interface File |
|
|
486 | (1) |
|
C.7.4 Building the Extension Module |
|
|
487 | (1) |
|
C.8 Migrating Loops to C via f2py |
|
|
488 | (2) |
|
C.8.1 Migrating Loops to C++ via f2py |
|
|
489 | (1) |
|
|
490 | (3) |
References |
|
493 | (2) |
Index |
|
495 | |