SlideShare a Scribd company logo
A Survey of
Computational Physics
Introductory Computational Science
Rubin H. Landau
Manuel Jose Paez
Cristian C. Bordeianu
PRINCETON UNIVERSITY PRESS • PRINCETON AND OXFORD
CONTENTS
Preface xxiii
Computational Science Basics 1
1.1 Computational Physics and Science l
1.2 How to Read and Use This Book 3
1.3 Making Computers Obey; Languages (Theory) 6
1.4 Programming Warmup 8
1.4.1 Structured Program Design 10
1.4.2 Shells, Editors, and Execution 11
1.4.3 Java I/O, Scanner Class with printf 12
1.4.4 I/O Redirection 12
1.4.5 Command-Line Input 13
1.4.6 I/O Exceptions: FileCatchThrowJava 14
1.4.7 Automatic Code Documentation o 16
1.5 Computer Number Representations (Theory) 17
1.5.1 IEEE Floating-Point Numbers 18
1.5.2 Over/Underflows Exercises 24
1.5.3 Machine Precision (Model) 25
1.5.4 Determine Your Machine Precision 27
1.6 Problem: Summing Series 27
1.6.1 Numerical Summation (Method) 28
1.6.2 Implementation and Assessment 29
Errors & Uncertainties in Computations 30
2.1 Types of Errors (Theory) 30
2.1.1 Model for Disaster: Subtractive Cancellation 32
2.1.2 Subtractive Cancellation Exercises 33
2.1.3 Round-off Error in a Single Step 34
2.1.4 Round-off Error Accumulation After Many Steps 35
2.2 Errors in Spherical Bessel Functions (Problem) 36
2.2.1 Numerical Recursion Relations (Method) 36
2.2.2 Implementation and Assessment: Recursion Relations 38
viii contents
2.3 Experimental Error Investigation (Problem) 39
2.3.1 Error Assessment 43
3 Visualization Tools 45
3.1 Data Visualization 45
3.2 PtPlot: 2-D Graphs Within Java 46
3.3 Grace/ACE: Superb 2-D Graphs for Unix/Linux 51
3.3.1 Grace Basics 51
3.4 Gnuplot: Reliable 2-D and 3-D Plots 56
3.4.1 Gnuplot Input Data Format © 58
3.4.2 Printing Plots 59
3.4.3 Gnuplot Surface (3-D) Plots 60
3.4.4 Gnuplot Vector Fields 62
3.4.5 Animations from a Plotting Program (Gnuplot) 0 64
3.5 OpenDX for Dicing and Slicing 65
3.6 Texturing and 3-D Imaging 65
4 Object-Oriented Progronns: Impedance &
Batons 67
4.1 Unit I. Basic Objects: Complex Impedance 67
4.2 Complex Numbers (Math) 67
4.3 Resistance Becomes Impedance (Theory) 70
4.4 Abstract Data Structures, Objects (CS) 70
4.4.1 Object Declaration and Construction 72
4.4.2 Implementation in Java 73
4.4.3 Static and Nonstatic Methods 76
4.4.4 Nonstatic Methods 77
4.5 Complex Currents (Solution) 79
4.6 OOP Worked Examples 80
4.6.1 OOP Beats 80
4.6.2 OOP Planet 82
4.7 Unit II. Advanced Objects: Baton Projectiles 0 85
4.8 Trajectory of a Thrown Baton (Problem) 86
4.8.1 Combined Translation and Rotation (Theory) 86
4.9 OOP Design Concepts (CS) 89
4.9.1 Including Multiple Classes 90
4.9.2 Ball and Path Class Implementation 92
4.9.3 Composition, Objects Within Objects 93
4.9.4 Baton Class Implementation 94
contents ix
4.9.5 Composition Exercise 95
4.9.6 Calculating the Baton's Energy (Extension) 96
4.9.7 Examples of Inheritance and Object Hierarchies 98
4.9.8 Baton with a Lead Weight (Application) 99
4.9.9 Encapsulation to Protect Classes 100
4.9.10 Encapsulation Exercise 101
4.9.11 Complex Object Interface (Extension) 102
4.9.12 Polymorphism, Variable Multityping 104
4.10 Supplementary Exercises 105
4.11 OOP Example: Superposition of Motions 105
4.12 Newton's Laws of Motion (Theory) 106
4.13 OOP Class Structure (Method) 106
4.14 Java Implementation 107
Monte Carlo Simulations (Nonthermal) 109
5.1 Unit I. Deterministic Randomness 109
5.2 Random Sequences (Theory) 109
5.2.1 Random-Number Generation (Algorithm) 110
5.2.2 Implementation: Random Sequence 113
5.2.3 Assessing Randomness and Uniformity 114
5.3 Unit II. Monte Carlo Applications 116
5.4 A Random Wai k (Problem) 116
5.4.1 Random-Walk Simulation 116
5.4.2 Implementation: Random Walk 117
5.5 Radioactive Decay (Problem) 119
5.5.1 Discrete Decay (Model) 119
5.5.2 Continuous Decay (Model) 120
5.5.3 Decay Simulation 121
5.6 Decay Implementation and Visualization 122
Integration 123
6.1 Integrating a Spectrum (Problem) 123
6.2 Quadrature as Box Counting (Math) 123
6.2.1 Algorithm: Trapezoid Rule 125
6.2.2 Algorithm: Simpson's Rule 126
6.2.3 Integration Error (Analytic Assessment) 128
6.2.4 Algorithm: Gaussian Quadrature 130
6.2.5 Integration Implementation and Error Assessment 132
x contents
6.3 Experimentation 135
6.4 Higher-Order Rules (Algorithm) 135
6.5 Monte Carlo Integration by Stone Throwing 136
6.5.1 Stone Throwing Implementation 136
6.5.2 Integration by Mean Value (Math) 137
6.6 High-Dimensional Integration (Problem) 138
6.6.1 Multidimensional Monte Carlo 139
6.6.2 Error in Multidimensional Integration (Assessment) 139
6.6.3 Implementation: 10-D Monte Carlo Integration 139
6.7 Integrating Rapidly Varying Functions (Problem) 140
6.7.1 Variance Reduction (Method) 140
6.7.2 Importance Sampling (Method) 140
6.7.3 Von Neumann Rejection (Method) 141
6.7.4 Simple Gaussian Distribution 141
6.8 Nonuniform Assessment © 142
6.8.1 Implementation: Nonuniform Randomness © 142
7 Differentiation & Searching 146
7.1 Unit I. Numerical Differentiation 146
7.2 Forward Difference (Algorithm) 147
7.3 Central Difference (Algorithm) 148
7.4 Extrapolated Difference (Method) 149
7.5 Error Analysis (Assessment) 149
7.6 Second Derivatives (Problem) 151
7.6.1 Second-Derivative Assessment 151
7.7 Unit II. Trial-and-Error Searching 151
7.8 Quantum States in a Square Well (Problem) 152
7.9 Trial-and-Error Roots via the Bisection Algorithm 152
7.9.1 Bisection Algorithm Implementation 153
7.10 Newton-Raphson Searching (A Faster Algorithm) 154
7.10.1 Newton-Raphson Algorithm with Backtracking 156
7.10.2 Newton-Raphson Algorithm Implementation 157
8 Solving Systems of Equations with Matrices;
Data Fitting 158
8.1 Unit I. Systems of Equations and Matrix Computing 158
8.2 Two Masses on a String 159
8.2.1 Statics (Theory) 160
8.2.2 Multidimensional Newton-Raphson Searching 160
contents xi
8.3 Classes of Matrix Problems (Math) 163
8.3.1 Practical Aspects of Matrix Computing 165
8.3.2 Implementation: Scientific Libraries, World Wide Web 168
8.3.3 JAMA: Java Matrix Library 169
8.3.4 Exercises for Testing Matrix Calls 173
8.3.5 Matrix Solution of the String Problem 175
8.3.6 Explorations 175
8.4 Unit II. Data Fitting 176
8.5 Fitting an Experimental Spectrum (Problem) 176
8.5.1 Lagrange Interpolation (Method) 177
8.5.2 Lagrange Implementation and Assessment 178
8.5.3 Explore Extrapolation 179
8.5.4 Cubic Splines (Method) 179
8.5.5 Spline Fit of Cross Section (Implementation) 182
8.6 Fitting Exponential Decay (Problem) 182
8.6.1 Theory to Fit 182
8.7 Least-Squares Fitting (Method) 184
8.7.1 Least-Squares Fitting: Theory and Implementation 186
8.7.2 Exponential Decay Fit Assessment 188
8.7.3 Exercise: Fitting Heat Flow 189
8.7.4 Linear Quadratic Fit (Extension) 190
8.7.5 Linear Quadratic Fit Assessment 191
8.7.6 Nonlinear Fit of the Breit-Wigner Formula to a Cross
Section " 191
9 Differential Equation Applications 194
9.1 Unit I. Free Nonlinear Oscillations 194
9.2 Nonlinear Oscillators (Models) 194
9.3 Types of Differential Equations (Math) 196
9.4 Dynamic Form for ODEs (Theory) 198
9.5 ODE Algorithms 200
9.5.1 Euler'sRule 201
9.5.2 Runge-Kutta Algorithm 202
9.5.3 Adams-Bashforth-Moulton Predictor-Corrector 204
9.5.4 Assessment: rk2 versus rk4 versus rk45 205
9.6 Solution for Nonlinear Oscillations (Assessment) 207
9.6.1 Precision Assessment: Energy Conservation 208
9.7 Extensions: Nonlinear Resonances, Beats, and
Friction 209
xii contents
9.7.1 Friction: Model and Implementation 209
9.7.2 Resonances and Beats: Model and Implementation 210
9.8 Implementation: Inclusion of Time-Dependent
Force 211
9.9 Unit II. Binding A Quantum Particle 212
9.10 The Quantum Eigenvalue Problem (Theory) 212
9.10.1 Nucleon in a Box (Model) 213
9.11 Combined Algorithms: Eigenvalues via ODE
Solver Plus Search 214
9.11.1 Numerov Algorithm for the Schrodinger ODE © 216
9.11.2 Implementation: Eigenvalues via an ODE Solver Plus
Bisection Algorithm 218
9.12 Explorations 221
9.13 Unit III. Scattering, Projectiles, and Planetary
Orbits 222
9.14 Problem 1: Classical Chaotic Scattering 222
9.14.1 Model and Theory 222
9.14.2 Implementation 224
9.14.3 Assessment 225
9.15 Problem 2: Balls Falling Out of the Sky 225
9.16 Theory: Projectile Motion with Drag 226
9.16.1 Simultaneous Second-Order ODEs 227
9.16.2 Assessment 228
9.17 Problem 3: Planetary Motion 228
9.17.1 Implementation: Planetary Motion 229
10 Fourier Analysis: Signals and Filters 231
10.1 Unit I. Fourier Analysis of Nonlinear Oscillations 231
10.2 Fourier Series (Math) 232
10.2,1 Example 1: Sawtooth Function 234
10.2.2 Example 2: Half-wave Function 235
10.3 Summation of Fourier Series (Exercise) 235
10.4 Fourier Transforms (Theory) / 236
10.4.1 Discrete Fourier Transform'Algorithm 237
10.4.2 Aliasing and Anti-aliasing © 241
10.4.3 DFT for Fourier Series (Algorithm) 243
10.4.4 Assessments 244
10.4.5 DFT of Nonperiodic Functions (Exploration) 246
contents xiii
10.5 Unit II. Filtering Noisy Signals 246
10.6 Noise Reduction via Autocorrelation (Theory) 246
10.6.1 Autocorrelation Function Exercises 249
10.7 Filtering with Transforms (Theory) 250
10.7.1 Digital Filters: Windowed Sine Filters © 253
10.8 Unit III. Fast Fourier Transform Algorithm o 256
10.8.1 Bit Reversal 258
10.9 FFT Implementation 259
10.10 FFT Assessment 263
T1 Wavelet Analysis & Data Compression 264
11.1 Unit I. Wavelet Basics 264
11.2 Wave Packets and Uncertainty Principle (Theory) 266
11.2.1 Wave Packet Assessment 268
11.3 Short-Time Fourier Transforms (Math) 268
11.4 The Wavelet Transform 269
11.4.1 Generating Wavelet Basis Functions 270
11.4.2 Continuous Wavelet Transform Implementation 273
11.5 Unit II. Discrete Wavelet Transform and
Multiresolution Analysis o 274
11.5.1 Pyramid Scheme Implementation © 279
11.5.2 Daubechies Wavelets via Filtering 283
11.5.3 DWT Implementation and Exercise 286
12 Discrete & Continuous Nonlinear Dynamics 289
12.1 Unit I. Bug Population Dynamics (Discrete) 289
12.2 The Logistic Map (Model) 289
12.3 Properties of Nonlinear Maps (Theory) 291
12.3.1 Fixed Points 291
12.3.2 Period Doubling, Attractors 292
12.4 Mapping Implementation 293
12.5 Bifurcation Diagram (Assessment) 294
12.5.1 Bifurcation Diagram Implementgtion 295
12.5.2 Visualization Algorithm: Binning 295
12.5.3 Feigenbaum Constants (Exploration) 297
12.6 Random Numbers via Logistic Map
(Exploration) © 297
12.7 Other Maps (Exploration) 298
xiv contents
12.8 Signals of Chaos: Lyapunov Coefficients o 298
12.8.1 Shannon Entropy © 299
12.9 Unit I Quiz 300
12.10 Unit II. Pendulums Become Chaotic (Continuous) 302
12.11 Chaotic Pendulum ODE 302
12.11.1 Free Pendulum Oscillations 303
12,11,2Solution as Elliptic Integrals 304
12,11.3 Implementation and Test: Free Pendulum 305
12.12 Visualization: Phase Space Orbits 305
12.12.1 Chaos in Phase Space 307
12.12.2 Assessment in Phase Space 311
12.13 Exploration: Bifurcations of Chaotic Pendulums 313
12.14 Alternative Problem: The Double Pendulum 315
12.15 Assessment: Fourier/Wavelet Analysis of Chaos 317
12.16 Exploration: Another Type of Phase Space Plot 317
12.17 Further Explorations 318
12.18 Unit III. Coupled Predator-Prey Models o 319
12.19 Lotka-Volterra Model 320
12.19.1 LVM with Prey Limit 321
1..19,2 LVM with Predation Efficiency 322
12.19,3 LVM Implementation and Assessment 323
12.19,4Two Predators, One Prey (Exploration) 324
13 Fractals & Statistical Growth 326
13.1 Fractional Dimension (Math) 326
13.2 The Sierpihski Gasket (Problem 1) 327
13.2.1 Sierpihski Implementation 328
13.2.2 Assessing Fractal Dimension 328
13.3 Beautiful Plants (Problem 2) 329
13.3.1 Self-affine Connection (Theory) 330
13.3.2 Barnsley's Fern Implementation 331
13.3.3 Self-affinity in Trees Implementation 332
13.4 Ballistic Deposition (Problem 3) , 332
13.4.1 Random Deposition Algorithm ' 332
13.5 Length of the British Coastline (Problem 4) 334
13.5.1 Coastlines as Fractals (Model) 334
13.5.2 Box Counting Algorithm 335
13.5.3 Coastline Implementation and Exercise 336
contents xv
13.6 Correlated Growth, Forests, and Films (Problem 5) 338
13,6,1 Correlated Ballistic Deposition Algorithm 338
13.7 Globular Cluster (Problem 6) 339
13.7.1 Diffusion-Limited Aggregation Algorithm 339
13.7.2 Fractal Analysis of a DLA (or Pollock)
Graph (Assessment) 342
13.8 Fractal Structures in a Bifurcation Graph
(Problem 7) 343
13.9 Fractals from Cellular Automata 343
13.10 Perlin Noise Adds Realism © 345
13.10.1 Including Ray Tracing 348
13.11 Quiz 351
14 High-Performance Computing Hardware,
Tuning, and Parallel Computing 352
14.1 Unit I. High-Performance Computers (CS) 352
14.2 Memory Hierarchy 353
14.3 The Central Processing Unit 357
14.4 CPU Design: Reduced Instruction Set Computer 357
14.5 CPU Design: Multiple-Core Processors 358
14.6 CPU Design: Vector Processor 359
14.7 Unit II. Parallel Computing 360
14.8 Parallel Semantics (Theory) 361
14.9 Distributed Memory Programming 363
14.10 Parallel Performance 365
14.10.1 Communication Overhead 367
14.11 Parallelization Strategy 368
14.12 Practical Aspects of Message Passing for MIMD 369
14,12.1 High-Level View of Message Passing 370
14.13 Example of a Supercomputer: IBM Blue Gene/L 372
14.14 Unit III. HPC Program Optimization 374
14.14.1 Programming for Virtual Memory (Method) 376
14.14.2Optimizing Programs; Java versus Fortran/C 376
14.14.3Experimental Effects of Hardware on
Performance 379
14.14.4Java versus Fortran/C 380
14.15 Programming for the Data Cache (Method) 385
14,15.1 Exercise 1: Cache Misses 386
xvi contents
14.15,2 Exercise 2: Cache Flow 387
14,15,3Exercise 3: Large-Matrix Multiplication 388
15 Thermodynamic Simulations & Feynman
Quantum Path Integration 390
15.1 Unit I. Magnets via the Metropolis Algorithm 390
15.2 An Ising Chain (Model) 390
15.3 Statistical Mechanics (Theory) 393
15,3,1 Analytic Solutions 393
15.4 Metropolis Algorithm 394
15.4.1 Metropolis Algorithm Implementation 397
15.4.2 Equilibration, Thermodynamic Properties (Assessment) 397
15.4.3 Beyond Nearest Neighbors and 1-D (Exploration) 400
15.5 Unit II. Magnets via Wang-Landau Sampling o 400
15.6 Wang-Landau Sampling 403
15.6.1 WLS Ising Model Implementation 405
15.6.2 WLS Ising Model Assessment 408
15.7 Unit III. Feynman Path Integrals 0 408
15.8 Feynman's Space-Time Propagation (Theory) 408
15.8.1 Bound-State Wave Function (Theory) 412
15.8.2 Lattice Path Integration (Algorithm) 413
15.8.3 Lattice Implementation 418
15.8.4 Assessment and Exploration 420
15.9 Exploration: Quantum Bouncer's Paths 0 421
16 Simulating Matter with Molecular Dynamics 424
16.1 Molecular Dynamics (Theory) 424
16.1.1 Connection to Thermodynamic Variables 428
16.1.2 Setting Initial Velocity Distribution 429
16.1.3 Periodic Boundary Conditions and Potential Cutoff 429
16.2 Verlet and Velocity-Verlet Algorithms 431
16.3 1 -D Implementation and Exercise 432
16.4 Trajectory Analysis 435
16.5 Quiz ' 436
17 PDEs for Electrostatics & Heat Flow 437
17.1 PDE Generalities 437
17.2 Unit I. Electrostatic Potentials 439
17.2.1 Laplace's Elliptic PDE (Theory) 439
contents xvii
17.3 Fourier Series Solution of a PDE 440
17.3.1 Polynomial Expansion As an Algorithm 442
17.4 Solution: Finite-Difference Method 443
17.4.1 Relaxation and Overrelaxation 445
17.4.2 Lattice PDE Implementation 446
17.5 Assessment via Surface Plot 447
17.6 Alternate Capacitor Problems 448
17.7 Implementation and Assessment 450
17.8 Electric Field Visualization (Exploration) 452
17.9 Laplace Quiz 452
17.10 Unit II. Finite-Element Method 0 453
17.11 Electric Field from Charge Density (Problem) 454
17.12 Analytic Solution 454
17.13 Finite-Element (Not Difference) Methods 455
17.13.1 Weak Form of PDE 455
17,13.2Galerkin Spectral Decomposition 456
17.14 FEM Implementation and Exercises 460
17.15 Exploration 463
17.16 Unit III. Heat Flow via Time-Stepping
(Leapfrogging) 463
17.17 The Parabolic Heat Equation (Theory) 463
17.17.1 Solution: Analytic Expansion 465
17.17.2Solution: Time-Stepping 466
17.17.3 Von Neumann Stability Assessment 468
17.17.4Heat Equation Implementation 470
17.18 Assessment and Visualization 470
17.19 Improved Heat Flow: Crank-Nicolson Method 472
17.19.1 Solution of Tridiagonal Matrix Equations 0 474
17.19.2Crank-Nicolson Method Implementation
and Assessment 476
18 PDE Waves: String, Quantum Packet, and E&M 478
18.1 Unit I. Vibrating String 478
18.2 The Hyperbolic Wave Equation (Theory) 478
18.2.1 Solution via Normal-Mode Expansion 480
18.2.2 Algorithm: Time-Stepping 481
18.2.3 Wave Equation Implementation 483
18.2.4 Assessment and Exploration 484
18.3 Waves with Friction (Extension) 486
xviii contents
18.4 Waves for Variable Tension and Density
(Extension) 487
18.4.1 Waves on a Catenary 488
18.4.2 Derivation of a Catenary Shape 488
18,4,3 Catenary and Frictional Wave Exercises 490
18.5 Unit II. Quantum Wave Packets 491
18.6 Time-Dependent Schrddinger Equation (Theory) 492
18.6.1 Finite-Difference Algorithm 493
18.6.2 Wave Packet Implementation and Animation 494
18.7 Wave Packets in Other Wells (Exploration) 496
18.8 Algorithm for the 2-D Schrddinger Equation 496
18.9 Unit III. E&M Waves via Finite-Difference
Time Domain 0 499
18.10 Maxwell's Equations 499
18.11 FDTD Algorithm 500
18.11.1 Implementation 503
18.11.2 Assessment 504
18.11.3 Extension: Circularly Polarized EM Waves 506
19 Solitons & Computational Fluid Dynamics 508
19.1 Unit I. Advection, Shocks, and Russell's Soliton 508
19.2 Theory: Continuity and Advection Equations 509
19.2.1 Advection Implementation 510
19.3 Theory: Shock Waves via Burgers' Equation 510
19.3.1 Algorithm: The Lax-Wendroff Method for Burgers'
Equation 511
19.3.2 Implementation and Assessment of Burgers' Shock
Equation 513
19.4 Including Dispersion 514
19.5 Shallow-Water Solitons, the KdeV Equation 515
19.5.1 Analytic Soliton Solution 517
19.5.2 Algorithm for KdeV Solitons 518
19.5.3 Implementation: KdeV Solitons 519
19.5.4 Exploration: Solitons in Phase Space'and Crossing 520
19.6 Unit II. River Hydrodynamics 521
19.7 Hydrodynamics, the Navier-Stokes
Equation (Theory) 521
19.7.1 Boundary Conditions for Parallel Plates 524
19.7.2 Analytic Solution for Parallel Plates 526
contents • xix
19.7.3 Finite-Difference Algorithm and Overrelaxation 527
19.7.4 Successive Overrelaxation Implementation 529
19.8 2-D Flow over a Beam 530
19.9 Theory: Vorticity Form of the Navier-Stokes
Equation 530
19.9.1 Finite Differences and the SOR Algorithm 532
19.9.2 Boundary Conditions for a Beam 534
19.9.3 SOR on a Grid Implementation 536
19.9.4 Assessment 538
19.9.5 Exploration 539
20 Integral Equations in Quantum Mechanics 540
20.1 Unit I. Bound States of Nonlocal Potentials 540
20.2 Momentum-Space Schrddinger Equation (Theory) 541
20.2.1 Integral to Linear Equations (Method) 542
20.2.2 Delta-Shell Potential (Model) 544
20.2.3 Binding Energies Implementation 544
20.2.4 Wave Function (Exploration) 546
20.3 Unit II. Nonlocal Potential Scattering 0 546
20.4 Lippmann-Schwinger Equation (Theory) 547
20.4.1 Singular Integrals (Math) 548
20.4.2 Numerical Principal Values 549
20.4.3 Reducing Integral Equations to Matrix-Equations
(Algorithm) 549
20.4.4 Solution via Inversion or Elimination 551
20.4.5 Scattering Implementation 552
20.4.6 Scattering Wave Function (Exploration) 553
Appendix A: Glossary 555
Appendix B: Installing Packages 562
B.I Installing Java Developer's Kit 564
B.2 Using Classes and Packages 565
B.2,1 Including Packages '. 565
Appendix C: OpenDX: Industrial-Strength Data
Visualization 568
C.I Getting DX and Unix Running (for Windows) 569
C.2 Test Drive of DX Visual Programming 569
xx . contents
C.3 DX Tools Summary 576
C.4 DX Data Structure and Storage 577
C.5 Sample Visual Programs 579
C.5.1 Sample 1: Linear Plot 579
C.5.2 Sample 2: Fourier Transform 580
C.5.3 Sample 3: Potential of a 2-D Capacitor 580
C.5.4 Sample 4: Vector Field Plots 581
C.5.5 Sample 5: 3-D Scalar Potentials 582
C.5.6 Sample 6: 3-D Functions, the Hydrogen Atom 585
C.6 Animations with OpenDX 586
C.6.1 Scripted Animation with OpenDX 588
C.6.2 Wave Packet and Slit Animation 591
Appendix D: An MPI Tutorial 593
D.I Running on a Beowulf 593
D.2 Running MPI 597
D.2.1 MPI under the SGE Queueing System 598
D.2.2 MPI Under the Torque/PBS Queueing System 600
D.2.3 Running Parallel Jobs with Torque 602
D.3 Your First MPI Program: MPIhello.c 604
D.3.1 MPIhello.c Explained 605
D.3.2 Send/Receive Messages: MPImessage2,c 606
D.3.3 Receive More Messages: MPImessage3.c 608
D.3.4 Broadcast Messages 609
D.3.5 Exercise 610
D.4 Parallel Tuning 611
D.5 A String Vibrating in Parallel 614
D.5.1 MPIstring.c Exercise 617
D.6 Deadlock 618
D.6.1 Nonblocking Communication 619
D.6.2 Collective Communication 619
D.7 Bootable Cluster CD 0 620
D.8 Parallel Computing Exercises 620
D.9 List of MPI Commands < 621
Appendix E: Calling LAPACK from C 623
E.I Calling LAPACK Fortran from C 624
E.2 Compiling C Programs with Fortran Calls 625
contents xxi
Appendix F: Software on the CD 626
Appendix G: Compression via DWT
with Thresholding 635
G.I More on Thresholding 637
G.2 Wavelet Implementation and Assessment 638
Bibliography 641
Index 651

