You are on page 1of 17

Table Of Contents

Preface...................................................................................................................... xiii

Chapter 1: Ordinary Differential Equations in the


Physical Sciences.......................................................................................... 1
1.1 Introduction .......................................................................................................... 1

1.1.1 Definitions...................................................................................................... 1
Differential Equations, Unknown Functions, and Initial Conditions ................. 1
Order of a Differential Equation........................................................................ 3
Partial Differential Equations............................................................................. 4
Initial Value and Boundary Value Problems ..................................................... 4
Exercises for Sec. 1.1.............................................................................................. 5

1.2 Graphical Solution of Initial-Value Problems .............................................. 5

1.2.1 Direction Fields; Existence and Uniqueness of Solutions ............................. 5


1.2.2 Direction Fields for Second-Order ODEs: Phase-Space Portraits................. 9
Phase-Space....................................................................................................... 9
Conservation of Phase-Space Area.................................................................... 11
Hamiltonian Systems ......................................................................................... 12
Exercises for Sec. 1.2.............................................................................................. 14

1.3 Analytic Solution of Initial-Value Problems via DSolve......................... 17

1.3.1 DSolve......................................................................................................... 17

Exercises for Sec. 1.3.............................................................................................. 20

1.4 Numerical Solution of Initial-Value Problems ............................................. 23


2 Table of Contents

1.4.1 NDSolve....................................................................................................... 23

1.4.2 Error in Chaotic Systems ............................................................................... 27


A Chaotic System: The Driven Pendulum......................................................... 27
The Lyapunov Exponent.................................................................................... 29

1.4.3 Euler's Method............................................................................................... 31

1.4.4 The Predictor-Corrector Method of Order 2.................................................. 38


1.4.5 Euler's Method for Systems of ODEs............................................................ 41

1.4.6 The Numerical N-Body Problem: An Introduction to Molecular Dynamics. 43

Exercises for Sec. 1.4..............................................................................................50

1.5 Boundary-Value Problems ................................................................................62

1.5.1 Introduction....................................................................................................62

1.5.2 Numerical Solution of Boundary-Value Problems: The Shooting Method...64

Exercises for Sec. 1.5..............................................................................................67

1.6 Linear ODEs.........................................................................................................70

1.6.1 The Principle of Superposition ......................................................................70


Linear ODEs of order N ....................................................................................70
Linear Differential Operators.............................................................................70
The Superposition Principle...............................................................................71

1.6.2 The General Solution to the Homogeneous Equation....................................71


Introduction........................................................................................................71
Different Functional Forms for the General Solution........................................73

1.6.3 Linear Differential Operators and Linear Algebra .........................................74

1.6.4 Inhomogeneous Linear ODEs ........................................................................78


Homogeneous and Particular Solutions .............................................................78
Method of Undetermined Coefficients ..............................................................79
Response to Sinusoidal Forcing.........................................................................79
Resonance..........................................................................................................82
Dubin Numerical and Analytical Methods for Scientists and Engineers 3

Exercises for Sec. 1.6..............................................................................................84

References....................................................................................................................86

Chapter 2: Fourier Series and Transforms....................87


2.1 Fourier Representation of Periodic Functions .............................................87

2.1.1 Introduction....................................................................................................87

2.1.2 Fourier Coefficients and Orthogonality Relations .........................................90

2.1.3 Triangle Wave................................................................................................92

2.1.4 Square Wave..................................................................................................95

2.1.5 Uniform and Nonuniform Convergence........................................................97


2.1.6 Gibbs Phenomenon for the Square Wave......................................................99

2.1.7 Exponential Notation for Fourier Series........................................................102

2.1.8 Response of a Damped Oscillator to Periodic Forcing ..................................105

2.1.9 Fourier Analysis, Sound, and Hearing...........................................................106


Exercises for Sec. 2.1..............................................................................................109

2.2 Fourier Representation of Functions Defined on a Finite Interval .........111

2.2.1 Periodic Extension of a Function...................................................................111

2.2.2 Even Periodic Extension ................................................................................113

2.2.3 Odd Periodic Extension .................................................................................116

2.2.4 Solution of Boundary-Value Problems Using Fourier Series........................118

Exercises for Sec. 2.2..............................................................................................121

2.3 Fourier Transforms .............................................................................................122


4 Table of Contents

2.3.1 Fourier Representation of Functions on the Real Line..................................122

2.3.2 Fourier sine and cosine Transforms...............................................................129

2.3.3 Some properties of Fourier Transforms .........................................................131


