Computation for Physics and Astronomy Majors

(AST/PHY 277  --  3 Credits )

SOLAR System Class Numbers:( 87326 for AST277) (87337 for PHY277)

Class will meet in the Math SINC Site Room SL-235 (in the Sub-level of the MATH Tower)



NOTICE:  Final Exam will be held in S235 of the Math Tower from  8:00-10:30AM on Friday December 21



Time:  MWF 9:35-10:30AM Fall 2007

Instructor:Prof. F. Douglas Swesty

Course Overview

This course is designed to prepare sophomore Physics and Astronomy majors for the realities of modern scientific computing. The desktop computer running linux (or some form of Un*x operating system) has become ubiquitous in the fields of physics and astronomy for a variety of purposes: numerically solving problems that cannot be easily solved analytically, analyzing or acquiring data from experiments and observations, writing papers or reports, or presenting results on the WWW. This course will help you to attain a minimal level of scientific computing literacy that you need to function on a daily basis in this field. The course will focus on developing the skills needed carry out core tasks on modern computers running linux (or Un*x) operating systems. This course will cover the following core topics:

We will also touch briefly on the following topics:

The course will meet for 3 hours per week  MWF 9:35-10:00.  A brief outline for each lecture will be published on this web page before each lecture.

The programming assignments will be graded on the basis of accuracy, completeness, originality and programming style.

What to Expect

This course will require you to carry out numerous programming or other computing tasks on the MATHLAB linux machines located in S235 of the math tower. It is likely you will have to spend a substantial amount of time writing and debugging programs in this laboratory setting. It may be possible in some cases for you to carry out some assignments on other computers however the Instructor and Teaching Assistants for this course will not offer any formal support for such efforts. The bottom line is that you should plan to carry out your work on the MATHLAB machines or other machines specified by the instructor. The instructor may require you to turn in your assignments electronically, via web pages that you develop, or in the form of hardcopy. The course T.A. will hold office hours in the MATHLAB in order to assist you with problems that you may encounter in carrying out your assignments. Lecture outlines will be provided via the course web site.

Required Texts

FORTRAN 95/2003 for Scientists and Engineers,3rd ed., by Stephen J. Chapman, Mc Graw Hill, ISBN 978-0-07-319157-7
Absolute C++
,
3rd ed., by Walter Savitch, Addison-Wesley, ISBN 978-0-321-46893-2

Course Grading

This course will require you to carry out numerous programming or other computing tasks on the MATHLAB linux machines located in S235 of the math tower. It is likely you will have to spend a substantial amount of time writing and debugging programs in this laboratory setting. It may be possible in some cases for you to carry out some assignments on other computers however the Instructor and Teaching Assistants for this course will not offer any formal support for such efforts. The bottom line is that you should plan to carry out your work on the MATHLAB machines or other machines specified by the instructor. The instructor may require you to turn in your assignments electronically, via web pages that you develop, or in the form of hardcopy. The course T.A. will hold office hours in the MATHLAB in order to assist you with problems that you may encounter in carrying out your assignments. Lecture outlines will be provided via the course web site.

Important University Policies

If you have a physical, psychological, medical or learning disability that may impact your ability to carry out assigned course work, contact the staff in the Disabled Student Services office (DSS), 128 Educational Communications Center, 632-6748/9. DSS will review your concerns and determine with you what accommodations are necessary and DSS will advise me. All information and documentation of disability is confidential.

Stony Brook University expects students to maintain standards of personal integrity that are in harmony with the educational goals of the institution; to observe national, state, and local laws and University regulations; and to respect the rights, privileges, and property of other people. Faculty are required to report to the Office of Judicial Affairs any disruptive behavior that interrupts their ability to teach, compromises the safety of the learning environment, and/or inhibits students' ability to learn.

Each student must pursue his or her academic goals honestly and be personally accountable for all submitted work. Representing another person's work as your own is always wrong. Any suspected instance of academic dishonesty will be reported to the Academic Judiciary. For more comprehensive information on academic integrity, including categories of academic dishonesty, please refer to the academic judiciary website.

SPECIAL NOTE REGARDING PLAGIARISM AND DISHONESTY:   All instances of plagiarised work or academic dishonesty will be brought before the Academic Judiciary Committee.    All parties involved (both the copier and  the person who produced the original work) will be held  accountable  for  any instance of plagarism or dishonesty.   You are responsible for protecting the security of your programming assignments by making sure that your directories are not world readable.   If you are unsure how to secure your home directory see the instructor immediately.


