1 A First Numerical Problem 1
1.1 Radioactive Decay 1
1.2 A Numerical Approach 2
1.3 Design and Construction of a Working Program:Codes and Pseu-docodes 3
1.4 Testing Your Program 11
1.5 Numerical Considerations 12
1.6 Programming Guidelines and Philosophy 14
2 Realistic Projectile Motion 18
2.1 Bicycle Racing:The Effect of Air Resistance 18
2.2 Projectile Motion:The Trajectory of a Cannon Shell 25
2.3 Baseball:Motion of a Batted Ball 31
2.4 Throwing a Baseball:The Effects of Spin 36
2.5 Golf 44
3 Oscillatory Motion and Chaos 48
3.1 Simple Harmonic Motion 48
3.2 Making the Pendulum More Interesting:Adding Dissipation,Non-linearity and a Driving Force 54
3.3 Chaos in the Driven Nonlinear Pendulum 58
3.4 Routes to Chaos:Period Doubling 66
3.5 The Logistic Map:Why the Period Doubles 70
3.6 The Lorenz Model 75
3.7 The Billiard Problem 82
3.8 Behavior in the Frequency Domain:Chaos and Noise 88
4 The Solar System 94
4.1 Kepler's Laws 94
4.2 The Inverse-Square Law and the Stability of Planetary Orbits 101
4.3 Precession of the Perihelion of Mercury 107
4.4 The Three-Body Problem and the Effect of Jupiter on Earth 113
4.5 Resonances in the Solar System:Kirkwood Gaps and Planetary Rings 118
4.6 Chaotic Tumbling of Hyperion 123
5 Potentials and Fields 129
5.1 Electric Potentials and Fields:Laplace's Equation 129
5.2 Potentials and Fields Near Electric Charges 143
5.3 Magnetic Field Produced by a Current 148
5.4 Magnetic Field of a Solenoid:Inside and Out 151
6 Waves 156
6.1 Waves:The Ideal Case 156
6.2 Frequency Spectrum of Waves on a String 165
6.3 Motion of a (Somewhat)Realistic String 169
6.4 Waves on a String(Again):Spectral Methods 174
7 Random Systems 181
7.1 Why Perform Simulations of Random Processes? 181
7.2 Random Walks 183
7.3 Self-Avoiding Walks 188
7.4 Random Walks and Diffusion 195
7.5 Diffusion,Entropy,and the Arrow of Time 201
7.6 Cluster Growth Models 206
7.7 Fractal Dimensionalities of Curves 212
7.8 Percolation 218
7.9 Diffusion on Fractals 229
8 Statistical Mechanics,Phase Transitions,and the Ising Model 235
8.1 The Ising Model and Statistical Mechanics 235
8.2 Mean Field Theory 239
8.3 The Monte Carlo Method 244
8.4 The Ising Model and Second-Order Phase Transitions 246
8.5 First-Order Phase Transitions 259
8.6 Scaling 264
9 Molecular Dynamics 270
9.1 Introduction to the Method:Properties of a Dilute Gas 270
9.2 The Melting Transition 285
9.3 Equipartition and the Fermi-Pasta-Ulam Problem 294
10 Quantum Mechanics 303
10.1 Time-Independent Schr?dinger Equation:Some Preliminaries 303
10.2 One Dimension:Shooting and Matching Methods 307
10.3 A Matrix Approach 323
10.4 A Variational Approach 326
10.5 Time-Dependent Schr?dinger Equation:Direct Solutions 333
10.6 Time-Dependent Schr?dinger Equation in Two Dimensions 345
10.7 Spectral Methods 349
11 Vibrations,Waves,and the Physics of Musical Instruments 357
11.1 Plucking a String:Simulating a Guitar 357
11.2 Striking a String:Pianos and Hammers 362
11.3 Exciting a Vibrating System with Friction:Violins and Bows 367
11.4 Vibrations of a Membrane:Normal Modes and Eigenvalue Problems 372
11.5 Generation of Sound 382
12 Interdisciplinary Topics 389
12.1 Protein Folding 389
12.2 Earthquakes and Self-Organized Criticality 405
12.3 Neural Networks and the Brain 418
12.4 Real Neurons and Action Potentials 436
12.5 Cellular Automata 445
APPENDICES 456
A Ordinary Differential Equations with Initial Values 456
A.1 First-Order,Ordinary Differential Equations 456
A.2 Second-Order,Ordinary Differential Equations 460
A.3 Centered Difference Methods 464
A.4 Summary 467
B Root Finding and Optimization 469
B.1 Root Finding 469
B.2 Direct Optimization 472
B.3 Stochastic Optimization 473
C The Fourier Transform 479
C.1 Theoretical Background 479
C.2 Discrete Fourier Transform 481
C.3 Fast Fourier Transform (FFT) 483
C.4 Examples:Sampling Interval and Number of Data Points 486
C.5 Examples:Aliasing 488
C.6 Power Spectrum 490
D Fitting Data to a Function 493
D.1 Introduction 493
D.2 Method of Least Squares:Linear Regression for Two Variables 494
D.3 Method of Least Squares:More General Cases 497
E Numerical Integration 500
E.1 Motivation 500
E.2 Newton-Cotes Methods:Using Discrete Panels to Approximate an Integral 500
E.3 Gaussian Quadrature:Beyond Classic Methods of Numerical Inte-gration 504
E.4 Monte Carlo Integration 506
F Generation of Random Numbers 512
F.1 Linear Congruential Generators 512
F.2 Nonuniform Random Numbers 516
G Statistical Tests of Hypotheses 520
G.1 Central Limit Theorem and the x2 Distribution 521
G.2 x2 Test of a Hypothesis 523
H Solving Linear Systems 527
H.1 Solving Ax=b,b≠O 528
H.1.1 Gaussian Elimination 528
H.1.2 Gauss-Jordan elimination 530
H.1.3 LU decomposition 531
H.1.4 Relaxational method 533
H.2 Eigenvalues and Eigenfunctions 535
H.2.1 Approximate Solution of Eigensystems 537
Index 541