Fourier Transforms as Linear Integral Operators..............................................131
Fourier Transforms of Derivatives and Integrals...............................................131
Convolution Theorem........................................................................................132
The Uncertainty Principle of Fourier Analysis..................................................133

2.3.4 The Dirac d-Function .....................................................................................135


Introduction........................................................................................................135
Integral of a d-Function ......................................................................................136
d-Functions of More Complicated Arguments ..................................................136
Generalized Fourier Integrals.............................................................................137
Derivatives of a d-Function ................................................................................139
Heaviside Step Function....................................................................................140
Connection of Fourier Transforms to Fourier Series.........................................141

2.3.5 Fast Fourier Transforms .................................................................................144


Discrete Fourier Transforms ..............................................................................144
Fast Fourier Transforms.....................................................................................151

2.3.6 Response of a Damped Oscillator to General Forcing. Green's Function for the
Oscillator...........................................................................................................................158

Exercises for Sec. 2.3..............................................................................................164

2.4 Green's Functions ................................................................................................169

2.4.1 Introduction....................................................................................................169

2.4.2 Constructing the Green's Function from Homogeneous Solutions ................171


Second-Order ODEs..........................................................................................171
Example.............................................................................................................173
Nth Order ODEs.................................................................................................173

2.4.3 Discretized Green's Function I : Initial-Value Problems by Matrix Inversion.


...........................................................................................................................................174

2.4.4 Green's Function for Boundary-Value Problems...........................................178


Dubin Numerical and Analytical Methods for Scientists and Engineers 5

2.4.5 Discretized Green's Functions II: Boundary-Value Problems by Matrix Inversion


...........................................................................................................................................181
Theory for Second-Order ODEs ........................................................................181
Example.............................................................................................................185

Exercises for Sec. 2.4..............................................................................................187

References....................................................................................................................190

Chapter 3: Introduction to Linear Partial


Differential Equations............................................................................191
3.1 Separation of Variables and Fourier Series Methods in Solutions of the
Wave and Heat Equations ..........................................................................................191

3.1.1 Derivation of the Wave Equation...................................................................191


Introduction........................................................................................................191
String Equilibrium ..............................................................................................191
String Dynamics: The Wave Equation...............................................................193

3.1.2 Solution of the Wave Equation Using Separation of Variables .....................195


Solution of the Wave Equation for a Uniform String and Fixed Ends..............195
Examples............................................................................................................199
Static Sources and Inhomogeneous Boundary Conditions................................203
Summary............................................................................................................206

3.1.3 Derivation of the Heat Equation ....................................................................206


Heat Flux............................................................................................................206
Energy Conservation ..........................................................................................207
The Heat and Diffusion Equations. Dirichlet, von Neumann and Mixed Boundary
Conditions.........................................................................................................................208

3.1.4 Solution of the Heat Equation Using Separation of Variables .......................210


Introduction........................................................................................................210
Static Boundary Conditions and a Static Source...............................................210
Homogeneous von Neumann Boundary Conditions..........................................217
Homogeneous Mixed Boundary Conditions ......................................................220
Summary............................................................................................................223
6 Table of Contents

Exercises for Sec. 3.1..............................................................................................224

3.2 Laplace's Equation in Some Separable Geometries ....................................231

3.2.1 Existence and Uniqueness of the Solution.....................................................232

3.2.2 Rectangular Geometry ...................................................................................233


General Solution................................................................................................233
Example 1: Dirichlet Boundary Conditions.......................................................234
Example 2: von Neumann Boundary Conditions; the Current Density in a
Conducting Wire...............................................................................................................236

3.2.3 2D Cylindrical Geometry...............................................................................238


Separation of Variables ......................................................................................238
Example.............................................................................................................239

3.2.4 Spherical Geometry ........................................................................................240


Separation of Variables ......................................................................................240
Eigenmodes in q: Associated Legendre Functions............................................241
Spherical Harmonics..........................................................................................243
Example.............................................................................................................245

3.2.5 3D Cylindrical Geometry...............................................................................247


Introduction........................................................................................................247
Nonzero Potential on One Cylinder End: Bessel Functions..............................248
Nonzero Potential on the Cylinder Sides: Modified Bessel Functions ..............254

Exercises for Sec. 3.2..............................................................................................256

References....................................................................................................................260

Chapter 4: Eigenmode Analysis..................................................261


4.1 Generalized Fourier Series................................................................................261

4.1.1 Inner Products and Orthogonal Functions .....................................................261


