COMPUTATIONAL PHYSICS

Nicholas J. Giordano

During the past several years I have worked to develop an undergraduate
course on computational physics.
The goal of this course has been to introduce students to some
basic numerical techniques and then apply these techniques to a number
of *modern* topics, that is, problems of current interest to
physicists. I have long felt that the traditional introductory
physics courses place too much emphasis on topics which have remained
unchanged for a century or more.
Very little effort is made to introduce the types
of problems that *today's* physicists find interesting or to
convey the excitement we feel in our work. A standard
and perhaps somewhat justifiable excuse given for
this shortcoming is that to treat such topics
would require a level of mathematical
expertise far beyond that of a typical student.
It is here that
computers can make a qualitative difference.
Students with some experience in differential and integral calculus
can readily grasp rather sophisticated computational techniques.
These students can use computers as
tools with which to attack and solve problems which
they would not ordinarily encounter in the undergraduate curriculum.
I have used this approach to try to convey the
excitement of physics, with a variety of
problems of current interest.

After I had formulated tentative plans for my course, I was faced
with actually putting it together, and an early step in this process was
to find a textbook. While there are many new books
with the terms ``computers'' and ``physics'' in their titles, I was not
able to find a text that was suitable for my needs. Most of
the books in this area tend to focus heavily on numerical
methods rather than physics.
Since my goal was to teach a course on *physics*,
rather than numerical methods, these books were not a good match.
While there are a few books that emphasize the
physics that can be done with
numerical methods, they are either too advanced for use by
undergraduates, or (more commonly) they fail to deal with the
types of problems that can profit most from a numerical approach. In too
many cases they tend to simply treat the standard problems, which are already
dealt with in many traditional texts using analytic methods.

I was therefore forced to gather the material for my course from a
wide variety of ``primary''
sources, as will become clear from the references at the
end of each chapter. In many cases I started with papers from the
recent physics literature and then ``distilled'' them
to produce problems suitable for an undergraduate class.
This book contains the results of my efforts.
While it is necessary for this book
to introduce a variety of numerical methods of interest
to physicists, the overriding
emphasis is on the physics that can be done with
these methods. The majority of the problems described in this book cannot
be solved with purely analytic techniques. A computational approach is
required in most cases, and I have tried to use the computer to make
the *physics* as clear and as interesting as possible.

**How to use this book**

When my course was in the design stages, one constraint imposed
by local realities (i.e., space in our sequence of courses) was that it
fit into the early part of the undergraduate curriculum. My
course is taken mainly by sophomores whose only previous physics course
is on
introductory mechanics. Their mathematics backgrounds vary widely.
It usually includes a total of two semesters of calculus, so one can
assume only that they have been exposed to the basics of differentiation
and integration. This background is easily sufficient for a wide variety
of topics. My course currently includes projectile motion without and
with realistic air resistance, planetary motion
and the 3-body problem, chaotic motion of the pendulum,
waves on a string, and some topics relating to fractal growth
and stochastic systems. This material is covered in Chapters 1-4, 6 and 7,
although these chapters contain
many ``extra'' topics and examples, which time does not allow
me to discuss in the course. In fact, this book
contains *far* more material than could possibly be covered in a
one semester course. This ``extra'' material is included
to give the student
(and instructor) some flexibility in the choice of topics and depth of
coverage. I have used many of these extra problems for midterm or final
projects.
This book could also be used as a supplement to other
courses. For example, a course in electricity and magnetism could
make extensive use the material in Chapter 5, while an advanced mechanics
course might find the examples on chaotic dynamics and waves
on a realistic string useful.
While a course aimed at advanced undergraduates could certainly
make use of the material in the first few chapters, the emphasis would
probably be on the examples from statistical physics and quantum
mechanics in Chapters 8-10. Chapter 11 brings together ideas
developed earlier in the book to deal with three interdisciplinary
topics and could be of interest to students at virtually any level.

