Formatted contents note |
<br/>Parti GENERALITIES<br/>1 Introduction 3<br/>1.1 The Nature ofComputational Science 3<br/>1.1.1 How Computational Scientists Do It 4<br/>1.2 Aims of"This Book 5<br/>1.3 Using this Book with the Disk and Web 6<br/>2 Computing Software Basics 9<br/>2.1 Problem 1: Making Computers Obey 9<br/>2.2 Theory: Computer Languages 9<br/>2.3 Implementation: Programming Concepts 11<br/>2.4 Implementation: Fortran,area.f 12<br/>2.5 Implementation: C,area.c 13<br/>2.6 Implementation: Shells,Editors,and Programs 13<br/>2.7 Theory: Program Design 14<br/>2.8 Method: Structured Programming 16<br/>2.9 Method: Programming Hints 18<br/>2.10 Problem 2: Limited Range of Numbers 20<br/>2.11 Theory: Number Representation 20<br/>2.12 Method: Fixed and Floating 21<br/>2.13 Implementation: Over/Underflows,over.f(.c) 23<br/>2.14 Model: Machine Precision 23<br/>2.15 Implementation: limit.f(.c) 24<br/>2.16 Problem 3: Complex Numbers, Inverse Functions 25<br/>2.17 Theory: Complex Numbers 25<br/>2.18 Implementation: complex.c(.0 27<br/>2.19 Exploration: Quantum Complex Energies 28<br/>2.20 Problem 4: Summing Series 28<br/>2.21 Method: Numeric 29<br/>2.22 Implementation: Pseudocode 29<br/>2.23 Implementation: Good Algorithm,exp-good.f(.c) 29<br/>2.24 Implementation: Bad Algorithm,exp-bad.f(.c) 30<br/>2.25 Assessment 30<br/>$ Errors and Uncertainties in Computations 31<br/>3.1 Problem: Living with Errors 31<br/>3.2 Theory: Types of errors 32<br/>3.3 Model: Subtractive Cancellation 33<br/>3.4 Assessment: Cancellation Experiment 34<br/>3.5 Model: Multiplicative Errors 36<br/>3.6 Problem 1: Errors in Spherical Bessel Functions 37<br/>3.7 Method: Numeric Recursion Relations 38<br/>3.8 Implementation: Bessel.f(.c) 40<br/>3.9 Assessment 40<br/>3.10 Problem 2: Errors in Algorithms 40<br/>3.11 Model: Errors in Algorithms 41<br/>3.11.1 Total Error 41<br/>3.12 Method: Optimizing with Known Error Behavior 42<br/>3.13 Method: Empirical Error Analysis 43<br/>3.14 Assessment: Experiment 44<br/>Integration 47<br/>4.1 Problem: Integrating a Spectrum 47CONTENTS fx<br/>4.2 Model: Quadrature, Summing Boxes 47<br/>4.3 Method: Trapezoid Rule 50<br/>4.4 Method: Simpson's Rule 51<br/>4.5 Assessment: Integration Error, Analytic 52<br/>4.6 Method: Gaussian Quadrature 55<br/>4.6.1 Scaling Integration Points 56<br/>4.7 Implementation: integ.f(.c) 57<br/>4.8 Assessment: Empirical Error Estimate 58<br/>4.9 Assessment: Experimentation 59<br/>4.10 Method: Romberg Extrapolation 59<br/>4.10.1 Other Closed Newton-Cotes Formulas 60<br/>Part II APPLICATIONS<br/>5 Data Fitting 63<br/>5.1 Problem: Fitting an Experimental Spectrum 63<br/>5.2 Theory: Curve Fitting 64<br/>5.3 Method: Lagrange Interpolation 65<br/>5.3.1 Example 66<br/>5.4 Implementation: LaGrange.f(.c) 66<br/>5.5 Assessment: Interpolating a Resonant Spectrum 67<br/>5.6 Assessment: Exploration 68<br/>5.7 Method: Cubic Splines 68<br/>5.7.1 Cubic Spline Boundary Conditions 69<br/>5.7.2 Exploration: Cubic Spline Quadrature 70<br/>5.8 Implementation: spline.f 71<br/>5.9 Assessment: Spline Fit ofCross Section 71<br/>5.10 Problem: Fitting Exponential Decay 71<br/>5.11 Model: Exponential Decay 71<br/>5.12 Theory: Probability Theory 73<br/>5.13 Method: Least-Squares Fitting 74<br/>5.14 Theory: Goodness of Fit 76<br/>5.15 Implementation: Least-Squares Fits, fit.f(.c) 77<br/>5.16 Assessment: Fitting Exponential Decay 78<br/>5.17 Assessment: Fitting Heat Flow 79<br/>5.18 Implementation: Linear Quadratic Fits 80<br/>5.19 Assessment: Quadratic Fit 81<br/>5.20 Method: Nonlinear Least-Squares Fitting 81* CONTENTS<br/>5.21 Assessment: Nonlinear Fitting 82<br/>6 Deterministic Randomness 83<br/>6.1 Problem: Deterministic Randomness 83<br/>6.2 Theory: Random Sequences 83<br/>6.3 Method: Pseudo-Random-Number Generators 84<br/>6.4 Assessment: Random Sequences 86<br/>6.5 Implementation: Simple and Not<br/>random.f(.c); call.f(.c) 87<br/>6.6 Assessment: Randomness and Uniformity 87<br/>6.7 Assessment: Tests of Randomness, Uniformity 88<br/>6.8 Problem: A Random Walk 89<br/>6.9 Model: Random Walk Simulation 89<br/>6.10 Method: Numerical Random Walk 90<br/>6.11 Implementation: walk.f(.c) 91<br/>6.12 Assessment: Different Random Walkers 91<br/>7 Monte Carlo Applications 93<br/>7.1 Problem: Radioactive Decay 93<br/>7.2 Theory: Spontaneous Decay 93<br/>7.3 Model: Discrete Decay 94<br/>7.4 Model: Continuous Decay 95<br/>7.5 Method: Decay Simulation 95<br/>7.6 Implementation: decay.f(.c) 97<br/>7.7 Assessment: Decay Visualization 97<br/>7.8 Problem: Measuring by Stone Throwing 97<br/>7.9 Theory: Integration by Rejection 97<br/>7.10 Implementation: Stone Throwing,pond.f(.c) 98<br/>7.n Problem: High-Dimensionallntegration 99<br/>7.12 Method: Integration by Mean Value 99<br/>7.12.1 Multidimensional Monte Carlo 101<br/>7.13 Assessment: Error in N-D Integration 101<br/>7.14 Implementation: 10-D Integration,int_10d.f(.c) 101<br/>7.15 Problem: Integrate a Rapidly Varying Function© 102<br/>7.16 Method: Variance Reduction© 102<br/>7.17 Method: Importance Sampling© 103<br/>7.18 Implementation: Nonuniform Randomness© 103<br/>7.18.1 Inverse Transform Method 103<br/>7.18.2 Uniform Weight Function w 104CONTENTS Xi<br/>7.18.3 Exponential Weight 105<br/>7.18.4 Gaussian(Normal)Distribution 105<br/>7.18.5 Alternate Gaussian Distribution 106<br/>7.19 Method: von Neumann Rejection© 107<br/>7.20 Assessment© 108<br/>Differentiation 109<br/>8.1 Problem 1: Numerical Limits 109<br/>8.2 Method: Numeric 109<br/>8.2.1 Method: Forward Difference 109<br/>8.2.2 Method: Central Difference 111<br/>8.2.3 Method: Extrapolated Difference 111<br/>8.3 Assessment: Error Analysis 112<br/>8.4 Implementation: Differentiation,diff.f(.c) 113<br/>8.5 Assessment: Error Analysis, Numerical 113<br/>8.6 Problem 2: Second Derivatives 114<br/>8.7 Theory: Newton II 114<br/>8.8 Method: Numerical Second Derivatives 114<br/>8.9 Assessment: Numerical Second Derivatives 115<br/>Differential Equations and Oscillations 117<br/>9.1 Problem: A Forced Nonlinear Oscillator 117<br/>9.2 Theory, Physics: Newton's Laws 117<br/>9.3 Model: Nonlinear Oscillator 118<br/>9.4 Theory, Math: Types ofEquations 119<br/>9.4.1 Order 119<br/>9.4.2 Ordinary and Partial 120<br/>9.4.3 Linear and Nonlinear 121<br/>9.4.4 Initial and Boundary Conditions 121<br/>9.5 Theory,^ath, and Physics:<br/>The Dynamical Form for ODEs 122<br/>9.5.1 Second-Order Equation 122<br/>9.6 Implementation: Dynamical Form for Oscillator 123<br/>9.7 Numerical Method: ODE Algorithms 124<br/>9.8 Method(Numerical): Euler's Algorithm 124<br/>9.9 Method(Numerical): Second-Order Runge-Kutta 126<br/>9.10 Method(Numerical): Fourth-Order Runge-Kutta 127<br/>9.11 Implementation: ODE Solver,rk4.f(.c) 127<br/>9.12 Assessment: rk4 and Linear Oscillations 128Xii CONTENTS<br/>9.13 Assessment: rk4 and Nonlinear Oscillations 128<br/>9.14 Exploration: Energy Conservation 129<br/>10 Quantum Eigenvalues; Zero-Finding and Matching 131<br/>10.1 Problem: Binding A Quantum Particle 131<br/>10.2 Theory: Quantum Waves 132<br/>10.3 Model: Particle in a Box 133<br/>10.4 Solution: Semianalytic 133<br/>10.5 Method: Finding Zero via Bisection Algorithm 136<br/>10.6 Method: Eigenvalues from an ODE Solver 136<br/>10.6.1 Matching 138<br/>10.7 Implementation: ODE Eigenvalues,numerov.c 139<br/>10.8 Assessment: Explorations 141<br/>10.9 Extension: Newton's Rule for Finding Roots 141<br/>11 Anharmonic Oscillations 143<br/>11.1 Problem 1: Perturbed Harmonic Oscillator 143<br/>11.2 Theory: Newton II 144<br/>11.3 Implementation: ODE Solver,rk4.f(.c) 144<br/>11.4 Assessment: Amplitude Dependence frequency 145<br/>11.5 Problem 2: Realistic Pendulum 145<br/>11.6 Theory: Newton II for Rotations 146<br/>11.7 Method, Analytic: Elliptic Integrals 147<br/>11.8 Implementation,rk4 for Pendulum 147<br/>11.9 Exploration: Resonance and Beats 148<br/>11.10 Exploration: Phase-Space Plot 149<br/>11.11 Exploration: Damped Oscillator 150<br/>12 Fourier Analysis of Nonlinear Oscillations 151<br/>12.1 Problem 1: Harmonics in Nonlinear Oscillations 151<br/>12.2 Theory: Fourier Analysis 152<br/>12.2.1 Example 1: Sawtooth Function 154<br/>12.2.2 Example 2: Half-Wave Function 154<br/>12.3 Assessment: Summation of Fourier Series 155<br/>12.4 Theory: Fourier Transforms 156<br/>12.5 Method: Discrete Fourier Transform 157<br/>12.6 Method: DFT for Fourier Series 161<br/>12.7 Implementation: fourier.f(.c), in four.c 162<br/>12.8 Assessment: Simple Analytic Input 162CONTENTS Xiii<br/>12.9 Assessment: Highly Nonlinear Oscillator 163<br/>12.10 Assessment: Nonlinearly Perturbed Oscillator 163<br/>12.11 Exploration: DFT of Nonperiodic Functions 163<br/>12.12 Exploration: Processing Noisy Signals 164<br/>12.13 Model: Autocorrelation Function 164<br/>12.14 Assessment: DFT and Autocorrelation Function 165<br/>12.15 Problem 2: Model Dependence of Data Analysis © 166<br/>12.16 Method: Model-Independent Data Analysis 167<br/>12.17 Assessment 168<br/>13 Unusual Dynamics of Nonlinear Systems 171<br/>13.1 Problem: Variability of Populations 171<br/>13.2 Theory: Nonlinear Dynamics 171<br/>13.3 Model: Nonlinear Growth, The Logistic Map 172<br/>13.3.1 The Logistic Map 173<br/>13.4 Theory: Properties of Nonlinear Maps 174<br/>13.4.1 Fixed Points 174<br/>13.4.2 Period Doubling, Attractors 175<br/>13.5 Implementation: Explicit Mapping 176<br/>13.6 Assessment: Bifurcation Diagram 177<br/>13.7 Implementation: bugs.f(.c) 178<br/>13.8 Exploration: Random Numbers via Logistic Map 179<br/>13.9 Exploration: Feigenbaum Constants 179<br/>13.10 Exploration: Other Maps 180<br/>14 Differential Chaos in Phase Space 181<br/>14.1 Problem: A Pendulum Becomes Chaotic 181<br/>14.2 Theory and Model: The Chaotic Pendulum 182<br/>14.3 Theory: Limit Cycles and Mode-Locking 183<br/>14.4 Implementation 1: Solve ODE,rk4.f(.c) 184<br/>14.5 Visualization: Phase-Space Orbits 184<br/>14.6 Implementation 2: Free Oscillations 187<br/>14.7 Theory: Motion in Phase Space 188<br/>14.8 Implementation 3: Chaotic Pendulum 188<br/>14.9 Assessment: Chaotic Structure in Phase Space 191<br/>14.10 Assessment: Fourier Analysis 191<br/>14.11 Exploration: Pendulum with Vibrating Pivot 192<br/>14.11.1 Implementation: Bifurcation Diagram 192<br/>14.12 Further Explorations 19317 Quantum Scattering via Integral Equations©<br/>17.1 Problem: Quantum Scattering in k Space<br/>17.2 Theory: Lippmann-Schwinger Equation<br/>17.3 Theory(Mathematics): Singular Integrals<br/>xlv CONTENTS<br/>Part III APPLICATIONS<br/>(HIGH PERFORMANCE COMPUTING)<br/>15 Matrix Computing and Subroutine Libraries 197<br/>15.1 Problem 1: Many Simultaneous Linear Equations 197<br/>15.2 Formulation: Linear into Matrix Equation 198<br/>15.3 Problem 2: Simple but Unsolvable Statics 198<br/>15.4 Theory: Statics<br/>15.5 Formulation: Nonlinear Simultaneous Equations 199<br/>15.6 Theory: Matrix Problems<br/>15 6.1 Classes of Matrix Problems 201<br/>15.7 Method: Matrix Computing<br/>15.8 Implementation: Scientific Libraries, WWW<br/>15.9 Implementation: Determining Availability<br/>15.9.1 Determining Contents of a Library<br/>15.9.2 Determining the Needed Routine<br/>15.9.3 Calling lapack from Fortran,lineq.c<br/>15.9.4 Calling lapack from C<br/>15.9.5 Calling lapack Fortran from C<br/>15.9.6 C Compiling Calling Fortran<br/>15.10 Extension: More Netlib Libraries<br/>15.10.1 SLATEC's Common Math Library<br/>15.11 Exercises: Testing Matrix Calls<br/>15.12Implementation: LAPACK Short Contents<br/>15.13 Implementation: Netlib Short Contents<br/>15.14 Implementation: SLATEC Short Contents<br/><br/>6 Bound States in Momentum Space 231<br/>16.1 Problem: Bound States in Nonlocal Potentials<br/>16.2 Theory: k-Space Schrodinger Equation<br/>16.3 Method: Reducing Integral to Linear Equations 233<br/>16.4 Model: The Delta-Shell Potential 23<br/>16.5 Implementation: Binding Energies, bound.c(.0<br/>16.6 Exploration: Wave Function 237<br/><br/> |