Definition of an Inner Product...........................................................................261
Sets of Orthogonal Functions. The Gram- Schmidt Method. ............................262

4.1.2 Series of Orthogonal Functions......................................................................266


Dubin Numerical and Analytical Methods for Scientists and Engineers 7

4.1.3 Eigenmodes of Hermitian Operators..............................................................268


Hermitian Operators, and Sturm-Liouville Problems ........................................268
Eigenmodes........................................................................................................270
Completeness.....................................................................................................271

4.1.4 Eigenmodes of Non-Hermitian Operators.....................................................272

Exercises for Sec. 4.1..............................................................................................273

4.2 Beyond Separation of Variables: The General Solution of the 1D Wave and
Heat Equations ..............................................................................................................277

4.2.1 Standard Form for the PDE............................................................................278

4.2.2 Generalized Fourier Series Expansion for the Solution.................................280


General Solution for the Wave Equation...........................................................280
Wave Energy ......................................................................................................282
Example 1: Temperature Oscillations ................................................................283
Example 2: Cracking the Whip ..........................................................................287

Exercises for Sec. 4.2..............................................................................................294

4.3 Poisson's Equation in Two and Three Dimensions ......................................300

4.3.1 Introduction. Uniqueness and Standard Form................................................300

4.3.2 Green's Function............................................................................................301

4.3.3 Expansion of g and f in Eigenmodes of the Laplacian Operator ..................302

4.3 .3 Eigenmodes of “2 in Separable Geometries ................................................304


Introduction........................................................................................................304
Rectangular Geometry.......................................................................................305
Cylindrical Geometry .........................................................................................312
Spherical Geometry............................................................................................317

Exercises for Sec. 4.3..............................................................................................324

4.4 The Wave and Heat Equations in Two and Three Dimensions ................333

4.4.1 Oscillations of a Circular Drumhead.............................................................334


General Solution................................................................................................334
8 Table of Contents

Drumhead Eigenmodes......................................................................................336
Travelling Waves in q........................................................................................338
Sources and Inhomogeneous Boundary Conditions ..........................................339

4.4.2 Large Scale Ocean Modes..............................................................................340

4.4.3 The Rate of Cooling of the Earth...................................................................344

Exercises for Sec. 4.4..............................................................................................346

References....................................................................................................................354

Chapter 5: Partial Differential Equations in Infinite


Domains..................................................................................................................355
5.1 Fourier Transform Methods.............................................................................356

5.1.1 The Wave Equation in One Dimension.........................................................356


Travelling Waves...............................................................................................356
General Solution................................................................................................358

5.1.2 Dispersion; Phase and Group Velocities........................................................359


The Shrödinger Equation for a Free Particle Moving in One Dimension .........359
Group Velocity ...................................................................................................363
Dispersion..........................................................................................................365

5.1.3 Waves in Two and Three Dimensions ...........................................................366


Shrödinger's Equation in Three Dimensions ......................................................366
Group Velocity in an Isotropic Medium............................................................368
The Wave Equation in Three Dimensions ........................................................368
Response to a Source.........................................................................................379
Wave Propagation in an Anisotropic Medium...................................................382
Heat Equation.....................................................................................................384

Exercises for Sec. 5.1..............................................................................................386

5.2 The WKB method ................................................................................................396

5.2.1 WKB Analysis without Dispersion................................................................396


The Eikonal........................................................................................................396
Dubin Numerical and Analytical Methods for Scientists and Engineers 9

Example: Waves on an String with Varying Mass Density...............................402


WKB Method for Problems that Vary Slowly in Time: Adiabatic Invariance..404
WKB Wavepackets ............................................................................................407
WKB Waves in Two Dimensions: Water Waves Near the Shore.....................410
Ray Trajectories.................................................................................................412

5.2.2 WKB with Dispersion: Geometrical Optics...................................................415


Wave-Packet Trajectory.....................................................................................415
Hamiltonian Mechanics as the WKB Limit of Quantum Mechanics ................419
Turning Points....................................................................................................421
Wave-Packet Amplitude ....................................................................................422
Exercises for Sec. 5.2..............................................................................................424
5.3 Wave Action (Electronic Version Only)

5.3.1 The Eikonal Equation

5.3.2 Conservation of Wave Action


Exercises for Sec. 5.3

References....................................................................................................................432

Chapter 6: Numerical Solution of Linear Partial


Differential Equations............................................................................435
6.1 The Galerkin Method.........................................................................................435

