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 have had traditionally deep knowledge of theoretical models, with their necessary baggage of analytical mathematics, and an experimental physicist must have had to 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 of 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 finite accuracy will be touched upon in all cases. But our course will not be a rigorous course on numerical analysis; we will be content to explain the ideas in an intuitive way, only being ``mathematically rigorous'' when absolutely necessary 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, above 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 local workstations. Furthermore, we will standardize 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.
Linux was developed as a free publicly available UNIX OS. Its development took multiple paths that produced ever more powerful and reliable OS. On of the latest is the Ubuntu, version 9.10. Ubuntu is an operating system built by a worldwide team of expert developers. It contains all the applications you need: a web browser, office suite, media apps, instant messaging and much more.
Ubuntu is an open-source alternative to Windows and Office. UNIX comes with (at least) four different command interpreters, or shells. The C-shell (invented by Bill Joy, the founder of Sun Microsystems, then at Berkeley), the Korn shell, the BASH shell and the Bourne shell, the "original" UNIX shell, still beloved by "real" UNIX hackers. Most systems support the 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 the workstations. 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 workstation. This allows the implemention of fast graphics at reasonable cost, compared to powerful standalone workstations.
These languages interface very readily and efficiently; a PYTHON 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 or two of these languages, and perhaps know a little of the other. This allows, for instance, to use PYTHON to "organize" a large code and use C or C++ to implement the compute intensive tasks.