Software in the Math Center

This page explains how to use the software installed in the Mathematics Center computer lab for Numerical Methods I. There should be an icon that looks like

C=
Cygwin

on the Windows 95 desktop. Clicking on this icon will open a terminal window with the BASH command interpreter running in it. If this fails, then select Shut Down from the menu and then log on as a different user. Enter the username MathCenterNN where NN is the computer number with no password. If the icon still doesn't work, then try a different machine.

From the BASH terminal window you may edit, compile and run programs in a way similar to using a UNIX workstation. This is the Cygwin programming environment. It may be closed by typing exit and then pressing <enter>. Occasionally a window will remain displayed on the screen. If this happens, you must close the window with your mouse by clicking Yes when asked the question do you wish to terminate this program

Saving Your Files

The computers in the Mathematics Center are shared by many people. Since there are no personal directories, you should store your files on a floppy disk or use ftp or scp to save them elsewhere on the network.

The default or home directory for the Cygwin programming environment is named MathCenterNN where NN is the number of the computer you are using. It is a subdirectory of gnu/cygwin/home located on the local hard disk. Type cd and press <enter> to change to the default directory.

To copy the file prog1.c from the floppy to the current working directory type

	cp //a/prog1.c .
Note that the trailing period with a space before it is necessary and refers to the current working directory. To copy the file back to the floppy type
	cp prog1.c //a
If you prefer, you may use your mouse to copy files back and forth between the hard disk and the floppy. Using Windows 95 naming conventions, the default directory would be called c:\gnu\cygwin\home\MathCenterNN where NN is the number of the computer you are using.

Editing a Program

The following editors are installed and suitable for writing programs: Type emacs prog1.c to edit the C program named prog1.c using Gnu EMACS. If you are already familier with a particular editor it would probably be best to stick with it. It is possible, though cumbersome, to edit programs using Microsoft Word or some other word processor. If you must do this, please remember to save your files as plain text so the compiler can read them.

FPK Pascal has an integrated programming environment with a built in editor. To enter the integrated environment type fp in the terminal window. This programming environment is similar to the environments available in Microsoft Visual Developer and Borland Delphi.

FORTRAN Programs

The name of a FORTRAN program should end with .f in order to destinguish it from other files. Type g77 prog1.f to compile the FORTRAN program named prog1.f using the Gnu FORTRAN compiler. If there are errors they will be displayed on the screen; otherwise an executable program file named a.exe will be created which can be run by typing ./a.exe in the terminal window.

C Programs

The name of a C program should end with .c in order to destinguish it from other files. Type gcc prog1.c to compile the C program named prog1.c using the Gnu C compiler. If there are errors they will be displayed on the screen; otherwise an executable program file named a.exe will be created which can be run by typing ./a.exe in the terminal window.

Pascal Programs

The name of a Pascal program should end with .pas in order to destinguish it from other files. There are two ways to write a Pascal program. The easiest way is by using the FPK Pascal integrated programming environment. This may be done by typing fp in the terminal window. Alternatively a method similar to the one used for C and FORTRAN may be employed. Type ppc386 prog1.pas to compile the Pascal program named prog1.pas using the FPK Pascal compiler. If there are errors they will be displayed on the screen; otherwise an executable program file named prog1.exe will be created which can be run by typing ./prog1.exe in the terminal window.

Reading a Data File

Many of the programming assignments require that a program be run using data from a particular file such as file01.dat for input. These files are contained in the share math483 on the NT server pythagoras and are also available over the internet. If you are using the BASH command interpreter typing cd //pythagoras/math483 will change to the directory containing these files.

Copy the necessary data files to the directory where your program is stored, then type ./a.exe <file01.dat to run the executable program a.exe with input redirected from the file file01.dat.

Typing the Report

The mathematical typsetting program TeX is available to prepare your reports. Type tex report1.tex to format a file and then yap report1.dvi to preview and print it. TeX is widely used in the scientific community to prepare research papers for publication. If you are not familiar with TeX you may want to use a standard word processer such as Microsoft Word instead.


Last updated: Wed Jan 24 10:53:09 PST 2001