Preface

To the student:
	Up to this point in your career you have been asked to use mathematics to solve rather elementary problems in the physical sciences. However, when you graduate and become a working scientist or engineer you will often be confronted with complex real-world problems. Understanding the material in this book is a first step toward developing the mathematical tools that you will need to solve such problems.

Much of the work detailed in the following chapters requires standard pencil-and-paper (i.e. analytical)  methods.  These methods include solution techniques for the partial differential equations of mathematical physics such as Poisson's equation, the wave equation, and Schrödinger's equation, Fourier series and transforms, and elementary probability theory and statistical methods. These methods are taught from the standpoint of a working scientist, not a mathematician. This means that in many cases, important theorems will be stated, not proved (although the ideas behind the proofs will usually be discussed). Physical intuition will be called upon more often than mathematical rigor.

Mastery of analytical techniques has always been and probably always will be of fundamental importance to a student's scientific education. However, of increasing importance in today's world are numerical methods.  The numerical methods taught in this book will allow you to solve problems that cannot be solved analytically, and will also allow you to inspect the solutions to your problems using plots, animations, and even sounds, gaining intuition that is sometimes difficult to extract from dry algebra.

In an attempt to present these numerical methods in the most straightforward manner possible,  this book employs the software package Mathematica.  There are many other computational environments that we could have used instead - for example, software packages such as Matlab or Maple have similar graphical and numerical capabilities to Mathematica. Once the principles of one such package are learned, it is relatively easy to master the other packages. I chose Mathematica for this book because, in my opinion, it is the most flexible and sophisticated of such packages.

Another approach to learning numerical methods might  be to write your own programs from scratch, using a language such as C  or Fortran.  This is an excellent way to learn the elements of numerical analysis, and eventually in your scientific careers you will probably be required to program in one or another of these languages. However,  Mathematica provides us with a computational environment where it is much easier to quickly learn the ideas behind the various numerical methods, without the additional baggage of learning an operating system, mathematical and graphical libraries, or the complexities of the computer language itself.

An important feature of Mathematica is its ability to perform analytical calculations, such as the analytical solution of linear and nonlinear equations, integrals and derivatives, and Fourier transforms. You will find that these features can help free you from the tedium of performing complicated algebra by hand, just as your calculator has freed you from having to do long division.

However, as with everything else in life, using Mathematica presents us with certain trade-offs. For instance, in part because it has been developed to provide a straightforward interface to the user, Mathematica is not suited for truly large-scale computations such as large molecular dynamics simulations with 1000 particles or more, or inversions of 100,000 by 100,000 matrices,  for example.  Such applications require a stripped-down precompiled code, running on a mainframe computer.  Nevertheless, for the sort of introductory numerical problems covered in this book, the speed of Mathematica  on a PC platform is more than sufficient. Once these numerical techniques have been learned using Mathematica, it should be relatively easy to transfer your new skills to a mainframe computing environment.

I should note here that this limitation does not affect the usefulness of Mathematica  in the solution of the sort of small to intermediate scale problems that working scientists often confront from day to day. In my own experience, hardly a day goes by when I do not fire up Mathematica to evaluate an integral or plot a function. For more than a decade now I have found this program to be truly useful, and I hope and expect that you will as well. (No, I am not receiving any kickbacks from Stephen Wolfram!)

There is another limitation to Mathematica. You will find that although Mathematica knows a lot of tricks, it is still a dumb program, in the sense that it requires precise input from the user. A missing bracket or semicolon often will result in long paroxysms of error statements, and less often will result in a dangerous lack of error messages and a subsequent incorrect answer.  It is still true for this (or for any other software) package, that garbage in = garbage out.  Science fiction movies involving intelligent computers aside, this aphorism will probably hold for the foreseeable future. This means that, at least at first, you will spend a good fraction of your time cursing the computer screen.  My advice is to get used to it -- this is a process that you will go through over and over again as you use computers in your career. I guarantee that you will find it very satisfying when, after a long debugging session, you finally get the output you wanted.  Eventually, with practice,  you will become Mathematica masters.

I developed this book from course notes for two junior-level classes in mathematical methods that I have taught at UCSD for several years. The book is oriented toward students in the physical sciences and in engineering, at either the advanced undergraduate (junior or senior) or graduate level. It assumes an understanding of introductory calculus and ordinary differential equations. Chapters 1-8 also require a basic working knowledge of Mathematica.  Chapter 9, included only in electronic form on the CD that accompanies this book, presents an introduction to the software's capabilities. I recommend that Mathematica novices read this chapter first, and do the exercises.

Some of the material in the book is rather advanced, and will be of more interest to graduate students or professionals. This material can obviously be skipped when the book is used in an undergraduate course. In order to reduce printing costs, four advanced topics appear only in the electronic chapters on the CD: Section 5.3 on wave action; Section 6.3 on numerically-determined eigenmodes; Section 7.3 on the particle-in-cell method; and Section 8.3 on the Rosenbluth-Teller-Metropolis Monte Carlo method. These extra sections are highlighted in red in the electronic version.

Aside from these differences, the text and equations in the electronic and printed versions are, in theory,  identical. However,  I take sole responsibility for any inadvertent discrepancies, as the good people at Wiley were not involved in typesetting the electronic textbook.

The electronic version of this book has several features that are not available in printed textbooks:

(1) Hyperlinks. There are hyperlinks in the text that can be used to view material from the web. For example, a brief biographical sketch of Sir Isaac Newton can be found by clicking here. Also, when the text refers to an equation, the equation number itself is a hyperlink that will take you to that equation. For example, Eq. (2.1.3)  is a general expression for a trigonometric Fourier series. Furthermore, all items in the index and contents are linked to the corresponding material in the book. (For these features to work properly, all chapters must be located in the same directory on your computer.) You can return to the original reference using the Go Back command, located in the main menu under Find.

(2) Mathematica Code. Certain portions of the book are Mathematica calculations that you can use to graph functions, solve differential equations, etc. These calculations can be modified at the readers pleasure, and run in situ.

(3) Animations and Interactive 3D Renderings. Some of the displayed figures are interactive three-dimensional renderings of curves or surfaces,  which can be viewed from different angles using the mouse. An example is Fig. 1.13, the strange attractor for the Lorenz system. Also, some of the other figures are actually animations. Creating animations and interactive 3D plots is covered in Sections 9.6.7 and 9.6.6, respectively.

(4) Searchable text. Using the commands in the Find menu, you can search through the text for words or phrases.

Equations or text may sometimes be  typeset in a font that is too small to be read easily at the current magnification. You can increase (or decrease) the magnification of the notebook under the Format entry of the main menu (choose Magnification), or by choosing a magnification setting from the small window at the bottom left side of the notebook.

A number of individuals made important contributions to this project: Professor Tom O'Neil, who originally suggested that the electronic version should be written in Mathematica notebook format; Professor C. Fred Driscoll, who invented some of the problems on sound and hearing; Jo Ann Christina, who helped with the proof reading and indexing; and  Dr. Jay Albert, who actually waded through the entire manuscript, found many errors and typos, and helped clear up fuzzy thinking in several places.  Finally, to the many students who have passed through my computational physics classes here at UCSD: You have been subjected to two experiments -- a Mathematica-based course that combines analytical and computational methods; and a book that allows the reader to interactively explore variations in the examples.  Although you were beset by many vicissitudes (crashing computers, balky code, debugging sessions stretching into the wee hours)  your  interest, energy, and good humor were unflagging (for the most part!) and a constant source of inspiration. Thank you.