More Related Content

Similar to A Survey Of Computational Physics Introductory Computational Science

FINALTeam5 SPDRSAT Final Report
FINALTeam5 SPDRSAT Final ReportFINALTeam5 SPDRSAT Final Report
FINALTeam5 SPDRSAT Final ReportJeffrey Lehrer
 
Computer Science syllabus
Computer Science syllabusComputer Science syllabus
Computer Science syllabusShivaraj Hugar
 
eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...
eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...
eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...EdwinPolack1
 
Contents-Adv Structural Analysis-AKJ
Contents-Adv Structural Analysis-AKJContents-Adv Structural Analysis-AKJ
Contents-Adv Structural Analysis-AKJAshok K. Jain
 
Shor's discrete logarithm quantum algorithm for elliptic curves
 Shor's discrete logarithm quantum algorithm for elliptic curves Shor's discrete logarithm quantum algorithm for elliptic curves
Shor's discrete logarithm quantum algorithm for elliptic curvesXequeMateShannon
 
NOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODS
NOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODSNOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODS
NOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODSCanh Le
 
bachelors_thesis_stephensen1987
bachelors_thesis_stephensen1987bachelors_thesis_stephensen1987
bachelors_thesis_stephensen1987Hans Jacob Teglbj
 
65487681 60444264-engineering-optimization-theory-and-practice-4th-edition
65487681 60444264-engineering-optimization-theory-and-practice-4th-edition65487681 60444264-engineering-optimization-theory-and-practice-4th-edition
65487681 60444264-engineering-optimization-theory-and-practice-4th-editionAshish Arora
 
