Computers have revolutionized our society; this is particularly striking in the fields of Science and Engineering. These ``hard'' disciplines are seeing computers becoming part of the everyday routine of most practitioners in these fields. New branches of Science and Engineering have even appeared due to computers. In Physics, in particular, there once used to be theoretical physicists, trying to model mathematically the many phenomena encountered, and there were experimental physicists, trying to uncover new phenomena and measure appropriate quantities to prove or disprove the theories. Now there are also computational physicists, modeling phenomena numerically, and ``experimenting'' on computers using these models. Experimental mathematics, once a contradiction in terms, is now a reality.
A well-rounded researcher in theoretical physics must traditionally know theoretical models, with their necessary bagage of analytical mathematics, and an experimental physicist must know the nuts and bolts of electronics, vacuum techniques, and so on. Nowadays both must also know much about numerical techniques and how to control computers. Computers have permeated our discipline to such an extent that they are at work in direct or indirect ways in virtually all ares of research. Computational physicist represent the extreme case where computers, by virtue of their power, have opened up entirely new avenues of research. It goes without saying that detailed knowledge of numerical techniques is indispensable in this case.
This course is about physics, but seen from the point of view of a computational physicist. We will see many models dealing with various physical situations; we will explain the physics leading to these models and their mathematical background; we will then invariably try to further our physical intuition by obtaining numerical solutions for the models. Analysis of our results will lead us naturally to the use of graphical tools. The numerical techniques used in the solutions will be explained; their origin, their generality and their limitations in accuracy will be touched upon in all cases. But our course will not be a rigourous course on numerical analysis; we will be content to explain the ideas in an intuitive way, only being ``mathematically rigorous'' when absolutely necesssary to further our understanding. ``Computational sciences'' are very different than ``computer science;'' the former aims at solving challenging science and engineering problems numerically, accurately and, abaove all, efficiently.
During this course you will hear much about computing, but relatively little about computers; most of our topics will apply to any computing platform. However, this chapter is an exception. To be concrete, we will assume that our computing environment is UNIX, using X-windows, and that the language of choice for our programming is C. This chapter intends to get us started in this computing environment.
One goal of this course is to get us to think in general terms about good programming practices. Let's face it: the numerical solution of models encountered in our research can seldom be achieved via pre-packaged software. Usually, a numerical solution can only be obtained via hand-written lengthy procedures. Who do you suppose will write these procedures? Good programming practices are indispensable in this endeavor.
Let's get started, shall we?
This course will assume the implementation of this ideal computing environment via a local UNIX file/compute server and X-terminals. Furthermore, we will standarize on the UNIX Operating System (OS) and X-windows as our software environment.
Over the years, computer vendors have adapted their own versions of UNIX, usually with flavors resembling either BSD or System V. Some vendors have even gone from one flavor to the other over the years, as is the case with Sun Microsystem, which moved from BSD to System V in moving from SunOS 4 to Solaris. The functionalities of the different flavors of UNIX are the same for the the most part, but minor differences do exist in some commands, and major differences exist in the organization of the files on disk. At the level of the casual user, however, these differences are minor.
UNIX also comes with (at least) three different command interpreters, or shells. The C-shell (invented by Bill Joy, the founder of Sun Microsystems, then at Berkeley), the Korn shell, and the Bourne shell, the "original" UNIX shell, still beloved by "real" UNIX hackers. Most systems support the three shells, assuring that a user can customarize the environment to his/her needs. Small differences may exist between the shell interpreters on different systems, but the casual user will not be hindered by this. The csh command launches the C shell while the sh command launches the Bourne shell. These two commands are handy to change shell. Each user has his/her own default shell, as set in the /etc/passwd file file. We will use the C-shell syntax in these notes; our system default is a ``souped-up'' version of C-shell, called tcsh.
One very important consequence of the implementation of the X-window system was the development of X-terminals. These are sophisticated computers, with specialized software enabling them to act as X-servers. This makes for a clean distribution of labor between the computing part of a problem, best done on a compute server, and the handling of the user interface, including graphics, by the X-terminals. This allows the implemention of fast graphics at reasonable cost, compared to powerful standalone workstations.
FORTRAN and C interface very readily and efficiently; a FORTRAN program can use C routines, and vice-versa, with little programming effort. This renders the choice of the language less critical for many applications. The important thing is to eventually become comfortable in one of the two languages, and perhaps know a little of the other.