Programming Standards

Programs will be written in MATLAB, C, and Fortran. Both graphical or other output and source code should be turned in with each assignment.

Documentation of Source Code

  1. All program units (main program, subroutines, functions,...) should begin with a header describing The Fortran subroutine CG.f and the Matlab function cg.m are two examples of how a a program should look like.

  2. Sufficient comments should be provided within the body of the source code that a reader can follow the structure of the computation. Avoid redundant comments, where the code itself is just as informative. For example,
    % y = C e
    y = C.*e
    simply clutters up the code, whereas
    % Hooke's Law
    y = C.*e
    is useful.
  3. Loops should be indented for readability. Which indentation convention you use (2 spaces, 3 spaces, tab,...) doesn't matter - consistency does.

Graphics

  1. Captions should be provided which clearly identify the significance of the plots. Too much information is MUCH better than not enough.
  2. Axes should be clearly labeled, with units if relevant.
  3. Multiple lines on the same plot should be distinguished, eg. by use of different line types with the significance of each explained in the caption.