Ast 4101

Computational Methods in the Physical Sciences

****

Spring 2007

 

M,T,W,Th 11:15AM-12:05 PM, Physics 236A**

Instructor: Prof. Tom Jones, Physics 376,  twj@umn.edu

Office Hours: M 1:00-2:00; Th 1:00-2:00

 

TA: Kostya Sapogin, Physics 384,  sapogin@physics.umn.edu

Office Hours: M 10:00-11:00, T 12:00-1:00, Th 10:00-11:00

 

 

The aim of this course is to provide an introduction to the use of computers in solving problems common to physical sciences. It is not a course designed to learn a programming language. I will assume a basic prior understanding of a high level programming language, C, C++, and/or FORTRAN. The focus will be on problem solving and some of the numerical techniques commonly used for that purpose, as well as the strengths and weaknesses of these methods. Scientific programming is as much an art as a science, so students in this class will be expected on a regular basis to write, test and apply their own routines in one of the above languages in order to experience first hand many of the issues associated with the subject. Wherever possible, examples will be selected from physics and astronomy contexts.

 

** Beginning the second week of the semester, we will meet each Tuesday during the scheduled class time in EE/CS 2-170 for practical ‘lab’ experience with the algorithms under discussion.

 

       Course Outline:

 

1)  Some basic tools:

a.    Starting basics: differences between numerical and analytic arithmetic;

        controlling and living with numerical errors

b.   Finite Differences

c.    Interpolation

d.   Differentiation

e.    Roots of Equations

f.     Integration

g.   Linear Algebra

a.    Discrete Fourier Transforms (FORTRAN: cfft1.f); (C++: cfft.cpp) (DS9)

2)  Random Processes & Monte Carlo Simulations

3)  Ordinary Differential Equations

4)  Partial Differential Equations

                                                                                            

 

Official Text: “Computational Physics, An Introduction”, Second Edition by Franz Vesely (Kluwer)

Highly recommended reference: “Numerical Recipes, The Art of Scientific Computing”, by Press, Teukolsky, Vetterling & Flannery (Cambridge)

                                                                                            

Basis for course grade:

*quasi-weekly homework assignments, including one multi-week project (in total 50% of course      grade) (current assignment) (previous assignment)

*weekly lab participation (10%) (current lab exercise)

*take-home midterm exam (15%) (data file for problem 3)

*take-home final exam (25%)

 

Late homework policy: Homeworks will be accepted one class date after they are officially due with no penalty; however, they will not be accepted at all after that. Generally, the due date will be a Tuesday to coincide with the lab session.

 

 

General information

 

Important policies on homeworks and exams (be sure to read):

 

*Students may use computers of their own choosing (information about IT computer labs is listed below), provided they have the necessary compilers and suitable graphical software installed.

*Routines must be programmed by the student in one of the languages listed above (C, C++, FORTRAN). General math packages such as Matlab can be used for verification purposes only. Source codes must be written by the students; routines may not be copied from Numerical Recipes, for example. That defeats the purpose of the course.

*Submitted problem solutions should include a simple flow chart or equivalent logical outline to indicate intended programming logic, a copy of the source code written and any requested application results.

*Students are encouraged to collaborate on the homeworks; however, the solutions must be individually prepared and submitted.

*Students must work independently on take-home exams; signed statements verifying independent effort will be required.

 

Getting an account on the IT lab computers:

 

All students will need to open IT computer accounts for use during the Tuesday labs (and any other time they wish). As a registered student you are automatically eligible. Please initialize your account before the second week of classes. Information on opening an account can be found at http://www.itlabs.umn.edu/acctInfo/ . General IT computer lab information can be found at http://www.itlabs.umn.edu/labs/ . The labs are usually open M-F 9:00-18:00 and 12:00-18:00 on weekends.

 

While some IT labs include machines with Windows OS, we will use Linux in the lab for this course. These Linux machines offer f77, cc, c++ compilers, as well as the gnuplot, Supermongo (see below) and Techplot graphics packages. Any suitable graphics package may be used, so long as the plots/images are clean and well-enough labeled for evaluation.

 

Information on obtaining the DS9 two dimensional visualization and analysis tool can be found here.

 

If you are running Windows, but want to emulate the Linux environment, including X-windows you may want to try the freeware offered at Cygwin. Specifically to enable X-window importing there is Cygwin/X.

 

Getting started with Supermongo

 

The graphics package ‘Supermongo’, installed on the itlabs machines, is a powerful, but simple tool for making plots, contour diagrams and surface plots. It includes a number of built-in math operations that make for flexible plotting and analysis. For repetitive or complex plots, ‘sm’ allows the use of macrofile inputs. The full sm manual (228 pages) and a shorter tutorial are posted here in pdf format.

 

Note that to run ‘sm’ on the Linux machines in cs-2170 you must first run ‘module load soft/sm’. When you initialize ‘sm’ an X11 graphics window should open. You will continue to type sm commands inside the original text window you were using. To create an encapsulated postscript file of your plots you need to use the ‘device’ or ‘dev’ command in sm. Typing ‘dev postencap plotfile.eps’, for example, will open a file ‘plotfile.eps’. You would then enter whatever sequence of commands needed to generate your plot, just as you would in the X11 window, followed by ‘hardcopy’ to save the plotfile. To return to an X11 graphics window type ‘dev x11’.

 

As a warmup execise try making a simple plot using the data file here. Let the first column be the abscissa and the second column be the ordinate. As an aid you may try using the file here as an ‘input’ macro. You can execute this macro command file by typing ‘input test.mn’, where ‘test.mn’ is the name of the command file to be implemented.