COMPUTING IN APPLIED SCIENCE
William J. Thompson
University of North Carolina, Chapel Hill
John Wiley & Sons
New York
Chichester
Brisbane
Toronto
Singapore
CONTENTS
MODULE A APPLICABLE MATHEMATICS |
Al
Introduction to Applicable Mathematics
What is applicable mathematics? Motivation for using computers;
Against the abuse of computer power
A2
Complex Numbers and Complex Exponentials
A2.1
Definitions: The algebra of complex numbers
4
Rules for complex numbers; Computers and complex numbers;
Complex numbers and geometry; Complex conjugation, modulus,
argument
A2.2
The complex plane: De Moivre 's theorem
10
Cartesian and plane-polar coordinates; De Moivre's theorem
A2.3
Complex exponentials: Euler's theorem
13
Deriving Euler's theorem; Applying Euler's theorem
A2.4
Hyperbolic functions
15
Definition of hyperbolic functions; Circular-hyperbolic analogs
A2.5
Phase angles and vibrations
18
A2.6
Diversion: The interpretation of complex numbers
Problems with complex numbers
19
20
Finding buried treasure; Proofs of De Moivre's theorem; Exponentials and the
FFT; Exponentialfun; Graphing hyperbolicfunctions; Analytic continuation
References on complex numbers
A3
Power Series Expansions
A3.1
Motivation for using power series
21
23
23
t Items in italics indicate extensive problems.
xv
xvi
Contents
A3.2
Convergence of power series
24
The geometric series; Geometric series summed
A3.3
Taylor series and their interpretation
27
Proof of Taylor's theorem; Interpreting Taylor series
A3.4
Taylor expansions of useful functions
29
Expansion of exponentials; Series for circular functions;
Hyperbolic function expansions
A3.5
T h e binomial approximation
33
The binomial approximation derived; Interpreting the binomial
approximation; Applying the binomial approximation
A3.6
Diversion: Financial interest schemes
Problems with power series
35
36
Complex geometric series; Proof by induction; Numerical geometric series,
Series by analogy; Numerical exponentials; Logarithms in series; Euler and
Maclaurin; Numerical cosines and sines; Financing solar energy
References on power series
39
A4
Numerical Derivatives, Integrals,
and Curve Fitting
40
A4.1
The discreteness of data
40
Numerical mathematics; Discreteness
A4.2
Numerical noise
41
Round-off error; Truncation error; Unstable problems and
unstable methods; Subtractive cancellation; Numerical evaluation
of polynomials
A4.3
Approximation of derivatives
47
Forward-difference derivatives; Central-difference derivatives;
Error estimates for numerical derivatives; Numerical second
derivatives
A4.4
Numerical integration
51
Trapezoid formula; The Simpson formula; Comparing trapezoid
and Simpson formulas
A4.5
Diversion: Analytic evaluation by computer
54
Contents
A4.6
Curve fitting by splines
55
Introduction to splines; Derivation of spline formulas; Algorithm
for spline fitting; Spline properties; Development of splines and
computers
A4.7
The least-squares principle
61
Choice of least squares; Derivation of least-squares equations; Use
of orthogonal functions; Fitting averages and straight lines
Problems in numerical analysis
68
Round-off and truncation noise; Numerical convergence of series; Subtractive
cancellation in quadratics; Comparison ofpolynomial algorithms; Numerical
integration algorithms; Integral approximations to series; Natural splines have
minimal curvature; Program for cubic splines; Orthogonal polynomials for
least-squares fit; Stability of least-squares algorithms
References on numerical analysis
71
A5
Fourier Expansions
73
A5.1
Overview of Fourier expansions
73
Transformations; Nomenclature of Fourier expansions
A5.2
Discrete Fourier transforms
75
Derivation of the discrete transform; Properties of the discrete
transform
A5.3
Fourier series: Harmonic approximations
78'
From discrete transforms to series; Interpreting Fourier coefficients
A5.4
Examples of Fourier series
80 .
Square pulses; Fourier coefficients and symmetry conditions; The
wedge function; Window functions; Convergence of Fourier
series
A5.5
Diversion: The Gibbs phenomenon
87
A5.6
Fourier series for arbitrary intervals
Interval scaling; Magnitude scaling
88
A5.7
Fourier integral transforms
89
From Fourier series to Fourier integrals; Applying Fourier integral
transforms
xviii
A5.8
Contents
A fast Fourier transform algorithm
93
Derivation of FFT algorithm; Reordering the FFT coefficients;
Comparing FFT with conventional transforms
Problems on Fourier expansions
98
Relating Fourier coefficients through algebra; Relating Fourier coefficients
through geometry; Smoothing window functions; Gibbs phenomenon and
Lanczos damping factors; Dirac delta function; FFT in remote-sensing
applications
References on Fourier expansions
100
A6
Introduction to Differential Equations
From the particular to the general
A6.1
Differential equations and physical systems
101
Why differential equations? Notation and classification;
Homogeneous and linear equations
A6.2
Separable differential equations
104
Relating student scores and work; Generalizing separable
equations
A6.3
First-order linear equations: World-record sprints
107
Kinematics of world-record sprints; Limbering up; Physics and
physical activity; General first-order differential equation
A6.4
Diversion: T h e logarithmic century
111
Interpreting exponential behavior; Bell's decibels
A6.5
Nonlinear differential equations
1 14
The logistic growth curve; Exploring logistic growth
A6.6
Numerical methods for first-order equations
1 18
Predictor formulas; Initial values for solutions; Stability of
numerical methods
Problems on first-order differential equations
101
123
Acceleration and speed in sprints; World-class sprinters; Attenuation in solar
collectors; Predictions from exponential growth; Belles, bells and decibels;
Reaping Nature's bounty; The struggle for survival; Unstable methods for
differential equations
References on differential equations
128
Contents
A7
Second-Order Differential Equations
130
Why are second-order equations so common?
A7.1
Cables and hyperbolic functions
131
Getting the hang of it; Interpreting the cable parameter; Solving
the cable differential equation; Exercises with catenaries
A7.2
Diversion: History of the catenary
A7.3
Second-order linear differential equations
136
Mechanical and electrical analogs; Solving the equations for free
motion; Discussion of free-motion solutions
A7.4
Forced motion and resonances . 142
Differential equation with a source term; Alternative treatment by
Fourier transforms; Resonant oscillations; The Lorentzian function
A7.5
Electricity in nerve fibers
147
Modeling nerve fibers; Solution of the axon potential
A7.6
Numerical methods for second-order equations
150
Euler approximations; Numerov's method for linear equations;
Comparisons of Euler and Numerov algorithms
A7.7
Solution of stiff differential equations
155
What is a stiff differential equation? The Riccati transformation
136
Problems on second-order differential equations
158
Cables and arcs; Suspension bridges; Properties of Lorentzians; Electricity
in axons; Stability of Euler approximations; Madelung transformations for
stiff equations
References on differential equations
162
A8
Applied Vector Dynamics
163
A8.1
Kinematics in Cartesian and polar coordinates
163
Polar coordinate unit vectors; Velocity and acceleration in polar
coordinates
A8.2
Central forces and inverse-square forces 166
Angular momentum conservation: Kepler's first law; Areal
velocity: Kepler's second law
xx
Contents
i
A8.3
Satellite orbits
169
Inverse-square force differential equations; Analytic solution of
orbit equations; Some geometry of ellipses; Relation of period to
axes: Kepler's third law
A8.4
Diversion: Kepler's Harmony of the World
A8.5
Summary of Keplerian orbits
176
Kepler's three laws; The inverse-square laws from Kepler's laws
Problems on vector dynamics
175
178
Earth-bound projectiles; Electrostatic-force orbits; Solar properties;
Comets; Interstellar travel
References on vector dynamics
180
MODULE L LABORATORIES IN COMPUTING f
LI
Introduction to the Computing Laboratories
182
Analysis and simulation by computer; Coding is not programming
is not computing; The programming languages; Exploring with
the computer; References on languages
L2
Conversion Between Polar
and Cartesian Coordinates
L2.1
185
Cartesian coordinates from polar coordinates
185
Pascal program for conversion to Cartesian coordinates; Fortran
program for conversion to Cartesian coordinates; Exercises on
Cartesian from polar coordinates; Cartesian coordinates from polar
coordinates
L2.2
Polar coordinates from Cartesian coordinates
187
Pascal program for conversion to polar coordinates; Fortran
program for conversion to polar coordinates; Exercises on polar
from Cartesian coordinates; Polar coordinatesfrom Cartesian coordinates
L3
Numerical Approximation of Derivatives
L3.1
Forward and central difference methods
Extrapolation to the limit
| Items in italics indicate extensive programming exercises.
192
193
Contents
L3.2
Exercises in numerical differentiation
194
Numerical derivatives program structure; Exercises on numerical
derivatives; Numerical derivatives of simple functions; Extrapolating to
the limit for derivatives; Second derivatives numerically estimated; Other
differentiation techniques
References on numerical derivatives
197
L4
An Introduction to Computer Graphics
Why printer graphics?
198
L4.1
Plotting using printers
199
Formulas for scales and origins; Printer plotting procedure
structure
L4.2
Sample programs for printer plots
201
Printer plots from Pascal; Printer plots from Fortran; Plotting
exercises; Graphic examples, Improving your image; A pot-pourri of plots
L4.3
Other graphics techniques
209
Video-screen and interactive graphics; Static graphics
References on computer graphics
210
L5
Electrostatic Potentials by Integration
212
L5.1
Analytic derivation of line-charge potential
212
Electrostatic potential of a line charge; On-axis potential of a line
charge; Symmetries and reflections; Scaling the line-charge
potential formulas
L5.2
Line-charge potential using trapezoid formula
216
Structure of the electrostatic potential program; Analytic evolution of
the potential; Trapezoid program for line-charge potential
L5.3
Potential integral from Simpson's formula
219
Simpson 's formula exercises; Simpson program for line-charge potential
L5.4
Displaying equipotential distributions
220
Equipotentials of a line charge; Programming equipotentials; Using
logarithmic scales for displays
xxi
xxii
Contents
L6
Monte-Carlo Simulations
L6.1
Generating and testing pseudo-random numbers
223
Power-residue random-number generator; Random numbers in a
223
given range; Program for array ofpseudo-random numbers; The random
walk
L6.2
Stimulating simulations in mathematics
227
Simulation of round-off errors; Random numbers and arithmetic
error; Estimating integrals and areas; Estimating n by MonteCarlo simulation
L6.3
The approach to thermodynamic equilibrium
229
Analytic method; Entropy and the approach to equilibrium;
Monte-Carlo method; Program for approach to equilibrium
L6.4
Simulation of nuclear radioactivity
235
Analytic formula for radioactivity; Monte-Carlo simulation;
Simulating radioactivity; Other Monte-Carlo simulations
Random references on Monte-Carlo methods
238
L7
Spline Fitting and Interpolation
239
L7.1
Sample programs for spline fitting
239
Structure of the spline procedures; Spline fitting from Pascal;
Spline fitting from Fortran
L7.2
Examples using splines
246
Boundary condition and interpolation exercises; Natural and other
spline boundary conditions; Interpolation using cubic splines; Exercises on
spline derivatives; Derivatives from cubic splines; Spline integration
exercises; Integration by cubic splines
References on spline fitting
249
L8
Least-Squares Analysis of Data
250
L8.1
Straight-line fits with errors in both variables
Straight-line least squares; Least-squares formulas
L8.2
Sample programs for straight-line fitting
253
Straight-line fitting in Pascal; Fitting to straight lines from Fortran
250
Contents
L8.3
Quarks, radiocarbon dating, solar cells, and warfare
257
Evidence for fractional charges; Least-squares analysis of fractional
charge data; Radiocarbon dating and Egyptian antiquities; Regression
analysis of radiocarbon and historical dates; Solar cell efficiency in
space; Degrading performance of solar cells; Is war on the increase?
Least-squares analysis of battle deaths
A minimal reading list on least squares
263
L9
Fourier Analysis of an EEG
265
L9.1
Introduction to encephalograplry
266
What is an EEG? Salmon EEG and socioeconomics;
The clinical record; Fourier analysis program structure
L9.2
Frequency spectrum analysis of the EEG 269
Coding the Fourier amplitude calculation; Fourier transform spectrum;
FFT programs in Pascal and Fortran; Predicting voltages from
Fourier amplitudes; Recomposing EEGs; Testing Wiener-Khinchin
L9.3
The Nyquist criterion and noise
278
The Nyquist criterion; Testing the Nyquist criterion; Effects of noise;
Analyzing noise effects
L9.4
Autocorrelation analysis of the EEG 280
Properties of autocorrelations; Noise and autocorrelations;
Autocorrelation analysis program
References on Fourier analysis and the EEG
L10
Analysis of Resonance Line Widths
283
285
L10.1 A brief introduction to atomic clocks
285
Atomic motions as clocks; Resonances and clocks
L10.2 T h e inversion resonance in ammonia
287
Microwave absorption experiments; Data for the ammonia
inversion resonance
L10.3 Fourier-transform analysis of a resonance
289
Derivation of the transform relation; Interpreting the Fourier
transform; Resonance analysis program structure; Exercises on
resonance analysis; Resonance line width program
xxiii
xxiv
Contents
LI0.4 Error analysis for the Fourier transform
294
Finite-range-of-data errors; Finite-step-size errors; Error analysis
for integral transforms
References on resonances and atomic clocks
Lll
Space-Vehicle Orbits and Trajectories
296
298
LI 1.1 Space vehicles, satellites and computers
298
Uses of space vehicles; Communications satellites; Data on Earth
satellites
LI 1.2
Numerical methods for orbits and trajectories
301
For observables to orbital parameters; Program for orbits; Numerical
integration for trajectories; Structure of the space-vehicle program;
Program for trajectories; Files for space-vehicle data
LI 1.3 Display of satellite orbits
309
Geometry of the orbit display; Illusory ellipses
References on space vehicles and satellites
INDEX
313
310