ML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docx
ML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docxML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docx
ML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docxaudeleypearl
 
Programacion multiobjetivo
Programacion multiobjetivoProgramacion multiobjetivo
Programacion multiobjetivoDiego Bass
 
Madda walabu university
Madda walabu universityMadda walabu university
Madda walabu universityLenchoDuguma
 
Certificates for bist including index
Certificates for bist including indexCertificates for bist including index
Certificates for bist including indexPrabhu Kiran
 
J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...
J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...
J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...esmaeelghafari2
 
Ph d jurgenvangorp
Ph d jurgenvangorpPh d jurgenvangorp
Ph d jurgenvangorpnazir1988
 
Automatización de sistemas de fabricación con PLC.pdf
Automatización de sistemas de fabricación con PLC.pdfAutomatización de sistemas de fabricación con PLC.pdf
Automatización de sistemas de fabricación con PLC.pdfSANTIAGO PABLO ALBERTO
 
Studio 3 Geology Training Manual.pdf
Studio 3 Geology Training Manual.pdfStudio 3 Geology Training Manual.pdf
Studio 3 Geology Training Manual.pdfRonaldQuispePerez2
 

Similar to A Survey Of Computational Physics Introductory Computational Science (20)

FINALTeam5 SPDRSAT Final Report
FINALTeam5 SPDRSAT Final ReportFINALTeam5 SPDRSAT Final Report
FINALTeam5 SPDRSAT Final Report
 