6.1.1 Introduction....................................................................................................435
6.1.2 Boundary-Value Problems .............................................................................435
Theory................................................................................................................435
Example 1..........................................................................................................438
Example 2..........................................................................................................442
Example 3..........................................................................................................446

6.1.3 Time-Dependent Problems ............................................................................451


The Heat Equation.............................................................................................451
Reflection of a Quantum Particle From a Barrier..............................................457

Exercises for Sec. 6.1..............................................................................................461


10 Table of Contents

6.2 Grid Methods........................................................................................................464

6.2.1 Time-Dependent Problems ............................................................................464


FTCS Method for the Heat Equation.................................................................464
Von Neumann Stability Analysis.......................................................................467
CTCS Method....................................................................................................469
Lax Method........................................................................................................469
Implicit Methods. The Crank-Nicolson Algorithm. ...........................................470
Von Neumann and Mixed Boundary Conditions...............................................474
Multiple Spatial Dimensions ..............................................................................477
6.2.2 Boundary-Value Problems .............................................................................486
Direct Solution...................................................................................................486
Nonrectangular Boundaries................................................................................489
Relaxation Methods...........................................................................................494
FFT Method.......................................................................................................499

Exercises for Sec. 6.2..............................................................................................504

6.3 Numerical Eigenmode methods (Electronic version only)

6.3.1 Introduction

6.3.2 Grid-Method Eigenmodes


General Theory
Example 1: 1D Heat Equation with Mixed Boundary Conditions
Example 2: 2D Drumhead Eigenmodes

6.3.3 Galerkin-Method Eigenmodes


General Theory
Example 1: 1D Quantum Harmonic Oscillator Eigenmodes
Example 2: 2D Drumhead Eigenmodes

6.3.4 WKB Eigenmodes


The Wave Equation
Eigenmode Correction Using the Shooting Method
Eigenvalues in the Presence of Turning Points
Example: Quantum Harmonic Oscillator Frequencies
Shooting Method for Problems with Turning Points
Dubin Numerical and Analytical Methods for Scientists and Engineers 11

Exercises for Sec. 6.3

References....................................................................................................................510

Chapter 7: Nonlinear Partial Differential Equations


...........................................................................................................................................511

7.1 The Method of Characteristics for First-Order PDES...............................511

7.1.1 Characteristics................................................................................................511

Example 1 : s = 0 and vHx, t, f L = c ................................................................514


7.1.2 Linear Cases...................................................................................................513

Example 2 : s = a xn and v = b x. .....................................................................515


Example 3: Mixing Dye.....................................................................................516
Example 4: The Collisionless Boltzmann Equation..........................................519

7.1.3 Nonlinear Waves............................................................................................529


A First-Order Nonlinear Wave Equation...........................................................529
Solution..............................................................................................................530
Wavebreaking Time...........................................................................................532

Exercises for Sec. 7.1..............................................................................................534

7.2 The K-dV Equation .............................................................................................536

7.2.1 Shallow-Water Waves with Dispersion .........................................................536

7.2.2 Steady Solutions: Cnoidal Waves and Solitons.............................................537

7.2.3 Time-Dependent Solutions: the Galerkin Method.........................................546


Introduction........................................................................................................546
Example 1: Cnoidal Wave.................................................................................548
Example 2: Interacting Solitons.........................................................................550
Example 3: Suppression of Wavebreaking ........................................................551
7.2.4 Shock waves: Burgers' Equation....................................................................554
Steady Solutions .................................................................................................554
CTCS/Crank-Nicolson Approach......................................................................556
12 Table of Contents

Exercises for Sec. 7.2..............................................................................................560

7.3 The Particle-in-Cell Method (Electronic Version Only)

7.3.1 Galactic Dynamics

7.3.2 Strategy of the PIC Method

7.3.3 Leapfrog Method


7.3.4 Force
1) Mass Density on the Grid
2) FFT for the Potential
3) Interpolation of the Force From the Grid to Particle Positions
7.3.5 Examples
Code Tests
Gravitational Collapse in a Cold Gas
Stability of a Hot Gas to Gravitational Collapse
Rotation
Exercises for Sec. 7.3
References......................................................................................................................566

Chapter 8: Introduction to Random Processes..........567


8.1 Random Walks.....................................................................................................567

8.1.1 Introduction....................................................................................................567

8.1.2 The Statistics of Random Walks....................................................................568


The Random Walk Model ..................................................................................568
Simulations.........................................................................................................569
The Binomial Distribution .................................................................................575
Averages.............................................................................................................578
The Heat and Fokker-Planck Equations from the Random Walk Model..........581

