Programming Physical Problems
Using Mathematica and C
by. Wolfgang Kinzel, Georg Reents
Nowadays the computer is an important tool in physics. The acquisition and analysis of extensive experimental data and the control of complex experiments are hardly imaginable without the use of computers. In theoretical
physics the computer has turned from a mere calculator to a comprehensive tool. Graphical displays, numerical and algebraic solutions of equations, and extensive simulations of microscopic models have become important methods for the exploration of the laws of physics.
The computer, however, is not just a tool, it also offers new perspectives and opens new areas of research. Until recently physicists generally described nature with differential equations; nowadays discrete algorithms are also used.
For some apparently simple physical models there are only numerical answers so far. We know universal laws that any high school student can reproduce on a pocket calculator, for which there is, however, no analytical theory (yet?).
In addition to this, the computer opens up new fields to physics: neural networks, combinatorial optimization, biological evolution, formation of fractal structures, and self-organized criticality are just some of the topics from the growing field of complex systems.
Almost every advanced undergraduate or graduate physics student uses a computer at one time or another. Nonetheless, computer training and the use of computers in teaching are still by no means the expected norm, but rather the exception. The literature in this field is correspondingly sparse.
The goal of our textbook is to contribute to filling this gap.
This book evolved out of lectures at the University of Wiirzburg, Germany, for physics majors after their fourth semester – those having completed the introductory coursework in theoretical physics. It is conceived as a textbook in computational physics but may also serve as a supplement to the traditional physics classes in which the possibilities of computer use have so far been underutilized. We would like to show the reader how to solve physics problems using the computer. Experience with computers and computer languages is helpful, but not necessary, for we want to present an introduction and explain the first steps with computers and algorithms. This book does not contain many details about numerical mathematics, it does not offer a course on programming languages, nor does it teach advanced methods of computer-oriented theoretical physics. It does, however, introduce numerous physics problems, some of which are at the cutting edge of research, and tries
to solve them with simple algorithms.
One goal is to encourage our readers to do their own programming. Although a CD-ROM with finished programs is enclosed with the book, they are not meant as user-friendly experimental environments. We hope that instead
they can be taken as a starting-point, and we encourage our readers to modify them, or better yet to rewrite them more efficiently. Exercises accompany every section of this introductory book.
We have received suggestions from many colleagues and students, to whom we wish to express our thanks. We would like especially to mention M. Biehl, H. Dietz, A. Engel, A. Freking, Th. Hahn, W. Hanke, G. Hildebrand, A. Jung, A. Karch, U. Krey, B. Lopez, J. Nestler, M. Opper, M. Schreckenberg, and D. Stauffer. Special thanks go to the following three people: Martin Liiders developed the program package Xgraphics, Martin Schroder wrote the section on Unix, and Ursula Eitelwein typed the manuscript of this book in UTEX. Finally we would like to thank Martin Clajus for valuable suggestions in the course of translating this textbook into English.