THE UNDERGRADUATE COMPUTING ENVIRONMENT
(This is particularly relevant to Exercise 5, "Programming in Mathematica.")
You may get an account for the undergraduate computer Faraday from your Group Leader. For those who wish to try our the DOS compilers Turbo Pascal or Turbo C on one of the laboratory PCs, you will wish to also acquire the document PCs in the UPSCALE environment.
The UNIX menu system provides access to the UNIX C, FORTRAN, and Pascal compilers, as well as the awk and Mathematica interpreters. The prog menu called from main is where you create and execute programmes. Also as part of that system is a programme named genexer that will generate test data for each of the programming tasks of this Exercise. The data thus generated is a dataset which may be manipulated, backed up, and analyzed from the data menu.
Datasets on Faraday are simple ASCII files. They end with an end of file (EOF) which your programme should be taught to recognise.
Data points are on separate lines. Thus a dataset consisting of a single variable will look like:
1.4
1.5
1.6
(EOF)
A dataset consisting of two variables will look like:
1.42.8
1.53.05
1.63.12
(EOF)
If you are inputting data to your programme with a terminal you will need to know that you can generate an EOF by sending a ctrl-d: simultaneously hold down the key labelled CTRL and the d key.
When (often not "if") a programme goes out of control, such as an infinite loop, you will need to interrupt it. The interrupt signal is sent by pressing the BREAK key on the keyboard. Alternatively, you can send a ctrl-c to send an interrupt.
The compiled languages (C, FORTRAN, and Pascal) automatically include the Sun mathematics library; the following table lists the contents.
Math library functions
Name(s) / Descriptionexp, log, log10, pow, sqrt / exponential, logarithm, power, squareroot
floor, fabs, ceil, fmod / floor, absolute value, ceiling, remainder
hypot / Euclidean distance
j0, j1, jn, y0, y1, yn / bessel functions
sin, cos, tan, asin, acos, atan, atan2 / trigonometric functions
sinh, cosh, tanh / hyperbolic functions
(Note that Mathematica has its own notation for functions.)
ANNOTATED BIBLIOGRAPHY ON PROGRAMMING LANGUAGES
All are available from the Second Year Lab library.
S. Wolfram, Mathematica (Addison-Wesley, N.Y., 1990) ISBN 0201515024 or 0201515075 (paperback). The `bible' of Mathematica written by its designer.
A.V. Aho, B.W. Kernighan and P.J. Weinberger, The AWK Programming Language (Addison-Wesley, Don Mills, 1988) ISBN 020107981-X. A complete description of the `new' awk language by its authors.
B.W. Kernighan and R. Pike, The UNIX Programming Environment (Prentice Hall, Englewood Cliffs NJ, 1984). A classic on the UNIX operating system, it has an excellent brief introduction to awk and treats some advanced topics of the C
language.
B.W. Kernighan and D.M. Ritchie, The C Programming Language (Prentice-Hall, Englewood Cliffs NJ, 1978). Every C programmer has this book near their terminal. The first edition describes the version of the language which our compiler uses; the second edition describes the forthcoming ANSI standard version.
M. Metcalf, Effective Fortran 77 (Oxford Science Publications, Oxford, 1985) ISBN 0198537093. A well written discussion of `plain vanilla' Fortran. One of the few books that gives a sophisticated overview of the language that also describes the language exclusively in terms of constructs that should be portable to any F77 compiler.
W.H. Press, B.P. Flannery, S.A. Teukolsky and W.T. Vetterling, Numerical Recipes (Cambridge Univ., N.Y., 1986) ISBN 0521308119. A gold mine of techniques using both FORTRAN and Pascal. C programmers should see the next listing.
W.H. Press, B.P. Flannery, S.A. Teukolsky and W.T. Vetterling, Numerical Recipes in C (Cambridge Univ., N.Y., 1988) ISBN 052135465-X. A wonderful book, although not every programmer agrees with their harsh words about the C language's switch() construct.
1