Computer Science syllabus
Computer Science syllabusComputer Science syllabus
Computer Science syllabus
 
eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...
eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...
eBook PDF textbook - Data Structures and Algorithm Analysis in Java, 3e Mark ...
 
Contents-Adv Structural Analysis-AKJ
Contents-Adv Structural Analysis-AKJContents-Adv Structural Analysis-AKJ
Contents-Adv Structural Analysis-AKJ
 
Variation response method CAE simulation suite
Variation response method CAE simulation suiteVariation response method CAE simulation suite
Variation response method CAE simulation suite
 
Shor's discrete logarithm quantum algorithm for elliptic curves
 Shor's discrete logarithm quantum algorithm for elliptic curves Shor's discrete logarithm quantum algorithm for elliptic curves
Shor's discrete logarithm quantum algorithm for elliptic curves
 
Jung.Rapport
Jung.RapportJung.Rapport
Jung.Rapport
 
NOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODS
NOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODSNOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODS
NOVEL NUMERICAL PROCEDURES FOR LIMIT ANALYSIS OF STRUCTURES: MESH-FREE METHODS
 
bachelors_thesis_stephensen1987
bachelors_thesis_stephensen1987bachelors_thesis_stephensen1987
bachelors_thesis_stephensen1987
 
65487681 60444264-engineering-optimization-theory-and-practice-4th-edition
65487681 60444264-engineering-optimization-theory-and-practice-4th-edition65487681 60444264-engineering-optimization-theory-and-practice-4th-edition
65487681 60444264-engineering-optimization-theory-and-practice-4th-edition
 
Agenda ANSYS training
Agenda ANSYS trainingAgenda ANSYS training
Agenda ANSYS training
 
ML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docx
ML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docxML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docx
ML Project(by-Ethem-Alpaydin)-Introduction-to-Machine-Learni-24.docx
 
Programacion multiobjetivo
Programacion multiobjetivoProgramacion multiobjetivo
Programacion multiobjetivo
 
Madda walabu university
Madda walabu universityMadda walabu university
Madda walabu university
 
Certificates for bist including index
Certificates for bist including indexCertificates for bist including index
Certificates for bist including index
 
Pinch analysis Book.pdf
Pinch analysis Book.pdfPinch analysis Book.pdf
Pinch analysis Book.pdf
 
J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...
J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...
J._Austin_Cottrell_Thomas_J.R._Hughes_Yuri_Bazilevs-Isogeometric_Analysis__To...
 
Ph d jurgenvangorp
Ph d jurgenvangorpPh d jurgenvangorp
Ph d jurgenvangorp
 
Automatización de sistemas de fabricación con PLC.pdf
Automatización de sistemas de fabricación con PLC.pdfAutomatización de sistemas de fabricación con PLC.pdf
Automatización de sistemas de fabricación con PLC.pdf
 
Studio 3 Geology Training Manual.pdf
Studio 3 Geology Training Manual.pdfStudio 3 Geology Training Manual.pdf
Studio 3 Geology Training Manual.pdf
 

More from Courtney Esco

I Need Someone To Write My Essay - UK Essay Writing
I Need Someone To Write My Essay - UK Essay WritingI Need Someone To Write My Essay - UK Essay Writing
I Need Someone To Write My Essay - UK Essay WritingCourtney Esco
 
Do Urgent Essay Writing ,Research Writing ,Summary And Report Writi
Do Urgent Essay Writing ,Research Writing ,Summary And Report WritiDo Urgent Essay Writing ,Research Writing ,Summary And Report Writi
Do Urgent Essay Writing ,Research Writing ,Summary And Report WritiCourtney Esco
 
003 Compare And Contrast Essay Intro Example Fres
003 Compare And Contrast Essay Intro Example Fres003 Compare And Contrast Essay Intro Example Fres
003 Compare And Contrast Essay Intro Example FresCourtney Esco
 
Pencil And Paper Games For Kids Fo
Pencil And Paper Games For Kids FoPencil And Paper Games For Kids Fo
Pencil And Paper Games For Kids FoCourtney Esco
 
Essay Written For Me. Do Essay For Me Write Essay
Essay Written For Me. Do Essay For Me Write EssayEssay Written For Me. Do Essay For Me Write Essay
Essay Written For Me. Do Essay For Me Write EssayCourtney Esco
 
