a first course in computational physics - gbv

5
A First Course in Computational Physics Paul L. DeVries Miami University Oxford, Ohio ® JOHN WILEY & SONS, INC. NEW YORK CHICHESTER BRISBANE TORONTO SINGAPORE

Upload: others

Post on 28-Jan-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

A First Course

in Computational

Physics

Paul L. DeVries

Miami University

Oxford, Ohio

® JOHN WILEY & SONS, INC.

NEW YORK • CHICHESTER • BRISBANE • TORONTO • SINGAPORE

Contents

Chapter 1: Introduction 1 FORTRAN — the Computer Language of Science 2 Getting Started 3 Running the Program 5 A Numerical Example 8 Code Fragments 11 A Brief Guide to Good Programming 13 Debugging and Testing 19 A Cautionary Note 20 Elementary Computer Graphics 21 And in Living Color! 26 Classic Curves 27 Monster Curves 29 The Mandelbrot Set 33 References 39

Chapter 2: Functions and Roots Finding the Roots of a Function 41 Mr. Taylor's Series 51 The Newton-Raphson Method 54 Fools Rush In ... 58 Rates of Convergence 60 Exhaustive Searching 66 Look, Ma, No Derivatives! 67 Accelerating the Rate of Convergence A Little Quantum Mechanics Problem Computing Strategy 79 References 85

Chapter 3: Interpolation and Approximation 86 Lagrange Interpolation 86 The Airy Pattern 89 Hermite Interpolation 93

71 74

Contents

Cubic Splines 95 Tridiagonal Linear Systems 99 Cubic Spline Interpolation 103 Approximation of Derivatives 108 Richardson Extrapolation 113 Curve Fitting by Least Squares 117 Gaussi an Elimination 119 General Least Squares Fitting 131 Least Squares and Orthogonal Polynomials 134 Nonlinear Least Squares 138 References 148

Chapter 4: Numerical Integration Anaxagoras of Clazomenae 149 -̂ Primitive Integration Formulas 150 Composite Formulas 152 Errors... and Corrections 153 Romberg Integration 155 Diffraction at a Knife's Edge 157 A Change of Variables 157 The "Simple" Pendulum 160 Improper Integrals 164 The Mathematical Magic of Gauss 169 Orthogonal Polynomials 171 Gaussian Integration 173 Composite Rules 180 Gauss-Laguerre Quadrature 180 Multidimensional Numerical Integration 183 Other Integration Domains 186 A Little Physics Problem 188 More on Orthogonal Polynomials 189 Monte Carlo Integration 191 Monte Carlo Simulations 200 References 206

Chapter 5: Ordinary Differential Equations Euler Methods 208 Constants of the Motion 212 Runge-Kutta Methods 215 Adaptive Step Sizes 218 Runge-Kutta-Fehlberg 219 Second Order Differential Equations 226

Contents xi

The Van der Pol Oscillator 230 Phase Space 231 The Finite Amplitude Pendulum 233 The Animated Pendulum 234 Another Little Quantum Mechanics Problem 236 Several Dependent Variables 241 Shoot the Moon 242 Finite Differences 245 SOR 250 Discretisation Error 250 A Vibrating String 254 Eigenvalues via Finite Differences 257 The Power Method 260 Eigenvectors 262 Finite Elements 265 An Eigenvalue Problem 271 References 278

Chapter 6: Fourier Analysis \ 280 The Fourier Series 280 The Fourier Transform 284 Properties of the Fourier Transform 286 Convolution and Correlation 294 Ranging 304 The Discrete Fourier Transform 309 The Fast Fourier Transform 312 Life in the Fast Lane 316 Spectrum Analysis 319 The Duffing Oscillator 324 Computerized Tomography 325 References 338

Chapter 7: Partial Differential Equations 340 Classes of Partial Differential Equations 340 The Vibrating String... Again! 342 Finite Difference Equations 344 The Steady-State Heat Equation 354 Isotherms 358 Irregulär Physical Boundaries 359 Neumann Boundary Conditions 361 A Magnetic Problem 364 Boundary Conditions 366

Contents

The Finite Difference Equations Another Comment on Strategy AreWeThereYet? 374 Spectral Methods 374 The Pseudo-Spectral Method A Sample Problem 385 The Potential Step 388 The Well 391 The Barrier 394 And There's More... 394 References 394

Appendix A: Software Installation Installing the Software 396 The FL Command 398 AUTOEXEC.BAT 400 README.DOC 401

Appendix B: Using FCCRIib Library User's Guide 403

/

/

Appendix C: Library Internais Library Technical Reference 407

367 370

377

Index