Computational Physics Contents
PART II APPLICATIONS
(with Web Tutorial links)

Section
Topic
Page
Chapter 5
Data Fitting
63
5.1
Problem: Fitting an Experimental Spectrum
63
5.2
Theory: Curve Fitting
64
5.3
Method: Lagrange Interpolation
65
5.3.1
Example
66
5.4
Implementation: Lagrange Interpolation, lagrange.f (.c)
67
5.5
Assessment: Interpolating a Resonant Spectrum
67
5.6
Assessment: Exploration
68
5.7
Method: Cubic Splines
69
5.7.1
Cubic Spline Boundary Conditions
70
5.7.2
Exploration: Cubic Spline Quadrature
71
5.8
Implementation: Packaged Spline Subprogram, spline.f
71
5.9
Assessment: Spline Fit of Resonant Cross
71
5.10
Problem: Fitting Exponential Decay
72
5.11
Model: Exponential Decay
72
5.12
Theory: Probability Theory
73
5.13
Method: Least-Squares Fitting
75
5.14
Theory: Goodness of Fit
77
5.15
Implementation: Least-Squares Fits, fit.f (.c)
78
5.16
Assessment: Fitting Exponential Decay
79
5.17
Assessment: Fitting Heat Flow
80
5.18
Implementation: Linear Quadratic Fits
81
5.19
Assessment: Quadratic fit
82
5.20
Method: Nonlinear Least-Squares Fitting
82
5.21
Assessment: Nonlinear Fitting
82
Chapter 6
Deterministic Randomness
83
6.1
Problem: Deterministic Randomness
83
6.2
Theory: Random Sequences
83
6.3
Method: Pseudo-Random-Number Generators
84
6.4
Assessment: Random Sequences
86
6.5
Implementation: Simple and Not [random.f (.c); call.f (.c)]
87
6.6
Assessment: Randomness and Uniformity
87
6.7
Assessment: Tests for Randomness and Uniformity
88
6.8
Problem: A Random Walk
89
6.9
Model: Random Walk Simulation
89
6.10
Method: Numerical Random Walk
90
6.11
Implementation: Random Walk, walk.f (.c)
91
6.12
Assessment: Different Random Walkers
91
-
Exploration: 2D Gas Simulation (SUHEP)
-
Chapter 7
Monte Carlo Applications
93
7.1
Problem: Radioactive Decay
93
7.2
Theory: Spontaneous Decay
93
7.3
Model: Discrete Decay
94
7.4
Model: Continuous Decay
95
7.5
Method: Decay Simulation
95
7.6
Implementation: Radioactive Decay, decay.f (.c)
97
7.7
Assessment: Decay Visualization (sonification)
97
7.8
Problem: Measuring by Stone Throwing
97
7.9
Theory: Integration by Rejection
97
7.10
Implementation: Stone Throwing, pond.f (.c)
99
7.11
Problem: High-Dimensional Integration
99
7.12
Method: Integration by Mean Value
100
7.12.1
Multidimensional Monte Carlo
101
7.13
Assessment: Error in Multidimensional Integration
101
7.14
Implementation: Monte Carlo 10-D Integration, int_10d.f (.c)
102
7.15
Problem: MC Integration of Rapidly Varying Functions (O)
102
7.16
Method: Variance Reduction (O)
102
7.17
Method: Importance Sampling (O)
103
7.18
Implementation: Nonuniform Randomness (O)
103
7.18.1
Inverse Transform/Change of Variable Method
104
7.18.2
Uniform Weight Function
105
7.18.3
Exponential Weight
105
7.18.4
Gaussian (Normal) Distribution
106
7.18.5
Alternate Gaussian Distribution
107
7.19
Method: von Neumann Rejection (O)
107
7.20
Assessment (O)
108
Chapter 8
Differentiation
109
8.1
Problem 1: Numerical Limits
109
8.2
Method: Numeric
109
8.2.1
Method: Forward Difference
109
8.2.2
Method: Central Difference
111
8.2.3
Method: Extrapolated Difference
111
8.3
Assessment: Error Analysis
112
8.4
Implementation: Differentiation, diff.f (.c)
114
8.5
Assessment: Error Analysis, Numerical
114
8.6
Problem 2: Second Derivatives
114
8.7
Theory: Newton II
114
8.8
Method: Numerical Second Derivatives
114
8.9
Assessment: Numerical Second Derivatives
115
Chapter 9
Differential Equations and Oscillations
117
9.1
Problem: A Forced Nonlinear Oscillator
117
9.2
Theory, Physics: Newton's Laws
117
9.3
Model: Nonlinear Oscillator
118
9.4
Theory, Mathematics: Types of Differential Equations
119
9.4.1
Order
119
9.4.2
Ordinary and Partial
120
9.4.3
Linear and Nonlinear
121
9.4.4
Initial and Boundary Conditions
121
9.5
Theory, Math, and Physics: The Dynamical Form for ODEs
122
9.5.1
Dynamical Form for Second-Order Equation
122
9.6
Implementation: Dynamical Form for Oscillator
123
9.7
Numerical Method: Differential Equation Algorithms
124
9.8
Method (Numerical): Euler's Algorithm (euler.c), (plots)
125
9.9
Method (Numerical): Second-Order Runge-Kutta
126
9.10
Method (Numerical): Fourth-Order Runge-Kutta
127
9.11
Implementation: ODE Solver, rk4.f (.c)
128
9.12
Assessment: rk4 and Linear Oscillations
128
9.13
Assessment: rk4 and Nonlinear Oscillations
129
9.14
Exploration: Energy Conservation
129
Chapter 10
Quantum Eigenvalues; Zero-Finding and Matching
131
10.1
Problem: Binding A Quantum Particle
131
10.2
Theory: Quantum Waves
132
10.3
Model: Particle in a Box
133
10.4
Solution: Semianalytic
133
10.5
Method: Finding Zero via the Bi Algorithm
136
10.6
Method: Eigenvalues from an ODE Solver
136
10.6.1
Matching
139
10.7
Implementation: ODE Eigenvalues, numerov.c
140
10.8
Assessment: Explorations Applet (SUHEP)
141
10.9
Extension: Newton's Rule for Finding Roots
142
Chapter 11
Anharmonic Oscillations
143
11.1
Problem 1: Nonlinearly Perturbed Harmonic Oscillator
143
11.2
Theory: Newton II
144
11.3
Implementation: ODE Solver, rk4.f (.c)
144
-
Exploration: x^4 Perturbed Oscillator Applet (SUHEP)
-
11.4
Assessment: Amplitude Dependence of Frequency
145
11.5
Problem 2: Realistic Pendulum
145
11.6
Theory: Newton II for Rotations
146
11.7
Method, Analytic: Elliptic Integrals
147
11.8
Implementation, rk4 for Pendulum
147
11.9
Exploration: Resonance and Beats
148
11.10
Exploration: Phase-Space Plot
149
11.11
Exploration: Damped Oscillator
150
Chapter 12
Fourier Analysis of Nonlinear Oscillations
151
12.1
Problem 1: The Harmonics of Nonlinear Oscillations
151
12.2
Theory: Fourier Analysis
152
12.2.1
Example 1: Sawtooth Function
154
12.2.2
Example 2: Half-Wave Function
154
12.3
Assessment: Summation of Fourier Series
155
12.4
Theory: Fourier Transforms
156
12.5
Method: Discrete Fourier Transform
157
12.6
Method: DFT for Fourier Series
161
12.7
Implementation: DFT, fourier.f (.c), invfour.c
162
12.8
Assessment: Simple Analytic Input
162
12.9
Assessment: Highly Nonlinear Oscillator
163
12.10
Assessment: Nonlinearly Perturbed Oscillator
163
12.11
Exploration: DFT of Nonperiodic Functions
164
12.12
Exploration: Processing Noisy Signals
164
12.13
Model: Autocorrelation Function
164
12.14
Assessment: DFT and Autocorrelation Function
166
12.15
Problem 2: Model Dependence of Data Analysis (O)
167
12.16
Method: Model-Independent Data Analysis
167
12.17
Assessment
169
Chapter 13
Unusual Dynamics of Nonlinear Systems
171
13.1
Problem: Variability of Bug Populations
171
13.2
Theory: Nonlinear Dynamics
171
13.3
Model: Nonlinear Growth, The Logistic Map
172
13.3.1
The Logistic Map
173
13.4
Theory: Properties of Nonlinear Maps
174
13.4.1
Fixed Points
174
13.4.2
Period Doubling, Attractors
175
13.5
Implementation and Assessment: Explicit Mapping
176
13.6
Assessment: Bifurcation Diagram (sonification)
177
13.7
Implementation: Bifurcation Diagram, bugs.f (.c)
178
13.8
Exploration: Random Numbers from Logistic Map?
179
13.9
Exploration: Feigenbaum Constants
179
13.10
Exploration: Other Maps
180
Chapter 14
Differential Chaos in Phase Space
181
14.1
Problem: A Pendulum Becomes Chaotic
181
14.2
Theory and Model: The Chaotic Pendulum (Java animate)
182
14.3
Theory: Limit Cycles and Mode Locking (animation)
183
14.4
Implementation 1: Solve ODE, rk4.f (.c)
184
14.5
Assessment and Visualization: Phase-Space Orbits
184
14.6
Implementation 2: Free Oscillations in Phase Space
187
14.7
Theory: Chaotic and Random Motion in Phase Space
188
14.8
Implementation 3: Chaotic Pendulum
188
14.9
Assessment: Chaotic Structure in Phase Space
191
14.10
Assessment: Fourier Analysis of Chaotic Pendulum
191
14.11
Exploration: Pendulum with Vibrating Pivot
192
14.11.1
Implementation: Bifurcation Diagram of Pendulum
193
14.12
Further Explorations
194
Chapter 24
Fractals
323
24.1
Problem : Fractals
323
24.2
Theory: Fractional Dimension
324
24.3
Problem 1: The Sierpienski Gasket
324
24.4
Implementation: sierpin.c
325
24.5
Assessment: Determining a Fractal Dimension
326
24.6
Problem 2: How to Grow Beautiful Plants
327
24.7
Theory: Self-Affine Connections
328
24.8
Implementation: Barnsley's Fern, fern.c
329
24.9
Exploration: Self-Affinity in Trees
330
24.10
Implementation: Nice Trees, tree.c
330
24.11
Problem 3: Ballistic Deposition
330
24.12
Method
331
24.13
Implementation: Ballistic Deposition, film.c
333
24.14
Problem 4: Length Of The Coastline of Britain
333
24.15
Model: The Coast As A Fractal
333
24.16
Method: Box Counting
334
24.17
Problem 5: Correlated Growth in Forests and Films
335
24.18
Method: Correlated Ballistic Deposition
336
24.19
Implementation: Correlated Ballistic Deposition, column.c
337
24.20
Problem 6: A Globular Cluster
337
24.21
Model: Diffusion-Limited Aggregation
337
24.22
Method
338
24.23
Implementation: Diffusion-Limited Aggregation, dla.c
339
24.24
Assessment: Fractal Analysis Of The DLA Graph
339
24.25
Problem 7: Fractal Structures in Bifurcation Graph
340