It is obvious that numerical methods play a major role in this book, but
given my desire to place the primary emphasis on physics, there is simply
not enough space to describe all of the subtleties associated with all
of the numerical methods in full detail.
Fortunately, there are several excellent books in this area (as mentioned
in the references), so the student or instructor who desires an in-depth
discussion can readily find one. However, this does *not* mean
that I have cut corners with my treatment of numerical methods.
I am perhaps a bit old fashioned, as I firmly believe that students
should write their own original programs. This requires a careful
treatment of the numerical methods, and this book contains ample
explanation of the necessary algorithms. I believe that this book
contains *all* the information that a
student would need to write programs
that perform all of the calculations that are described here.

While I am perhaps, as just admitted, old fashioned in my belief that students should write their own programs, I have relented to the requests of those who have refereed this book (and my publisher!), and provided many example programs. Some of these program listings are sprinkled throughout the book, in connection with discussions of the various problems and algorithms. In addition, Appendix 4 contains full listings of a number of representative programs; these listings are included on the diskette that accompanies the book and are also available though the Prentice Hall World Wide Web page. However, this book contains many example calculations, and most of these programs are not included. After all, some work must be left for the student.

The inclusion of source code leads naturally to the question of language.
My course currently uses the *True Basic* language system, and all of
the program listings are in this dialect of Basic.
I fully realize that many readers will prefer some other language.
My course has, at various times, used Pascal, C, and
Fortran. However,
if forced to choose one ``common denominator'' language, I feel that
Basic is a good
choice. Moreover, *True Basic* has available an
excellent library of graphics routines, and can be used with a variety
of machines. I have used it
on IBM-compatibles, Macintoshes, Amigas, and Suns, and it is available for
other machines as well.
It is a well structured language (you will not find a single `go to`
statement in this book), and in nearly all cases it can easily be
translated, usually line-for-line, into the other languages mentioned above.
In addition, it is quite readable as a ``pseudo-code'', so even students
who prefer to work with another language should be able to take full
advantage of the examples.
In any event, I certainly understand that the choice of computer language
can be a highly personal one, and I do not want to imply that any
particular language is better than any other for the numerical work
encountered in physics. My intent with this book has been to make
the ideas underlying the numerical methods as clear as possible, so that
students can use the language of their choice, be it C or Fortran or
Mathematica or Maple.

This book contains a rather large number of example calculations. The
pattern of my presentation is to show the results of specific computations
as I introduce and
discuss the physics. *All* of the example calculations
in this book have been
tested by the author using *True Basic*. The vast majority can be
carried out in
a reasonable amount of time (a few minutes or, usually, much less)
with a Macintosh containing no more than a 68020 CPU. By the time
this book reaches print, such machines will be hard to find, and most
microcomputers will be faster by an order of magnitude or more. Hence,
computational resources should not be a limitation in working out the
problems in this book.

I owe many thanks to many people. The support of Arnold Tubis and the Department of Physics at Purdue, along with that of the National Science Foundation, made my course and hence this book possible. Many graduate students have helped me teach and develop the course; Miguel Castro, Chris Parks, Jan Spitz, Stuart Burnett, Todd Jacobs, and Dan Lawrence have taught (and corrected) me a great deal. Of course, the undergraduate students who have willingly submitted to the course have provided much useful feedback; there are too many to mention them all here, although Mike Pennington deserves a special thanks. Many colleagues have provided essential advice and encouragement, including Mark Haugen and Paul Muzikar. I am especially indebted to Paul and Todd for their detailed comments on the manuscript. The suggestions of the referees, Alejandro Garcia, Jan Tobochnik, and Rodney Varley (who were quite polite and constructive) have helped me a lot, as have the comments and advice of my editors, Ray Henderson and Alison Reeves. The final impetus to actually write this book was provided by the well-timed encouragement of Earl Prohofsky and Betsy Beasley. And finally, I thank my wife and children for helping in many ways, including numerous dinner-time discussions of the physics of everyday phenomena and the travels of Lucky Star.

Fri Sep 5 11:21:18 EST 1997