ValentineS Day Writing Paper Heart Writing Pape
ValentineS Day Writing Paper Heart Writing PapeValentineS Day Writing Paper Heart Writing Pape
ValentineS Day Writing Paper Heart Writing PapeCourtney Esco
 
Cloud Writing Paper - Printable Teaching Resources - Print Play Learn
Cloud Writing Paper - Printable Teaching Resources - Print Play LearnCloud Writing Paper - Printable Teaching Resources - Print Play Learn
Cloud Writing Paper - Printable Teaching Resources - Print Play LearnCourtney Esco
 
Literature Review Example Harvard Style
Literature Review Example Harvard StyleLiterature Review Example Harvard Style
Literature Review Example Harvard StyleCourtney Esco
 
When I Look Back To My First Experience Teaching Five P
When I Look Back To My First Experience Teaching Five PWhen I Look Back To My First Experience Teaching Five P
When I Look Back To My First Experience Teaching Five PCourtney Esco
 
ACS Citation Sample By Annotatedbib-S
ACS Citation Sample By Annotatedbib-SACS Citation Sample By Annotatedbib-S
ACS Citation Sample By Annotatedbib-SCourtney Esco
 
WhoLl Generate Eyes Watching Go
WhoLl Generate Eyes Watching GoWhoLl Generate Eyes Watching Go
WhoLl Generate Eyes Watching GoCourtney Esco
 
Thesis Essay Examples Telegr
Thesis Essay Examples  TelegrThesis Essay Examples  Telegr
Thesis Essay Examples TelegrCourtney Esco
 
010 English Essays Essay Example Student ~ Thatsn
010 English Essays Essay Example Student ~ Thatsn010 English Essays Essay Example Student ~ Thatsn
010 English Essays Essay Example Student ~ ThatsnCourtney Esco
 
Free Printable Polar Bear Craftivity Creative Writin
Free Printable Polar Bear Craftivity  Creative WritinFree Printable Polar Bear Craftivity  Creative Writin
Free Printable Polar Bear Craftivity Creative WritinCourtney Esco
 
Write My Apa Paper For Me For Free Write My Paper Fo
Write My Apa Paper For Me For Free Write My Paper FoWrite My Apa Paper For Me For Free Write My Paper Fo
Write My Apa Paper For Me For Free Write My Paper FoCourtney Esco
 
How Important It Is To Help Others Who Are In Need F
How Important It Is To Help Others Who Are In Need FHow Important It Is To Help Others Who Are In Need F
How Important It Is To Help Others Who Are In Need FCourtney Esco
 
🏷️ Ama Essay Format Example. AMA Style Form
🏷️ Ama Essay Format Example. AMA Style Form🏷️ Ama Essay Format Example. AMA Style Form
🏷️ Ama Essay Format Example. AMA Style FormCourtney Esco
 
Printable Paper With Lines For Wr
Printable Paper With Lines For WrPrintable Paper With Lines For Wr
Printable Paper With Lines For WrCourtney Esco
 

More from Courtney Esco (20)

I Need Someone To Write My Essay - UK Essay Writing
I Need Someone To Write My Essay - UK Essay WritingI Need Someone To Write My Essay - UK Essay Writing
I Need Someone To Write My Essay - UK Essay Writing
 
Do Urgent Essay Writing ,Research Writing ,Summary And Report Writi
Do Urgent Essay Writing ,Research Writing ,Summary And Report WritiDo Urgent Essay Writing ,Research Writing ,Summary And Report Writi
Do Urgent Essay Writing ,Research Writing ,Summary And Report Writi
 
003 Compare And Contrast Essay Intro Example Fres
003 Compare And Contrast Essay Intro Example Fres003 Compare And Contrast Essay Intro Example Fres
003 Compare And Contrast Essay Intro Example Fres
 
Pencil And Paper Games For Kids Fo
Pencil And Paper Games For Kids FoPencil And Paper Games For Kids Fo
Pencil And Paper Games For Kids Fo
 
Essay Written For Me. Do Essay For Me Write Essay
Essay Written For Me. Do Essay For Me Write EssayEssay Written For Me. Do Essay For Me Write Essay
Essay Written For Me. Do Essay For Me Write Essay
 
ValentineS Day Writing Paper Heart Writing Pape
ValentineS Day Writing Paper Heart Writing PapeValentineS Day Writing Paper Heart Writing Pape
ValentineS Day Writing Paper Heart Writing Pape
 
Speech Sample Essay
Speech Sample EssaySpeech Sample Essay
Speech Sample Essay
 
Cloud Writing Paper - Printable Teaching Resources - Print Play Learn
Cloud Writing Paper - Printable Teaching Resources - Print Play LearnCloud Writing Paper - Printable Teaching Resources - Print Play Learn
Cloud Writing Paper - Printable Teaching Resources - Print Play Learn
 
Literature Review Example Harvard Style
Literature Review Example Harvard StyleLiterature Review Example Harvard Style
Literature Review Example Harvard Style
 
When I Look Back To My First Experience Teaching Five P
When I Look Back To My First Experience Teaching Five PWhen I Look Back To My First Experience Teaching Five P
When I Look Back To My First Experience Teaching Five P
 
Buy Essay
Buy EssayBuy Essay
Buy Essay
 
ACS Citation Sample By Annotatedbib-S
ACS Citation Sample By Annotatedbib-SACS Citation Sample By Annotatedbib-S
ACS Citation Sample By Annotatedbib-S
 
WhoLl Generate Eyes Watching Go
WhoLl Generate Eyes Watching GoWhoLl Generate Eyes Watching Go
WhoLl Generate Eyes Watching Go
 
Thesis Essay Examples Telegr
Thesis Essay Examples  TelegrThesis Essay Examples  Telegr
Thesis Essay Examples Telegr
 
010 English Essays Essay Example Student ~ Thatsn
010 English Essays Essay Example Student ~ Thatsn010 English Essays Essay Example Student ~ Thatsn
010 English Essays Essay Example Student ~ Thatsn
 
Free Printable Polar Bear Craftivity Creative Writin
Free Printable Polar Bear Craftivity  Creative WritinFree Printable Polar Bear Craftivity  Creative Writin
Free Printable Polar Bear Craftivity Creative Writin
 
Write My Apa Paper For Me For Free Write My Paper Fo
Write My Apa Paper For Me For Free Write My Paper FoWrite My Apa Paper For Me For Free Write My Paper Fo
Write My Apa Paper For Me For Free Write My Paper Fo
 
How Important It Is To Help Others Who Are In Need F
How Important It Is To Help Others Who Are In Need FHow Important It Is To Help Others Who Are In Need F
How Important It Is To Help Others Who Are In Need F
 
🏷️ Ama Essay Format Example. AMA Style Form
🏷️ Ama Essay Format Example. AMA Style Form🏷️ Ama Essay Format Example. AMA Style Form
🏷️ Ama Essay Format Example. AMA Style Form
 
Printable Paper With Lines For Wr
Printable Paper With Lines For WrPrintable Paper With Lines For Wr
Printable Paper With Lines For Wr
 

Recently uploaded

Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfYibeltalNibretu
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasGeoBlogs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxricssacare
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPCeline George
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativePeter Windle
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxJisc
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...Jisc
 

Recently uploaded (20)

Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