Exercises for Sec. 8.1..............................................................................................586

8.2 Thermal Equilibrium ..........................................................................................592


Dubin Numerical and Analytical Methods for Scientists and Engineers 13

8.2.1 Random Walks with Arbitrary Steps.............................................................592


Averages.............................................................................................................592
Conditional Probability and the Master Equation ..............................................594
Correlation Functions.........................................................................................595
Inhomogeneous Random Walks........................................................................596

8.2.2 Simulations.....................................................................................................598
Transformation Method.....................................................................................598
Rejection Method ...............................................................................................599
Two Simulations of a Random Walk with Bias.................................................601

8.2.3 Thermal Equilibrium......................................................................................605


The Boltzmann Distribution ...............................................................................605
Einstein Relations ..............................................................................................606
Irreversibility and the Free Energy ....................................................................607
Comparison with Simulations ............................................................................607

Exercises for Sec. 8.2..............................................................................................609

8.3 The Rosenbluth-Teller-Metropolis Monte Carlo method (Electronic Version


Only)
8.3.1 Theory
8.3.2 Simulations
Example 1: Ideal Gas in Gravity
Example 2: Lennard-Jones Clusters
Exercises for Sec. 8.3

References....................................................................................................................615

Chapter 9: Introduction to Mathematica (Electronic Version


Only)

9.1 Starting Mathematica

9.2 Mathematica Calculations

9.2.1 Arithmetic

9.2.2 Exact vs. Approximate Results


14 Table of Contents

9.2.3 Some Intrinsic Functions

9.2.4 Special Numbers

9.2.5 Complex Arithmetic

9.2.6 The Function N and Arbitrary-Precision Numbers

Exercises for Sec. 9.2

9.3 The Mathematica Front End and Kernel

9.4 Using Previous Results

9.4.1 The % Symbol

9.4.2 Variables

9.4.3 Palettes and Keyboard Equivalents

9.5 Lists, Vectors, and Matrices

9.5.1 Defining Lists, Vectors, and Matrices

9.5.2 Vector and Matrix Operations


Vector Addition
Dot Product
Matrix Multiplication
Other Matrix Operations

9.5.3 Creating Lists, Vectors, and Matrices with the Table Command

9.5.4 Operations on Lists

Exercises for Sec. 9.5

9.6 Plotting Results

9.6.1 The Plot Command

9.6.2 The Show Command

9.6.3 Plotting Several Curves on the Same Graph


Dubin Numerical and Analytical Methods for Scientists and Engineers 15

9.6.4 The ListPlot Function

9.6.5 Parametric Plots

9.6.6 3D Plots

9.6.7 Animations

9.6.8 Add-On Packages

Exercises for Sec. 9.6

9.7 Help for Mathematica Users

9.8 Computer Algebra

9.8.1 Manipulating Expressions

9.8.2 Replacement

9.8.3 Defining Functions


Functions of One Variable
Checking the Definition of a Function
Functions of Several Variables

9.8.4 Applying Functions

9.8.5 Delayed Evaluation of Functions

9.8.6 Putting Conditions on Function Definitions

Exercises for Sec. 9.8

9.9 Calculus

9.9.1 Derivatives

9.9.2 Power Series

9.9.3 Integration

Exercises for Sec. 9.9


16 Table of Contents

9.10 Analytic Solution of Algebraic Equations

9.10.1 Solve and NSolve


One Equation in a Single Variable
Coupled Equations in Several Variables
Linear Equations and Under-Determined Systems
Nonlinear Equations

Exercises for Sec. 9.10

9.11 Numerical Analysis

9.11.1 Numerical Solution of Algebraic Equations

9.11.2 Numerical Integration

9.11.3 Interpolation

9.11.4 Fitting
Reading Data from External Files

Exercises for Sec. 9.11

9.12 Summary of Basic Mathematica Commands

9.12.1 Elementary Functions

9.12.2 Using Previous Results; Substitution and Defining Variables

9.12.3 Lists, Tables, Vectors and Matrices

9.12.4 Graphics
Basic Plotting
Contour and Density Plots
Three-Dimensional Surface Plots
Plotting Lists of Data
Parametric Plots
Some Other Plots

9.12.5 Symbolic Mathematics


Algebraic Equations
Differential Equations
Dubin Numerical and Analytical Methods for Scientists and Engineers 17

References

Appendix: Finite-Differenced Derivatives.......................617

Index........................................................................................................................... 620

You might also like