Additional Course Policies

  • StudentResponsibilities. You will be expected to abide by by all University regulations, procedures, requirements, and deadlines as described in the Undergraduate Student Bulletin.
  • Attendance. As per the University policy outlined in the Undergraduate Student Bulletin, students are expected to regularly attend all classes and to participate in the classroom experienc
  • Assignment. All work on class assignments is to be carried out independently. There will be no collaborative assignments. Computer programs developed for this course should be developed exclusively by you alone. Late assignments will not be accepted.
  • Computer Use. All use of University owned computers and networks must be in accordance with the University Information Technology Policy.
  • Passwords. You are responsible for maintaining your MATHLAB computer account password. Lost or forgotten passwords will under no circumstances be accepted as an excuse for turning in homework assignments. If you loose or forget your password your password the instructor is unable to reset it for you. Your only recourse for a lost or forgotten password is to appeal for help from the MATHLAB administrator at help@mathlab.sunysb.edu
  • Classroom Behavior and Conduct. You are expected to conduct yourself in accordance with the minimal undergraduate student responsibilities described in the Undergraduate Student Bulletin including: You are expected to arrive for class promptly. Avoid behavior that is disruptive to the classroom especially the use of cell phones. Avoid web surfing during class.


About the Instructor
  The instructor for this course is  Professor F. Douglas Swesty  of the Department of Physics and Astronomy .    My research interests are in the areas of computational physics and nuclear astrophysics.   My current research projects are focused on computational physics problems that are solved on massively parallel computers.  Some examples of this work include:  the development of parallel algorithms for radiation transport, numerical models of core collapse supernovae, and numerical models of binary neutron star mergers.  Prior to joining the SUNYSB faculty as a Research Assistant Professor, I was a Research Scientist at the  National Center for Supercomputing Applications and Visiting Research Assistant Professor of Astronomy at the  University of Illinois at Urbana-Champaign.    I have been doing scientific computing on Unix systems since 1983.

  My contact information is:

   Office:  Room 463,  Earth & Space Sciences Building

   Office Hours:  MWF 10:30-11:30AM or by appt.

   Phone:  631-632-8055

   Email:  phy277@mail.astro.sunysb.edu


About the Teaching Assistant
  The Teaching Assistant for this course is  Mr. Brendan Krueger.  Mr. Krueger will hold office hours on a regular basis in both the Mathlab and this office in order to assist you with any problems that you may encounter or any questions that you may have regarding your assignments.

Contact information:

   Office:  Room A107,  Earth & Space Sciences Building

   Office Hours:  W 12:00-2:00 (Math SINC site),  F  2:00-4:00 (Math SINC site),  and by appt. 

   Phone:  631-632-4071

   Email:  bkrueger@mail.astro.sunysb.edu 


Syllabus

Students are responsible for thoroughly familiarizing themselves with the course syllabus. The syllabus for this course with a full description of can be found in PDF form here. Please note that the settings of your web browser may cause the course web page to appear incorrectly.  If you have any doubt as to the contents of the syllabus please refer to the PDF version.



Lecture Outlines and Assignments

Note:  Lecture notes will be posted immediately before each lecture
 
   
Date Subject Notes Assignments
Sept 5
Introduction and history of  computer architectures, operating systems, and programming.
  Lecture 1
Sept 7
The Un*x file system.  A brief history of FORTRAN.  "Hello World" program.
Lecture 2

Sept 10
Globbing/filname matching.  The Compiler.  Compiling & Running the "Hello World" program.
Lecture 3

Sept 12
Binary data representation, data types, FORTRAN statements, structure of FORTRAN program.
Lecture 4

Sept 17
Constants & Variables, declaration statements, assignment statements, parameters, list-directed I/O
Lecture 5
Assignment 1
Sept 19
Real arithmetic, Integer Arithmetic, Mixed-mode arithmetic, Intrinsic Functions
Lecture 6

Sept 21
Relational operators, logical operators, character variables, concatenation operator, STDIN & STDOUT
Lecture 7

Sept 24
Top-down design.  Algorithims.  Flow-charts.  Block IF constructs.  ELSE and ELSEIF clauses.
Lecture 8

Sept 26
Logging in w/ ssh.  Using scp to transfer files. File permissions.
Lecture 9

Assignment 2
Sept 28
Naming block IF constructs.  Nesting block IF constructs. IF statements. CASE constructs.
Lecture 10

Assignment 3
Oct 1
While loops.  The EXIT statement.  DO WHILE loops.  Examples of loop usage
Lecture 11

Oct 3
Iterative DO loops.  Summation using DO loops.  Nested DO loops.
Lecture 12

Oct 5
Naming DO loops.  CYCLE statement.   Numerical integration example.
Lecture 13

Oct 8
Numerical integration examples.
Lecture 14
Assignment 4
Oct10
Root finding examples.
Lecture 15