A Survey Of Computational Physics Introductory Computational Science

  • 1. A Survey of Computational Physics Introductory Computational Science Rubin H. Landau Manuel Jose Paez Cristian C. Bordeianu PRINCETON UNIVERSITY PRESS • PRINCETON AND OXFORD
  • 2. CONTENTS Preface xxiii Computational Science Basics 1 1.1 Computational Physics and Science l 1.2 How to Read and Use This Book 3 1.3 Making Computers Obey; Languages (Theory) 6 1.4 Programming Warmup 8 1.4.1 Structured Program Design 10 1.4.2 Shells, Editors, and Execution 11 1.4.3 Java I/O, Scanner Class with printf 12 1.4.4 I/O Redirection 12 1.4.5 Command-Line Input 13 1.4.6 I/O Exceptions: FileCatchThrowJava 14 1.4.7 Automatic Code Documentation o 16 1.5 Computer Number Representations (Theory) 17 1.5.1 IEEE Floating-Point Numbers 18 1.5.2 Over/Underflows Exercises 24 1.5.3 Machine Precision (Model) 25 1.5.4 Determine Your Machine Precision 27 1.6 Problem: Summing Series 27 1.6.1 Numerical Summation (Method) 28 1.6.2 Implementation and Assessment 29 Errors & Uncertainties in Computations 30 2.1 Types of Errors (Theory) 30 2.1.1 Model for Disaster: Subtractive Cancellation 32 2.1.2 Subtractive Cancellation Exercises 33 2.1.3 Round-off Error in a Single Step 34 2.1.4 Round-off Error Accumulation After Many Steps 35 2.2 Errors in Spherical Bessel Functions (Problem) 36 2.2.1 Numerical Recursion Relations (Method) 36 2.2.2 Implementation and Assessment: Recursion Relations 38
  • 3. viii contents 2.3 Experimental Error Investigation (Problem) 39 2.3.1 Error Assessment 43 3 Visualization Tools 45 3.1 Data Visualization 45 3.2 PtPlot: 2-D Graphs Within Java 46 3.3 Grace/ACE: Superb 2-D Graphs for Unix/Linux 51 3.3.1 Grace Basics 51 3.4 Gnuplot: Reliable 2-D and 3-D Plots 56 3.4.1 Gnuplot Input Data Format © 58 3.4.2 Printing Plots 59 3.4.3 Gnuplot Surface (3-D) Plots 60 3.4.4 Gnuplot Vector Fields 62 3.4.5 Animations from a Plotting Program (Gnuplot) 0 64 3.5 OpenDX for Dicing and Slicing 65 3.6 Texturing and 3-D Imaging 65 4 Object-Oriented Progronns: Impedance & Batons 67 4.1 Unit I. Basic Objects: Complex Impedance 67 4.2 Complex Numbers (Math) 67 4.3 Resistance Becomes Impedance (Theory) 70 4.4 Abstract Data Structures, Objects (CS) 70 4.4.1 Object Declaration and Construction 72 4.4.2 Implementation in Java 73 4.4.3 Static and Nonstatic Methods 76 4.4.4 Nonstatic Methods 77 4.5 Complex Currents (Solution) 79 4.6 OOP Worked Examples 80 4.6.1 OOP Beats 80 4.6.2 OOP Planet 82 4.7 Unit II. Advanced Objects: Baton Projectiles 0 85 4.8 Trajectory of a Thrown Baton (Problem) 86 4.8.1 Combined Translation and Rotation (Theory) 86 4.9 OOP Design Concepts (CS) 89 4.9.1 Including Multiple Classes 90 4.9.2 Ball and Path Class Implementation 92 4.9.3 Composition, Objects Within Objects 93 4.9.4 Baton Class Implementation 94
  • 4. contents ix 4.9.5 Composition Exercise 95 4.9.6 Calculating the Baton's Energy (Extension) 96 4.9.7 Examples of Inheritance and Object Hierarchies 98 4.9.8 Baton with a Lead Weight (Application) 99 4.9.9 Encapsulation to Protect Classes 100 4.9.10 Encapsulation Exercise 101 4.9.11 Complex Object Interface (Extension) 102 4.9.12 Polymorphism, Variable Multityping 104 4.10 Supplementary Exercises 105 4.11 OOP Example: Superposition of Motions 105 4.12 Newton's Laws of Motion (Theory) 106 4.13 OOP Class Structure (Method) 106 4.14 Java Implementation 107 Monte Carlo Simulations (Nonthermal) 109 5.1 Unit I. Deterministic Randomness 109 5.2 Random Sequences (Theory) 109 5.2.1 Random-Number Generation (Algorithm) 110 5.2.2 Implementation: Random Sequence 113 5.2.3 Assessing Randomness and Uniformity 114 5.3 Unit II. Monte Carlo Applications 116 5.4 A Random Wai k (Problem) 116 5.4.1 Random-Walk Simulation 116 5.4.2 Implementation: Random Walk 117 5.5 Radioactive Decay (Problem) 119 5.5.1 Discrete Decay (Model) 119 5.5.2 Continuous Decay (Model) 120 5.5.3 Decay Simulation 121 5.6 Decay Implementation and Visualization 122 Integration 123 6.1 Integrating a Spectrum (Problem) 123 6.2 Quadrature as Box Counting (Math) 123 6.2.1 Algorithm: Trapezoid Rule 125 6.2.2 Algorithm: Simpson's Rule 126 6.2.3 Integration Error (Analytic Assessment) 128 6.2.4 Algorithm: Gaussian Quadrature 130 6.2.5 Integration Implementation and Error Assessment 132
  • 5. x contents 6.3 Experimentation 135 6.4 Higher-Order Rules (Algorithm) 135 6.5 Monte Carlo Integration by Stone Throwing 136 6.5.1 Stone Throwing Implementation 136 6.5.2 Integration by Mean Value (Math) 137 6.6 High-Dimensional Integration (Problem) 138 6.6.1 Multidimensional Monte Carlo 139 6.6.2 Error in Multidimensional Integration (Assessment) 139 6.6.3 Implementation: 10-D Monte Carlo Integration 139 6.7 Integrating Rapidly Varying Functions (Problem) 140 6.7.1 Variance Reduction (Method) 140 6.7.2 Importance Sampling (Method) 140 6.7.3 Von Neumann Rejection (Method) 141 6.7.4 Simple Gaussian Distribution 141 6.8 Nonuniform Assessment © 142 6.8.1 Implementation: Nonuniform Randomness © 142 7 Differentiation & Searching 146 7.1 Unit I. Numerical Differentiation 146 7.2 Forward Difference (Algorithm) 147 7.3 Central Difference (Algorithm) 148 7.4 Extrapolated Difference (Method) 149 7.5 Error Analysis (Assessment) 149 7.6 Second Derivatives (Problem) 151 7.6.1 Second-Derivative Assessment 151 7.7 Unit II. Trial-and-Error Searching 151 7.8 Quantum States in a Square Well (Problem) 152 7.9 Trial-and-Error Roots via the Bisection Algorithm 152 7.9.1 Bisection Algorithm Implementation 153 7.10 Newton-Raphson Searching (A Faster Algorithm) 154 7.10.1 Newton-Raphson Algorithm with Backtracking 156 7.10.2 Newton-Raphson Algorithm Implementation 157 8 Solving Systems of Equations with Matrices; Data Fitting 158 8.1 Unit I. Systems of Equations and Matrix Computing 158 8.2 Two Masses on a String 159 8.2.1 Statics (Theory) 160 8.2.2 Multidimensional Newton-Raphson Searching 160
  • 6. contents xi 8.3 Classes of Matrix Problems (Math) 163 8.3.1 Practical Aspects of Matrix Computing 165 8.3.2 Implementation: Scientific Libraries, World Wide Web 168 8.3.3 JAMA: Java Matrix Library 169 8.3.4 Exercises for Testing Matrix Calls 173 8.3.5 Matrix Solution of the String Problem 175 8.3.6 Explorations 175 8.4 Unit II. Data Fitting 176 8.5 Fitting an Experimental Spectrum (Problem) 176 8.5.1 Lagrange Interpolation (Method) 177 8.5.2 Lagrange Implementation and Assessment 178 8.5.3 Explore Extrapolation 179 8.5.4 Cubic Splines (Method) 179 8.5.5 Spline Fit of Cross Section (Implementation) 182 8.6 Fitting Exponential Decay (Problem) 182 8.6.1 Theory to Fit 182 8.7 Least-Squares Fitting (Method) 184 8.7.1 Least-Squares Fitting: Theory and Implementation 186 8.7.2 Exponential Decay Fit Assessment 188 8.7.3 Exercise: Fitting Heat Flow 189 8.7.4 Linear Quadratic Fit (Extension) 190 8.7.5 Linear Quadratic Fit Assessment 191 8.7.6 Nonlinear Fit of the Breit-Wigner Formula to a Cross Section " 191 9 Differential Equation Applications 194 9.1 Unit I. Free Nonlinear Oscillations 194 9.2 Nonlinear Oscillators (Models) 194 9.3 Types of Differential Equations (Math) 196 9.4 Dynamic Form for ODEs (Theory) 198 9.5 ODE Algorithms 200 9.5.1 Euler'sRule 201 9.5.2 Runge-Kutta Algorithm 202 9.5.3 Adams-Bashforth-Moulton Predictor-Corrector 204 9.5.4 Assessment: rk2 versus rk4 versus rk45 205 9.6 Solution for Nonlinear Oscillations (Assessment) 207 9.6.1 Precision Assessment: Energy Conservation 208 9.7 Extensions: Nonlinear Resonances, Beats, and Friction 209
  • 7. xii contents 9.7.1 Friction: Model and Implementation 209 9.7.2 Resonances and Beats: Model and Implementation 210 9.8 Implementation: Inclusion of Time-Dependent Force 211 9.9 Unit II. Binding A Quantum Particle 212 9.10 The Quantum Eigenvalue Problem (Theory) 212 9.10.1 Nucleon in a Box (Model) 213 9.11 Combined Algorithms: Eigenvalues via ODE Solver Plus Search 214 9.11.1 Numerov Algorithm for the Schrodinger ODE © 216 9.11.2 Implementation: Eigenvalues via an ODE Solver Plus Bisection Algorithm 218 9.12 Explorations 221 9.13 Unit III. Scattering, Projectiles, and Planetary Orbits 222 9.14 Problem 1: Classical Chaotic Scattering 222 9.14.1 Model and Theory 222 9.14.2 Implementation 224 9.14.3 Assessment 225 9.15 Problem 2: Balls Falling Out of the Sky 225 9.16 Theory: Projectile Motion with Drag 226 9.16.1 Simultaneous Second-Order ODEs 227 9.16.2 Assessment 228 9.17 Problem 3: Planetary Motion 228 9.17.1 Implementation: Planetary Motion 229 10 Fourier Analysis: Signals and Filters 231 10.1 Unit I. Fourier Analysis of Nonlinear Oscillations 231 10.2 Fourier Series (Math) 232 10.2,1 Example 1: Sawtooth Function 234 10.2.2 Example 2: Half-wave Function 235 10.3 Summation of Fourier Series (Exercise) 235 10.4 Fourier Transforms (Theory) / 236 10.4.1 Discrete Fourier Transform'Algorithm 237 10.4.2 Aliasing and Anti-aliasing © 241 10.4.3 DFT for Fourier Series (Algorithm) 243 10.4.4 Assessments 244 10.4.5 DFT of Nonperiodic Functions (Exploration) 246
  • 8. contents xiii 10.5 Unit II. Filtering Noisy Signals 246 10.6 Noise Reduction via Autocorrelation (Theory) 246 10.6.1 Autocorrelation Function Exercises 249 10.7 Filtering with Transforms (Theory) 250 10.7.1 Digital Filters: Windowed Sine Filters © 253 10.8 Unit III. Fast Fourier Transform Algorithm o 256 10.8.1 Bit Reversal 258 10.9 FFT Implementation 259 10.10 FFT Assessment 263 T1 Wavelet Analysis & Data Compression 264 11.1 Unit I. Wavelet Basics 264 11.2 Wave Packets and Uncertainty Principle (Theory) 266 11.2.1 Wave Packet Assessment 268 11.3 Short-Time Fourier Transforms (Math) 268 11.4 The Wavelet Transform 269 11.4.1 Generating Wavelet Basis Functions 270 11.4.2 Continuous Wavelet Transform Implementation 273 11.5 Unit II. Discrete Wavelet Transform and Multiresolution Analysis o 274 11.5.1 Pyramid Scheme Implementation © 279 11.5.2 Daubechies Wavelets via Filtering 283 11.5.3 DWT Implementation and Exercise 286 12 Discrete & Continuous Nonlinear Dynamics 289 12.1 Unit I. Bug Population Dynamics (Discrete) 289 12.2 The Logistic Map (Model) 289 12.3 Properties of Nonlinear Maps (Theory) 291 12.3.1 Fixed Points 291 12.3.2 Period Doubling, Attractors 292 12.4 Mapping Implementation 293 12.5 Bifurcation Diagram (Assessment) 294 12.5.1 Bifurcation Diagram Implementgtion 295 12.5.2 Visualization Algorithm: Binning 295 12.5.3 Feigenbaum Constants (Exploration) 297 12.6 Random Numbers via Logistic Map (Exploration) © 297 12.7 Other Maps (Exploration) 298
  • 9. xiv contents 12.8 Signals of Chaos: Lyapunov Coefficients o 298 12.8.1 Shannon Entropy © 299 12.9 Unit I Quiz 300 12.10 Unit II. Pendulums Become Chaotic (Continuous) 302 12.11 Chaotic Pendulum ODE 302 12.11.1 Free Pendulum Oscillations 303 12,11,2Solution as Elliptic Integrals 304 12,11.3 Implementation and Test: Free Pendulum 305 12.12 Visualization: Phase Space Orbits 305 12.12.1 Chaos in Phase Space 307 12.12.2 Assessment in Phase Space 311 12.13 Exploration: Bifurcations of Chaotic Pendulums 313 12.14 Alternative Problem: The Double Pendulum 315 12.15 Assessment: Fourier/Wavelet Analysis of Chaos 317 12.16 Exploration: Another Type of Phase Space Plot 317 12.17 Further Explorations 318 12.18 Unit III. Coupled Predator-Prey Models o 319 12.19 Lotka-Volterra Model 320 12.19.1 LVM with Prey Limit 321 1..19,2 LVM with Predation Efficiency 322 12.19,3 LVM Implementation and Assessment 323 12.19,4Two Predators, One Prey (Exploration) 324 13 Fractals & Statistical Growth 326 13.1 Fractional Dimension (Math) 326 13.2 The Sierpihski Gasket (Problem 1) 327 13.2.1 Sierpihski Implementation 328 13.2.2 Assessing Fractal Dimension 328 13.3 Beautiful Plants (Problem 2) 329 13.3.1 Self-affine Connection (Theory) 330 13.3.2 Barnsley's Fern Implementation 331 13.3.3 Self-affinity in Trees Implementation 332 13.4 Ballistic Deposition (Problem 3) , 332 13.4.1 Random Deposition Algorithm ' 332 13.5 Length of the British Coastline (Problem 4) 334 13.5.1 Coastlines as Fractals (Model) 334 13.5.2 Box Counting Algorithm 335 13.5.3 Coastline Implementation and Exercise 336
  • 10. contents xv 13.6 Correlated Growth, Forests, and Films (Problem 5) 338 13,6,1 Correlated Ballistic Deposition Algorithm 338 13.7 Globular Cluster (Problem 6) 339 13.7.1 Diffusion-Limited Aggregation Algorithm 339 13.7.2 Fractal Analysis of a DLA (or Pollock) Graph (Assessment) 342 13.8 Fractal Structures in a Bifurcation Graph (Problem 7) 343 13.9 Fractals from Cellular Automata 343 13.10 Perlin Noise Adds Realism © 345 13.10.1 Including Ray Tracing 348 13.11 Quiz 351 14 High-Performance Computing Hardware, Tuning, and Parallel Computing 352 14.1 Unit I. High-Performance Computers (CS) 352 14.2 Memory Hierarchy 353 14.3 The Central Processing Unit 357 14.4 CPU Design: Reduced Instruction Set Computer 357 14.5 CPU Design: Multiple-Core Processors 358 14.6 CPU Design: Vector Processor 359 14.7 Unit II. Parallel Computing 360 14.8 Parallel Semantics (Theory) 361 14.9 Distributed Memory Programming 363 14.10 Parallel Performance 365 14.10.1 Communication Overhead 367 14.11 Parallelization Strategy 368 14.12 Practical Aspects of Message Passing for MIMD 369 14,12.1 High-Level View of Message Passing 370 14.13 Example of a Supercomputer: IBM Blue Gene/L 372 14.14 Unit III. HPC Program Optimization 374 14.14.1 Programming for Virtual Memory (Method) 376 14.14.2Optimizing Programs; Java versus Fortran/C 376 14.14.3Experimental Effects of Hardware on Performance 379 14.14.4Java versus Fortran/C 380 14.15 Programming for the Data Cache (Method) 385 14,15.1 Exercise 1: Cache Misses 386
  • 11. xvi contents 14.15,2 Exercise 2: Cache Flow 387 14,15,3Exercise 3: Large-Matrix Multiplication 388 15 Thermodynamic Simulations & Feynman Quantum Path Integration 390 15.1 Unit I. Magnets via the Metropolis Algorithm 390 15.2 An Ising Chain (Model) 390 15.3 Statistical Mechanics (Theory) 393 15,3,1 Analytic Solutions 393 15.4 Metropolis Algorithm 394 15.4.1 Metropolis Algorithm Implementation 397 15.4.2 Equilibration, Thermodynamic Properties (Assessment) 397 15.4.3 Beyond Nearest Neighbors and 1-D (Exploration) 400 15.5 Unit II. Magnets via Wang-Landau Sampling o 400 15.6 Wang-Landau Sampling 403 15.6.1 WLS Ising Model Implementation 405 15.6.2 WLS Ising Model Assessment 408 15.7 Unit III. Feynman Path Integrals 0 408 15.8 Feynman's Space-Time Propagation (Theory) 408 15.8.1 Bound-State Wave Function (Theory) 412 15.8.2 Lattice Path Integration (Algorithm) 413 15.8.3 Lattice Implementation 418 15.8.4 Assessment and Exploration 420 15.9 Exploration: Quantum Bouncer's Paths 0 421 16 Simulating Matter with Molecular Dynamics 424 16.1 Molecular Dynamics (Theory) 424 16.1.1 Connection to Thermodynamic Variables 428 16.1.2 Setting Initial Velocity Distribution 429 16.1.3 Periodic Boundary Conditions and Potential Cutoff 429 16.2 Verlet and Velocity-Verlet Algorithms 431 16.3 1 -D Implementation and Exercise 432 16.4 Trajectory Analysis 435 16.5 Quiz ' 436 17 PDEs for Electrostatics & Heat Flow 437 17.1 PDE Generalities 437 17.2 Unit I. Electrostatic Potentials 439 17.2.1 Laplace's Elliptic PDE (Theory) 439
  • 12. contents xvii 17.3 Fourier Series Solution of a PDE 440 17.3.1 Polynomial Expansion As an Algorithm 442 17.4 Solution: Finite-Difference Method 443 17.4.1 Relaxation and Overrelaxation 445 17.4.2 Lattice PDE Implementation 446 17.5 Assessment via Surface Plot 447 17.6 Alternate Capacitor Problems 448 17.7 Implementation and Assessment 450 17.8 Electric Field Visualization (Exploration) 452 17.9 Laplace Quiz 452 17.10 Unit II. Finite-Element Method 0 453 17.11 Electric Field from Charge Density (Problem) 454 17.12 Analytic Solution 454 17.13 Finite-Element (Not Difference) Methods 455 17.13.1 Weak Form of PDE 455 17,13.2Galerkin Spectral Decomposition 456 17.14 FEM Implementation and Exercises 460 17.15 Exploration 463 17.16 Unit III. Heat Flow via Time-Stepping (Leapfrogging) 463 17.17 The Parabolic Heat Equation (Theory) 463 17.17.1 Solution: Analytic Expansion 465 17.17.2Solution: Time-Stepping 466 17.17.3 Von Neumann Stability Assessment 468 17.17.4Heat Equation Implementation 470 17.18 Assessment and Visualization 470 17.19 Improved Heat Flow: Crank-Nicolson Method 472 17.19.1 Solution of Tridiagonal Matrix Equations 0 474 17.19.2Crank-Nicolson Method Implementation and Assessment 476 18 PDE Waves: String, Quantum Packet, and E&M 478 18.1 Unit I. Vibrating String 478 18.2 The Hyperbolic Wave Equation (Theory) 478 18.2.1 Solution via Normal-Mode Expansion 480 18.2.2 Algorithm: Time-Stepping 481 18.2.3 Wave Equation Implementation 483 18.2.4 Assessment and Exploration 484 18.3 Waves with Friction (Extension) 486
  • 13. xviii contents 18.4 Waves for Variable Tension and Density (Extension) 487 18.4.1 Waves on a Catenary 488 18.4.2 Derivation of a Catenary Shape 488 18,4,3 Catenary and Frictional Wave Exercises 490 18.5 Unit II. Quantum Wave Packets 491 18.6 Time-Dependent Schrddinger Equation (Theory) 492 18.6.1 Finite-Difference Algorithm 493 18.6.2 Wave Packet Implementation and Animation 494 18.7 Wave Packets in Other Wells (Exploration) 496 18.8 Algorithm for the 2-D Schrddinger Equation 496 18.9 Unit III. E&M Waves via Finite-Difference Time Domain 0 499 18.10 Maxwell's Equations 499 18.11 FDTD Algorithm 500 18.11.1 Implementation 503 18.11.2 Assessment 504 18.11.3 Extension: Circularly Polarized EM Waves 506 19 Solitons & Computational Fluid Dynamics 508 19.1 Unit I. Advection, Shocks, and Russell's Soliton 508 19.2 Theory: Continuity and Advection Equations 509 19.2.1 Advection Implementation 510 19.3 Theory: Shock Waves via Burgers' Equation 510 19.3.1 Algorithm: The Lax-Wendroff Method for Burgers' Equation 511 19.3.2 Implementation and Assessment of Burgers' Shock Equation 513 19.4 Including Dispersion 514 19.5 Shallow-Water Solitons, the KdeV Equation 515 19.5.1 Analytic Soliton Solution 517 19.5.2 Algorithm for KdeV Solitons 518 19.5.3 Implementation: KdeV Solitons 519 19.5.4 Exploration: Solitons in Phase Space'and Crossing 520 19.6 Unit II. River Hydrodynamics 521 19.7 Hydrodynamics, the Navier-Stokes Equation (Theory) 521 19.7.1 Boundary Conditions for Parallel Plates 524 19.7.2 Analytic Solution for Parallel Plates 526
  • 14. contents • xix 19.7.3 Finite-Difference Algorithm and Overrelaxation 527 19.7.4 Successive Overrelaxation Implementation 529 19.8 2-D Flow over a Beam 530 19.9 Theory: Vorticity Form of the Navier-Stokes Equation 530 19.9.1 Finite Differences and the SOR Algorithm 532 19.9.2 Boundary Conditions for a Beam 534 19.9.3 SOR on a Grid Implementation 536 19.9.4 Assessment 538 19.9.5 Exploration 539 20 Integral Equations in Quantum Mechanics 540 20.1 Unit I. Bound States of Nonlocal Potentials 540 20.2 Momentum-Space Schrddinger Equation (Theory) 541 20.2.1 Integral to Linear Equations (Method) 542 20.2.2 Delta-Shell Potential (Model) 544 20.2.3 Binding Energies Implementation 544 20.2.4 Wave Function (Exploration) 546 20.3 Unit II. Nonlocal Potential Scattering 0 546 20.4 Lippmann-Schwinger Equation (Theory) 547 20.4.1 Singular Integrals (Math) 548 20.4.2 Numerical Principal Values 549 20.4.3 Reducing Integral Equations to Matrix-Equations (Algorithm) 549 20.4.4 Solution via Inversion or Elimination 551 20.4.5 Scattering Implementation 552 20.4.6 Scattering Wave Function (Exploration) 553 Appendix A: Glossary 555 Appendix B: Installing Packages 562 B.I Installing Java Developer's Kit 564 B.2 Using Classes and Packages 565 B.2,1 Including Packages '. 565 Appendix C: OpenDX: Industrial-Strength Data Visualization 568 C.I Getting DX and Unix Running (for Windows) 569 C.2 Test Drive of DX Visual Programming 569
  • 15. xx . contents C.3 DX Tools Summary 576 C.4 DX Data Structure and Storage 577 C.5 Sample Visual Programs 579 C.5.1 Sample 1: Linear Plot 579 C.5.2 Sample 2: Fourier Transform 580 C.5.3 Sample 3: Potential of a 2-D Capacitor 580 C.5.4 Sample 4: Vector Field Plots 581 C.5.5 Sample 5: 3-D Scalar Potentials 582 C.5.6 Sample 6: 3-D Functions, the Hydrogen Atom 585 C.6 Animations with OpenDX 586 C.6.1 Scripted Animation with OpenDX 588 C.6.2 Wave Packet and Slit Animation 591 Appendix D: An MPI Tutorial 593 D.I Running on a Beowulf 593 D.2 Running MPI 597 D.2.1 MPI under the SGE Queueing System 598 D.2.2 MPI Under the Torque/PBS Queueing System 600 D.2.3 Running Parallel Jobs with Torque 602 D.3 Your First MPI Program: MPIhello.c 604 D.3.1 MPIhello.c Explained 605 D.3.2 Send/Receive Messages: MPImessage2,c 606 D.3.3 Receive More Messages: MPImessage3.c 608 D.3.4 Broadcast Messages 609 D.3.5 Exercise 610 D.4 Parallel Tuning 611 D.5 A String Vibrating in Parallel 614 D.5.1 MPIstring.c Exercise 617 D.6 Deadlock 618 D.6.1 Nonblocking Communication 619 D.6.2 Collective Communication 619 D.7 Bootable Cluster CD 0 620 D.8 Parallel Computing Exercises 620 D.9 List of MPI Commands < 621 Appendix E: Calling LAPACK from C 623 E.I Calling LAPACK Fortran from C 624 E.2 Compiling C Programs with Fortran Calls 625
  • 16. contents xxi Appendix F: Software on the CD 626 Appendix G: Compression via DWT with Thresholding 635 G.I More on Thresholding 637 G.2 Wavelet Implementation and Assessment 638 Bibliography 641 Index 651