Designed for a one- or two-semester course, A Survey of Computational Physics will also interest anyone who wants a reference on or practical experience in the basics of computational physics. The text includes a CD-ROM with supplementary materials, including Java, Fortran, and C programs; animations; visualizations; color figures; interactive Java applets; codes for MPI, PVM, and OpenDX; and a PVM tutorial.
- Accessible to advanced undergraduates
- Real-world problem-solving approach
- Java codes and applets integrated with text
- Accompanying CD-ROM contains codes, applets, animations, and visualization files
- Companion Web site includes videos of lectures
Designed for a one- or two-semester course, A Survey of Computational Physics will also interest anyone who wants a reference on or practical experience in the basics of computational physics. The text includes a CD-ROM with supplementary materials, including Java, Fortran, and C programs; animations; visualizations; color figures; interactive Java applets; codes for MPI, PVM, and OpenDX; and a PVM tutorial.
- Accessible to advanced undergraduates
- Real-world problem-solving approach
- Java codes and applets integrated with text
- Accompanying CD-ROM contains codes, applets, animations, and visualization files
- Companion Web site includes videos of lectures

A Survey of Computational Physics: Introductory Computational Science
688
A Survey of Computational Physics: Introductory Computational Science
688Hardcover(New Edition)
-
SHIP THIS ITEMIn stock. Ships in 3-7 days. Typically arrives in 3 weeks.PICK UP IN STORE
Your local store may have stock of this item.
Available within 2 business hours
Related collections and offers
Overview
Designed for a one- or two-semester course, A Survey of Computational Physics will also interest anyone who wants a reference on or practical experience in the basics of computational physics. The text includes a CD-ROM with supplementary materials, including Java, Fortran, and C programs; animations; visualizations; color figures; interactive Java applets; codes for MPI, PVM, and OpenDX; and a PVM tutorial.
- Accessible to advanced undergraduates
- Real-world problem-solving approach
- Java codes and applets integrated with text
- Accompanying CD-ROM contains codes, applets, animations, and visualization files
- Companion Web site includes videos of lectures
Product Details
ISBN-13: | 9780691131375 |
---|---|
Publisher: | Princeton University Press |
Publication date: | 07/21/2008 |
Edition description: | New Edition |
Pages: | 688 |
Product dimensions: | 7.10(w) x 10.10(h) x 1.70(d) |
About the Author
Read an Excerpt
A Survey of Computational Physics
By R. H. Landau M.J. Páez C.C. Bordeianu Princeton University Press
Copyright © 2008 Princeton University Press
All right reserved.
ISBN: 978-0-691-13137-5
Chapter One Computational Science Basics
Some people spend their entire lives reading but never get beyond reading the words on the page; they don't understand that the words are merely stepping stones placed across a fast-flowing river, and the reason they're there is so that we can reach the farther shore; it's the other side that matters. -José Saramago
As an introduction to the book to follow, we start this chapter with a description of how computational physics (CP) fits into the broader field of computational science, and what topics we will present as the contents of CP. We then get down to basics and examine computing languages, number representations, and programming. Related topics dealing with hardware basics are found in Chapter 14, "High-Performance Computing Hardware, Tuning, and Parallel Computing."
1.1 Computational Physics and Computational Science
This book adopts the view that CP is a subfield ofcomputational science. This means that CP is a multidisciplinary subject combining aspects of physics, applied mathematics, and computer science (CS) (Figure 1.1), with the aim of solving realistic physics problems. Other computational sciences replace the physics with biology, chemistry, engineering, and so on, and together face grand challenge problems such as
Climate prediction Materials science Structural biology Superconductivity Semiconductor design Drug design Human genome Quantum chromodynamics Turbulence Speech and vision Relativistic astrophysics Vehicle dynamics Nuclear fusion Combustion systems Oil and gas recovery Ocean science Vehicle signature Undersea surveillance
Although related, computational science is not computer science. Computer science studies computing for its own intrinsic interest and develops the hardware and software tools that computational scientists use. Likewise, applied mathematics develops and studies the algorithms that computational scientists use. As much as we too find math and computer science interesting for their own sakes, our focus is on solving physical problems; we need to understand the CS and math tools well enough to be able to solve our problems correctly.
As CP has matured, we have come to realize that it is more than the overlap of physics, computer science, and mathematics (Figure 1.1). It is also a bridge among them (the central region in Figure 1.1) containing core elements of it own, such as computational tools and methods. To us, CP's commonality of tools and a problem-solving mindset draws it toward the other computational sciences and away from the subspecialization found in so much of physics.
In order to emphasize our computational science focus, to the extent possible, we present the subjects in this book in the form of a problem to solve, with the components that constitute the solution separated according to the scientific problem-solving paradigm (Figure 1.2 left). Traditionally, physics employs both experimental and theoretical approaches to discover scientific truth (Figure 1.2 right). Being able to transform a theory into an algorithm requires significant theoretical insight, detailed physical and mathematical understanding, and a mastery of the art of programming. The actual debugging, testing, and organization of scientific programs is analogous to experimentation, with the numerical simulations of nature being essentially virtual experiments. The synthesis of numbers into generalizations, predictions, and conclusions requires the insight and intuition common to both experimental and theoretical science. In fact, the use of computation and simulation has now become so prevalent and essential a part of the scientific process that many people believe that the scientific paradigm has been extended to include simulation as an additional dimension (Figure 1.2 right).
1.2 How to Read and Use This Book
Figure 1.3 maps out the CP concepts we cover in this book and the relations among them. You may think of this concept map as the details left out of Figure 1.1. On the left are the hardware and software components from computer science; in the middle are the algorithms of applied mathematics; on the right are the physics applications. Yet because CP is multidisciplinary, it is easy to argue that certain concepts should be moved someplace else.
A more traditional way to view the materials in this text is in terms of its use in courses. In our classes [CPUG] we use approximately the first third of the text, with its emphasis on computing tools, for a course in scientific computing (after students have acquired familiarity with a compiled language). Typical topics covered in the 10 weeks of such a course are given in Table 1.1. Some options are indicated in the caption, and, depending upon the background of the students, other topics may be included or substituted. The latter two-thirds of the text includes more physics, and, indeed, we use it for a two-quarter (20-week) course in computational physics. Typical topics covered for each term are given in Table 1.2. What with many of the latter topics being research level, we suspect that these materials can easily be used for a full year's course as well.
For these materials to contribute to a successful learning experience, we assume that the reader will work through the problem at the beginning of each chapter or unit. This entails studying the text, writing, debugging and running programs, visualizing the results, and then expressing in words what has been done and what can be concluded. Further exploring is encouraged. Although we recognize that programming is a valuable skill for scientists, we also know that it is incredibly exacting and time-consuming. In order to lighten the workload somewhat, we provide "bare bones" programs in the text and on the CD. We recommend that these be used as guides for the reader's own programs or tested and extended to solve the problem at hand. As part of this approach we suggest that the learner write up a mini lab report for each problem containing
Equations solved Numerical method Code listing Visualization Discussion Critique
The report should be an executive summary of the type given to a boss or manager; make it clear that you understand the materials but do not waste everyone's time.
One of the most rewarding uses of computers is visualizing and analyzing the results of calculations with 2-D and 3-D plots, with color, and with animation. This assists in the debugging process, hastens the development of physical and mathematical intuition, and increases the enjoyment of the work. It is essential that you learn to use visualization tools as soon as possible, and so in Chapter 3, "Visualization Tools," and Appendix C we describe a number of free visualization -1 tools that we use and recommend. We include many figures showing visualizations 0 (unfortunately just in gray scale), with color versions on the CD.
We have tried to make the multifaceted contents of this book clearer by use of the following symbols and fonts:
in the margin Material on the CD [??] Optional material [??] at line's end End of exercise or problem Monospace font Words as they would appear on a computer screen Italic font Note at beginning of chapter to the reader about what's to follow Sans serif font Program commands from drop-down menus
We also indicate a user-computer dialog via three different fonts on a line:
Monospace computer's output > Bold monospace user's command Comments
Code listings are formatted within a shaded box, with italic key words and bold comments (usually on the right):
for ( i = 0 ; i <= Nxmax ; i ++ ) { // Comment: Fluid surface u [i] [Nymax] = u [i] [Nymax-1] + V0*h; w[i] [Nymax-1] = 0 . ; }
public double getI () { return (2./5.) * m * r * r; } // Method getI
Note that we have tried to structure the codes so that a line is skipped before each method, so that each logical structure is indented by two spaces, and so that the ending brace } of a logical element is on a separate line aligned with the beginning of the logic element. However, in order to conserve space, sometimes we do not insert blank lines even though it may add clarity, sometimes the commands for short methods or logical structures are placed on a single line, and usually we combine multiple ending braces on the last line.
Although we try to be careful to define each term the first time it is used, we also have included a glossary in Appendix A for reference. Further, Appendix B describes the steps needed to install some of the software packages we recommend, and Appendix F lists the names and functions of the various items on the CD.
1.3 Making Computers Obey; Languages (Theory)
Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate, and brilliant; together they are powerful beyond imagination. - Albert Einstein
As anthropomorphic as your view of your computer may be, keep in mind that -1 computers always do exactly as they are told. This means that you must tell them exactly everything they have to do. Of course the programs you run may have such convoluted logic that you may not have the endurance to figure out the details of what you have told the computer to do, but it is always possible in principle. So your first problem is to obtain enough understanding so that you feel well enough in control, no matter how illusionary, to figure out what the computer is doing.
Before you tell the computer to obey your orders, you need to understand that life is not simple for computers. The instructions they understand are in a basic machine language that tells the hardware to do things like move a number stored in one memory location to another location or to do some simple binary arithmetic. Very few computational scientists talk to computers in a language computers can understand. When writing and running programs, we usually communicate to the computer through shells, in high-level languages (Java, Fortran, C), or through problem-solving environments (Maple, Mathematica, and Matlab). Eventually these commands or programs are translated into the basic machine language that the hardware understands.
A shell is a command-line interpreter, that is, a set of small programs run by a computer that respond to the commands (the names of the programs) that you key in. Usually you open a special window to access the shell, and this window is called a shell as well. It is helpful to think of these shells as the outer layers of the computer's operating system (OS) (Figure 1.4), within which lies a kernel of elementary operations. (The user seldom interacts directly with the kernel, except possibly when installing programs or when building an operating system from scratch.) It is the job of the shell to run programs, compilers, and utilities that do things like copying files. There can be different types of shells on a single computer or multiple copies of the same shell running at the same time.
Operating systems have names such as Unix, Linux, DOS, MacOS, and MS Windows. The operating system is a group of programs used by the computer to communicate with users and devices, to store and read data, and to execute programs. Under Unix and Linux, the OS tells the computer what to do in an elementary way, while Windows includes various graphical elements as part of the operating system (this increases speed at the cost of complexity). The OS views you, other devices, and programs as input data for it to process; in many ways, it is the indispensable office manager. While all this may seem complicated, the purpose of the OS is to let the computer do the nitty-gritty work so that you can think higher-level thoughts and communicate with the computer in something closer to your normal everyday language.
When you submit a program to your computer in a high-level language, the computer uses a compiler to process it. The compiler is another program that treats your program as a foreign language and uses a built-in dictionary and set of rules to translate it into basic machine language. As you can probably imagine, the final set of instructions is quite detailed and long and the compiler may make several passes through your program to decipher your logic and translate it into a fast code. The translated statements form an object or compiled code, and when linked together with other needed subprograms, form a load module. A load module is a complete set of machine language instructions that can be loaded into the computer's memory and read, understood, and followed by the computer.
Languages such as Fortran and ITLITL use compilers to read your entire program and then translate it into basic machine instructions. Languages such as BASIC and Maple translate each line of your program as it is entered. Compiled languages usually lead to more efficient programs and permit the use of vast subprogram libraries. Interpreted languages give a more immediate response to the user and thereby appear "friendlier." The Java language is a mix of the two. When you first compile your program, it interprets it into an intermediate, universal byte code, but then when you run your program, it recompiles the byte code into a machine-specific compiled code.
1.4 Programming Warmup
Before we go on to serious work, we want to ensure that your local computer is working right for you. Assume that calculators have not yet been invented and that you need a program to calculate the area of a circle. Rather than use any specific language, write that program in pseudocode that can be converted to your favorite language later. The first program tells the computer: Calculate area of circle // Do this computer! This program cannot really work because it does not tell the computer which circle to consider and what to do with the area. A better program would be
read radius // Input calculate area of circle // Numerics print area // Output
The instruction calculate area of circle has no meaning in most computer languages, so we need to specify an algorithm, that is, a set of rules for the computer to follow:
read radius // Input PI = 3.141593 // Set constant area = PI * r * r // Algorithm print area // Output
This is a better program, and so let's see how to implement it in Java (other languageversions are on the CD). In Listing 1.1 we give a Java version of our area program. This is a simple program that outputs to the screen and has its input entered via statements.
(Continues...)
Excerpted from A Survey of Computational Physics by R. H. Landau M.J. Páez C.C. Bordeianu
Copyright © 2008 by Princeton University Press. Excerpted by permission.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.
Table of Contents
Preface xxiii
CHAPTER 1: Computational Science Basics 11.1 Computational Physics and Science 11.2 How to Read and Use This Book 31.3 Making Computers Obey; Languages (Theory) 61.4 Programming Warmup 81.4.1 Structured Program Design 101.4.2 Shells, Editors, and Execution 111.4.3 Java I/O, Scanner Class with printf 121.4.4 I/O Redirection 121.4.5 Command-Line Input 131.4.6 I/O Exceptions: FileCatchThrow.java 141.4.7 Automatic Code Documentation 161.5 Computer Number Representations (Theory) 171.5.1 IEEE Floating-Point Numbers 181.5.2 Over/Underflows Exercises 241.5.3 Machine Precision (Model) 251.5.4 Determine Your Machine Precision 271.6 Problem: Summing Series 271.6.1 Numerical Summation (Method) 281.6.2 Implementation and Assessment 29
CHAPTER 2: Errors & Uncertainties in Computations 302.1 Types of Errors (Theory) 302.1.1 Model for Disaster: Subtractive Cancellation 322.1.2 Subtractive Cancellation Exercises 332.1.3 Round-off Error in a Single Step 342.1.4 Round-off Error Accumulation After Many Steps 352.2 Errors in Spherical Bessel Functions (Problem) 362.2.1 Numerical Recursion Relations (Method) 362.2.2 Implementation and Assessment: Recursion Relations 382.3 Experimental Error Investigation (Problem) 392.3.1 Error Assessment 43
CHAPTER 3: Visualization Tools 453.1 Data Visualization 453.2 PtPlot: 2-D Graphs Within Java 463.3 Grace/ACE: Superb 2-D Graphs for Unix/Linux 513.3.1 Grace Basics 513.4 Gnuplot: Reliable 2-D and 3-D Plots 563.4.1 Gnuplot Input Data Format 583.4.2 Printing Plots 593.4.3 Gnuplot Surface (3-D) Plots 603.4.4 Gnuplot Vector Fields 623.4.5 Animations from a Plotting Program (Gnuplot) 643.5 OpenDX for Dicing and Slicing 653.6 Texturing and 3-D Imaging 65
CHAPTER 4: Object-Oriented Programs: Impedance &Batons 674.1 Unit I. Basic Objects: Complex Impedance 674.2 Complex Numbers (Math) 674.3 Resistance Becomes Impedance (Theory) 704.4 Abstract Data Structures, Objects (CS) 704.4.1 Object Declaration and Construction 724.4.2 Implementation in Java 734.4.3 Static and Nonstatic Methods 764.4.4 Nonstatic Methods 774.5 Complex Currents (Solution) 794.6 OOP Worked Examples 804.6.1 OOP Beats 804.6.2 OOP Planet 824.7 Unit II. Advanced Objects: Baton Projectiles 854.8 Trajectory of a Thrown Baton (Problem) 864.8.1 Combined Translation and Rotation (Theory) 864.9 OOP Design Concepts (CS) 894.9.1 Including Multiple Classes 904.9.2 Ball and Path Class Implementation 924.9.3 Composition, Objects Within Objects 934.9.4 Baton Class Implementation 944.9.5 Composition Exercise 954.9.6 Calculating the Baton's Energy (Extension) 964.9.7 Examples of Inheritance and Object Hierarchies 984.9.8 Baton with a Lead Weight (Application) 994.9.9 Encapsulation to Protect Classes 1004.9.10 Encapsulation Exercise 1014.9.11 Complex Object Interface (Extension) 1024.9.12 Polymorphism, Variable Multityping 1044.10 Supplementary Exercises 1054.11 OOP Example: Superposition of Motions 1054.12 Newton's Laws of Motion (Theory) 1064.13 OOP Class Structure (Method) 1064.14 Java Implementation 107
CHAPTER 5: Monte Carlo Simulations (Nonthermal) 1095.1 Unit I. Deterministic Randomness 1095.2 Random Sequences (Theory) 1095.2.1 Random-Number Generation (Algorithm) 1105.2.2 Implementation: Random Sequence 1135.2.3 Assessing Randomness and Uniformity 1145.3 Unit II. Monte Carlo Applications 1165.4 A Random Walk (Problem) 1165.4.1 Random-Walk Simulation 1165.4.2 Implementation: Random Walk 1175.5 Radioactive Decay (Problem) 1195.5.1 Discrete Decay (Model) 1195.5.2 Continuous Decay (Model) 1205.5.3 Decay Simulation 1215.6 Decay Implementation and Visualization 122
CHAPTER 6: Integration 1236.1 Integrating a Spectrum (Problem) 1236.2 Quadrature as Box Counting (Math) 1236.2.1 Algorithm: Trapezoid Rule 1256.2.2 Algorithm: Simpson's Rule 1266.2.3 Integration Error (Analytic Assessment) 1286.2.4 Algorithm: Gaussian Quadrature 1306.2.5 Integration Implementation and Error Assessment 1326.3 Experimentation 1356.4 Higher-Order Rules (Algorithm) 1356.5 Monte Carlo Integration by Stone Throwing 1366.5.1 Stone Throwing Implementation 1366.5.2 Integration by Mean Value (Math) 1376.6 High-Dimensional Integration (Problem) 1386.6.1 Multidimensional Monte Carlo 1396.6.2 Error in Multidimensional Integration (Assessment) 1396.6.3 Implementation: 10-D Monte Carlo Integration 1396.7 Integrating Rapidly Varying Functions (Problem) 1406.7.1 Variance Reduction (Method) 1406.7.2 Importance Sampling (Method) 1406.7.3 Von Neumann Rejection (Method) 1416.7.4 Simple Gaussian Distribution 1416.8 Nonuniform Assessment 1426.8.1 Implementation: Nonuniform Randomness 142
CHAPTER 7: Differentiation & Searching 1467.1 Unit I. Numerical Differentiation 1467.2 Forward Difference (Algorithm) 1477.3 Central Difference (Algorithm) 1487.4 Extrapolated Difference (Method) 1497.5 Error Analysis (Assessment) 1497.6 Second Derivatives (Problem) 1517.6.1 Second-Derivative Assessment 1517.7 Unit II. Trial-and-Error Searching 1517.8 Quantum States in a Square Well (Problem) 1527.9 Trial-and-Error Roots via the Bisection Algorithm 1527.9.1 Bisection Algorithm Implementation 1537.10 Newton-Raphson Searching (A Faster Algorithm) 1547.10.1 Newton-Raphson Algorithm with Backtracking 1567.10.2 Newton-Raphson Algorithm Implementation 157
CHAPTER 8: Solving Systems of Equations with Matrices;Data Fitting 1588.1 Unit I. Systems of Equations and Matrix Computing 1588.2 Two Masses on a String 1598.2.1 Statics (Theory) 1608.2.2 Multidimensional Newton-Raphson Searching 1608.3 Classes of Matrix Problems (Math) 1638.3.1 Practical Aspects of Matrix Computing 1658.3.2 Implementation: Scientific Libraries, World Wide Web 1688.3.3 JAMA: Java Matrix Library 1698.3.4 Exercises for Testing Matrix Calls 1738.3.5 Matrix Solution of the String Problem 1758.3.6 Explorations 1758.4 Unit II. Data Fitting 1768.5 Fitting an Experimental Spectrum (Problem) 1768.5.1 Lagrange Interpolation (Method) 1778.5.2 Lagrange Implementation and Assessment 1788.5.3 Explore Extrapolation 1798.5.4 Cubic Splines (Method) 1798.5.5 Spline Fit of Cross Section (Implementation) 1828.6 Fitting Exponential Decay (Problem) 1828.6.1 Theory to Fit 1828.7 Least-Squares Fitting (Method) 1848.7.1 Least-Squares Fitting: Theory and Implementation 1868.7.2 Exponential Decay Fit Assessment 1888.7.3 Exercise: Fitting Heat Flow 1898.7.4 Linear Quadratic Fit (Extension) 1908.7.5 Linear Quadratic Fit Assessment 1918.7.6 Nonlinear Fit of the Breit-Wigner Formula to a Cross Section 191
CHAPTER 9: Differential Equation Applications 1949.1 Unit I. Free Nonlinear Oscillations 1949.2 Nonlinear Oscillators (Models) 1949.3 Types of Differential Equations (Math) 1969.4 Dynamic Form for ODEs (Theory) 1989.5 ODE Algorithms 2009.5.1 Euler's Rule 2019.5.2 Runge-Kutta Algorithm 2029.5.3 Adams-Bashforth-Moulton Predictor-Corrector 2049.5.4 Assessment: rk2 versus rk4 versus rk45 2059.6 Solution for Nonlinear Oscillations (Assessment) 2079.6.1 Precision Assessment: Energy Conservation 2089.7 Extensions: Nonlinear Resonances, Beats, and Friction 2099.7.1 Friction: Model and Implementation 2099.7.2 Resonances and Beats: Model and Implementation 2109.8 Implementation: Inclusion of Time-Dependent Force 2119.9 Unit II. Binding A Quantum Particle 2129.10 The Quantum Eigenvalue Problem (Theory) 2129.10.1 Nucleon in a Box (Model) 2139.11 Combined Algorithms: Eigenvalues via ODE Solver Plus Search 2149.11.1 Numerov Algorithm for the Schrödinger ODE 2169.11.2 Implementation: Eigenvalues via an ODE Solver Plus Bisection Algorithm 2189.12 Explorations 2219.13 Unit III. Scattering, Projectiles, and Planetary Orbits 2229.14 Problem 1: Classical Chaotic Scattering 2229.14.1 Model and Theory 2229.14.2 Implementation 2249.14.3 Assessment 2259.15 Problem 2: Balls Falling Out of the Sky 2259.16 Theory: Projectile Motion with Drag 2269.16.1 Simultaneous Second-Order ODEs 2279.16.2 Assessment 2289.17 Problem 3: Planetary Motion 2289.17.1 Implementation: Planetary Motion 229
CHAPTER 10: Fourier Analysis: Signals and Filters 23110.1 Unit I. Fourier Analysis of Nonlinear Oscillations 23110.2 Fourier Series (Math) 23210.2.1 Example 1: Sawtooth Function 23410.2.2 Example 2: Half-wave Function 23510.3 Summation of Fourier Series (Exercise) 23510.4 Fourier Transforms (Theory) 23610.4.1 Discrete Fourier Transform Algorithm 23710.4.2 Aliasing and Anti-aliasing 24110.4.3 DFT for Fourier Series (Algorithm) 24310.4.4 Assessments 24410.4.5 DFT of Nonperiodic Functions (Exploration) 24610.5 Unit II. Filtering Noisy Signals 24610.6 Noise Reduction via Autocorrelation (Theory) 24610.6.1 Autocorrelation Function Exercises 24910.7 Filtering with Transforms (Theory) 25010.7.1 Digital Filters: Windowed Sinc Filters 25310.8 Unit III. Fast Fourier Transform Algorithm 25610.8.1 Bit Reversal 25810.9 FFT Implementation 25910.10 FFT Assessment 263
CHAPTER 11: Wavelet Analysis & Data Compression 26411.1 Unit I. Wavelet Basics 26411.2 Wave Packets and Uncertainty Principle (Theory) 26611.2.1 Wave Packet Assessment 26811.3 Short-Time Fourier Transforms (Math) 26811.4 The Wavelet Transform 26911.4.1 Generating Wavelet Basis Functions 27011.4.2 Continuous Wavelet Transform Implementation 27311.5 Unit II. Discrete Wavelet Transform and Multiresolution Analysis 27411.5.1 Pyramid Scheme Implementation 27911.5.2 Daubechies Wavelets via Filtering 28311.5.3 DWT Implementation and Exercise 286
CHAPTER 12: Discrete & Continuous Nonlinear Dynamics 28912.1 Unit I. Bug Population Dynamics (Discrete) 28912.2 The Logistic Map (Model) 28912.3 Properties of Nonlinear Maps (Theory) 29112.3.1 Fixed Points 29112.3.2 Period Doubling, Attractors 29212.4 Mapping Implementation 29312.5 Bifurcation Diagram (Assessment) 29412.5.1 Bifurcation Diagram Implementation 29512.5.2 Visualization Algorithm: Binning 29512.5.3 Feigenbaum Constants (Exploration) 29712.6 Random Numbers via Logistic Map(Exploration) 29712.7 Other Maps (Exploration) 29812.8 Signals of Chaos: Lyapunov Coefficients 29812.8.1 Shannon Entropy 29912.9 Unit I Quiz 30012.10 Unit II. Pendulums Become Chaotic (Continuous) 30212.11 Chaotic Pendulum ODE 30212.11.1 Free Pendulum Oscillations 30312.11.2 Solution as Elliptic Integrals 30412.11.3 Implementation and Test: Free Pendulum 30512.12 Visualization: Phase Space Orbits 30512.12.1 Chaos in Phase Space 30712.12.2 Assessment in Phase Space 31112.13 Exploration: Bifurcations of Chaotic Pendulums 31312.14 Alternative Problem: The Double Pendulum 31512.15 Assessment: Fourier/Wavelet Analysis of Chaos 31712.16 Exploration: Another Type of Phase Space Plot 31712.17 Further Explorations 31812.18 Unit III. Coupled Predator-Prey Models 31912.19 Lotka-Volterra Model 32012.19.1 LVM with Prey Limit 32112.19.2 LVM with Predation Efficiency 32212.19.3 LVM Implementation and Assessment 32312.19.4 Two Predators, One Prey (Exploration) 324
CHAPTER 13: Fractals & Statistical Growth 32613.1 Fractional Dimension (Math) 32613.2 The Sierpński Gasket (Problem 1) 32713.2.1 Sierpński Implementation 32813.2.2 Assessing Fractal Dimension 32813.3 Beautiful Plants (Problem 2) 32913.3.1 Self-affine Connection (Theory) 33013.3.2 Barnsley's Fern Implementation 33113.3.3 Self-affinity in Trees Implementation 33213.4 Ballistic Deposition (Problem 3) 33213.4.1 Random Deposition Algorithm 33213.5 Length of the British Coastline (Problem 4) 33413.5.1 Coastlines as Fractals (Model) 33413.5.2 Box Counting Algorithm 33513.5.3 Coastline Implementation and Exercise 33613.6 Correlated Growth, Forests, and Films (Problem 5) 33813.6.1 Correlated Ballistic Deposition Algorithm 33813.7 Globular Cluster (Problem 6) 33913.7.1 Diffusion-Limited Aggregation Algorithm 33913.7.2 Fractal Analysis of a DLA (or Pollock)Graph (Assessment) 34213.8 Fractal Structures in a Bifurcation Graph(Problem 7) 34313.9 Fractals from Cellular Automata 34313.10 Perlin Noise Adds Realism 34513.10.1Including Ray Tracing 34813.11 Quiz 351
CHAPTER 14: High-Performance Computing Hardware, Tuning, and Parallel Computing 35214.1 Unit I. High-Performance Computers (CS) 35214.2 Memory Hierarchy 35314.3 The Central Processing Unit 35714.4 CPU Design: Reduced Instruction Set Computer 35714.5 CPU Design: Multiple-Core Processors 35814.6 CPU Design: Vector Processor 35914.7 Unit II. Parallel Computing 36014.8 Parallel Semantics (Theory) 36114.9 Distributed Memory Programming 36314.10 Parallel Performance 36514.10.1 Communication Overhead 36714.11 Parallelization Strategy 36814.12 Practical Aspects of Message Passing for MIMD 36914.12.1 High-Level View of Message Passing 37014.13 Example of a Supercomputer: IBM Blue Gene/L 37214.14 Unit III. HPC Program Optimization 37414.14.1 Programming for Virtual Memory (Method) 37614.14.2 Optimizing Programs; Java versus Fortran/C 37614.14.3 Experimental Effects of Hardware on Performance 37914.14.4 Java versus Fortran/C 38014.15 Programming for the Data Cache (Method) 38514.15.1 Exercise 1: Cache Misses 38614.15.2 Exercise 2: Cache Flow 38714.15.3 Exercise 3: Large-Matrix Multiplication 388
CHAPTER 15: Thermodynamic Simulations & Feynman Quantum Path Integration 39015.1 Unit I. Magnets via the Metropolis Algorithm 39015.2 An Ising Chain (Model) 39015.3 Statistical Mechanics (Theory) 39315.3.1 Analytic Solutions 39315.4 Metropolis Algorithm 39415.4.1 Metropolis Algorithm Implementation 39715.4.2 Equilibration, Thermodynamic Properties (Assessment) 39715.4.3 Beyond Nearest Neighbors and 1-D (Exploration) 40015.5 Unit II. Magnets via Wang-Landau Sampling 40015.6 Wang-Landau Sampling 40315.6.1 WLS Ising Model Implementation 40515.6.2 WLS Ising Model Assessment 40815.7 Unit III. Feynman Path Integrals 40815.8 Feynman's Space-Time Propagation (Theory) 40815.8.1 Bound-State Wave Function ( Theory) 41215.8.2 Lattice Path Integration (Algorithm) 41315.8.3 Lattice Implementation 41815.8.4 Assessment and Exploration 42015.9 Exploration: Quantum Bouncer's Paths 421
CHAPTER 16: Simulating Matter with Molecular Dynamics 42416.1 Molecular Dynamics ( Theory) 42416.1.1 Connection to Thermodynamic Variables 42816.1.2 Setting Initial Velocity Distribution 42916.1.3 Periodic Boundary Conditions and Potential Cutoff 42916.2 Verlet and Velocity-Verlet Algorithms 43116.3 1-D Implementation and Exercise 43216.4 Trajectory Analysis 43516.5 Quiz 436
CHAPTER 17: PDEs for Electrostatics & Heat Flow 43717.1 PDE Generalities 43717.2 Unit I. Electrostatic Potentials 43917.2.1 Laplace's Elliptic PDE ( Theory) 43917.3 Fourier Series Solution of a PDE 44017.3.1 Polynomial Expansion As an Algorithm 44217.4 Solution: Finite-Difference Method 44317.4.1 Relaxation and Overrelaxation 44517.4.2 Lattice PDE Implementation 44617.5 Assessment via Surface Plot 44717.6 Alternate Capacitor Problems 44817.7 Implementation and Assessment 45017.8 Electric Field Visualization (Exploration) 45217.9 Laplace Quiz 45217.10 Unit II. Finite-Element Method 45317.11 Electric Field from Charge Density (Problem) 45417.12 Analytic Solution 45417.13 Finite-Element (Not Difference) Methods 45517.13.1 Weak Form of PDE 45517.13.2 Galerkin Spectral Decomposition 45617.14 FEM Implementation and Exercises 46017.15 Exploration 46317.16 Unit III. Heat Flow via Time-Stepping (Leapfrogging) 46317.17 The Parabolic Heat Equation (Theory) 46317.17.1 Solution: Analytic Expansion 46517.17.2 Solution: Time-Stepping 46617.17.3 Von Neumann Stability Assessment 46817.17.4 Heat Equation Implementation 47017.18 Assessment and Visualization 47017.19 Improved Heat Flow: Crank-Nicolson Method 47217.19.1 Solution of Tridiagonal Matrix Equations 47417.19.2 Crank-Nicolson Method Implementation and Assessment 476
CHAPTER 18: PDEWaves: String, Quantum Packet, and E&M 47818.1 Unit I. Vibrating String 47818.2 The Hyperbolic Wave Equation (Theory) 47818.2.1 Solution via Normal-Mode Expansion 48018.2.2 Algorithm: Time-Stepping 48118.2.3 Wave Equation Implementation 48318.2.4 Assessment and Exploration 48418.3 Waves with Friction (Extension) 48618.4 Waves for Variable Tension and Density(Extension) 48718.4.1 Waves on a Catenary 48818.4.2 Derivation of a Catenary Shape 48818.4.3 Catenary and Frictional Wave Exercises 49018.5 Unit II. Quantum Wave Packets 49118.6 Time-Dependent Schrödinger Equation (Theory) 49218.6.1 Finite-Difference Algorithm 49318.6.2 Wave Packet Implementation and Animation 49418.7 Wave Packets in Other Wells (Exploration) 49618.8 Algorithm for the 2-D Schrödinger Equation 49618.9 Unit III. E&M Waves via Finite-Difference Time Domain 49918.10 Maxwell's Equations 49918.11 FDTD Algorithm 50018.11.1 Implementation 50318.11.2 Assessment 50418.11.3 Extension: Circularly Polarized EM Waves 506
CHAPTER 19: Solitons & Computational Fluid Dynamics 50819.1 Unit I. Advection, Shocks, and Russell's Soliton 50819.2 Theory: Continuity and Advection Equations 50919.2.1 Advection Implementation 51019.3 Theory: Shock Waves via Burgers' Equation 51019.3.1 Algorithm: The Lax-Wendroff Method for Burgers' Equation 51119.3.2 Implementation and Assessment of Burgers' Shock Equation 51319.4 Including Dispersion 51419.5 Shallow-Water Solitons, the KdeV Equation 51519.5.1 Analytic Soliton Solution 51719.5.2 Algorithm for KdeV Solitons 51819.5.3 Implementation: KdeV Solitons 51919.5.4 Exploration: Solitons in Phase Space and Crossing 52019.6 Unit II. River Hydrodynamics 52119.7 Hydrodynamics, the Navier-Stokes Equation (Theory) 52119.7.1 Boundary Conditions for Parallel Plates 52419.7.2 Analytic Solution for Parallel Plates 52619.7.3 Finite-Difference Algorithm and Overrelaxation 52719.7.4 Successive Overrelaxation Implementation 52919.8 2-D Flow over a Beam 53019.9 Theory: Vorticity Form of the Navier-Stokes Equation 53019.9.1 Finite Differences and the SOR Algorithm 53219.9.2 Boundary Conditions for a Beam 53419.9.3 SOR on a Grid Implementation 53619.9.4 Assessment 53819.9.5 Exploration 539
CHAPTER 20: Integral Equations in Quantum Mechanics 54020.1 Unit I. Bound States of Nonlocal Potentials 54020.2 Momentum-Space Schrödinger Equation (Theory) 54120.2.1 Integral to Linear Equations (Method) 54220.2.2 Delta-Shell Potential (Model) 54420.2.3 Binding Energies Implementation 54420.2.4 Wave Function (Exploration) 54620.3 Unit II. Nonlocal Potential Scattering 54620.4 Lippmann-Schwinger Equation (Theory) 54720.4.1 Singular Integrals (Math) 54820.4.2 Numerical Principal Values 54920.4.3 Reducing Integral Equations to Matrix-Equations(Algorithm) 54920.4.4 Solution via Inversion or Elimination 55120.4.5 Scattering Implementation 55220.4.6 Scattering Wave Function (Exploration) 553
Appendix A: Glossary 555Appendix B: Installing Packages 562B.1 Installing Java Developer's Kit 564B.2 Using Classes and Packages 565B.2.1 Including Packages 565Appendix C: OpenDX: Industrial-Strength Data Visualization 568C.1 Getting DX and Unix Running (for Windows) 569C.2 Test Drive of DX Visual Programming 569C.3 DX Tools Summary 576C.4 DX Data Structure and Storage 577C.5 Sample Visual Programs 579C.5.1 Sample 1: Linear Plot 579C.5.2 Sample 2: Fourier Transform 580C.5.3 Sample 3: Potential of a 2-D Capacitor 580C.5.4 Sample 4: Vector Field Plots 581C.5.5 Sample 5: 3-D Scalar Potentials 582C.5.6 Sample 6: 3-D Functions, the Hydrogen Atom 585C.6 Animations with OpenDX 586C.6.1 Scripted Animation with OpenDX 588C.6.2 Wave Packet and Slit Animation 591Appendix D: An MPI Tutorial 593D.1 Running on a Beowulf 593D.2 Running MPI 597D.2.1 MPI under the SGE Queueing System 598D.2.2 MPI Under the Torque/PBS Queueing System 600D.2.3 Running Parallel Jobs with Torque 602D.3 Your First MPI Program: MPIhello.c 604D.3.1 MPIhello.c Explained 605D.3.2 Send/Receive Messages: MPImessage2.c 606D.3.3 Receive More Messages: MPImessage3.c 608D.3.4 Broadcast Messages 609D.3.5 Exercise 610D.4 Parallel Tuning 611D.5 A String Vibrating in Parallel 614D.5.1 MPIstring.c Exercise 617D.6 Deadlock 618D.6.1 Nonblocking Communication 619D.6.2 Collective Communication 619D.7 Bootable Cluster CD 620D.8 Parallel Computing Exercises 620D.9 List of MPI Commands 621Appendix E: Calling LAPACK from C 623E.1 Calling LAPACK Fortran from C 624E.2 Compiling C Programs with Fortran Calls 625Appendix F: Software on the CD 626Appendix G: Compression via DWT with Thresholding 635G.1 More on Thresholding 637G.2 Wavelet Implementation and Assessment 638
Bibliography 641Index 651
What People are Saying About This
This book is a welcome addition to the existing literature on the subject. It is needed as much for its pedagogical approach to computational thinking as for its choice of topics in computational physics. Its use of Java as the main programming language brings it up to date with the skills that the new generation of students will bring to class.
Ali Eskandarian, George Washington University
In addition to being an excellent undergraduate textbook, A Survey of Computational Physics will be useful to scientists wanting a good reference on basic computational modeling methods.
John W. Mintmire, Oklahoma State University
"In addition to being an excellent undergraduate textbook, A Survey of Computational Physics will be useful to scientists wanting a good reference on basic computational modeling methods."—John W. Mintmire, Oklahoma State University"This book is a welcome addition to the existing literature on the subject. It is needed as much for its pedagogical approach to computational thinking as for its choice of topics in computational physics. Its use of Java as the main programming language brings it up to date with the skills that the new generation of students will bring to class."—Ali Eskandarian, George Washington University