Oct 12
Plotting with Gnuplot.   Basic formatted I/O concepts.
Lecture 16
Assignment 5
Oct 15
Formated I/O.  Format descriptors.
Lecture 17

Oct 17
Basic file I/O.  OPEN and CLOSE statements.  IOSTAT= clause in READ statements.
Lecture 18

Oct 19
Introduction to Arrays
Lecture 19

Oct 22
More on Arrays
Lecture 20
Assignment 6
Oct 24
Multi-dimensional arrays.  Allocatable arrays. The RESHAPE, ALLOCATE, and DEALLOCATE statements.
Lecture 21

Oct 26
Subroutines.
Lecture 22

Oct 29
Argument association in subroutines.  Array arguments in subroutines.  Assumed size arrays.  A simple sorting algorithm.
Lecture 23

Oct 31
A simple sorting algorithm.  Separate compilation & linking.  Modules.
Lecture 24

Nov 2
Mid-term examination


Nov 5
Modules.  Module Procedures. Implicit and Explicit Interfaces.
Lecture 25
Assignment 7
Nov 7
Function subprograms.
Lecture 26

Nov 9
Extended precision real variables and expressions.  Makefiles
Lecture 27

Nov 12
Makefile Macros.   Introduction to C++
Lecture 28
Assignment 8
Nov 14
Introduction to C++ part II
Lecture 29

Nov 16
Integrating the equations of motion.  Euler's method for ODEs.
Lecture 30

Nov 19
Runge-Kutta methods for ODEs.
Lecture 31

Nov 21
C++ Relational and Boolean operators.  C++ Precedence rules.
Lecture 32

Nov 26
C++ conditional and loop structures.
Lecture 33
Assignment 9
Nov 28
C++ functions.  Pass-by-value mechanism.
Lecture 34

Nov 30
C++ argument-passing mechanism.  C++ arrays.   C++  arrays in functions.
Lecture 35

Dec 3
C++ multi-d arrays.  C++ pointers.  C++ dynamic arrays.
Lecture 36

Dec 5
A brief introduction to LaTeX.
Lecture 37

Dec 7
A bit more LaTeX.  Creating a basic web page.
Lecture 38

Dec 10
File I/O in C++.
Lecture 39
Assignment 10
Dec 12
Least-squares fitting. Lecture 40

Dec 14
Structures and Classes in C++.  Derived Types and Modules in FORTRAN 95.
Lecture 41

Dec 19
Final Exam.  8:00AM-10:30 AM 



 


Some online documents that you might find to be useful!

 
  • The MATH SINC  Site Web Pages

  •  MATH SINC Site  lists the hours the site is open. Please note that although the site may be open the Unix machines may be reserved for a class during certain hours.   You will be expected to yield the use of the machines for a class when neccessary.

  •  
  •  The Mathlab Unix Machine Site   contains valuable info about the Unix machines
  • The Unix Operating System
  • University of Utah Unix Tutorial
  • University of Surrey Unix Tutorial
  • Gnuplot Info & Tutorials
  • Gnuplot Home page
  • Gnuplot Tips (Los Alamos National Laboratory)
  • Visualizing data with Gnuplot (IBM Developer Works)

  • Editing
  • Rutgers Univ. Emacs Command Summary
  • LaTeX
  • Getting Started with LaTeX

  • Make
  • Note: The following links are provided for your convenience.  You are not required to install any compilers in order to complete the assignments in this class.   All programming work should be carried out on the Math SINC site machines.  The links below are not an endorsement for any free or commercial product.   If you attempt  to install  software on your computer you do so at your own risk.  The State University of New York does not assume any liability for the consequences resulting from your choice to install any software on your own computer.
  • G95  (g95) is a free open-source compiler under development.  It does not yet implement all aspects of F95 but it should handle anything covered in AST/PHY 277.   Binary packages that run on Linux and other operating systems are available for download.

  • gfortran -- the GNU Fortran 95 compiler, part of Gnu Compiler Collection (GCC).   This compiler is available seperately or as part of the GCC 4.0 release for linux, MS Windows, or Mac OSX.

  • The Intel F95 Compiler  (ifort)  is available under a free license for non-commercial use on Linux systems.  Please make sure to read & accept the terms of the license before utilizing this software.  You will need to answer a survey, and read & accept a license agreement before you can download this software.
  • Fortran References
  • High Performance Object Oriented Programming in Fortran 90
  • Scientific Computing
  • Milestones in Computer History
  • HTML and Web Page Design
  • A Web Page HTML Guide
  • A Web Page Color Guide
  • This page is maintained by F. Douglas Swesty

    Copyright 2002-2007, F. Douglas Swesty,  all rights reserved