Computational Physics Spring 1996

W. Christian

Homework
Building a User Interface First Program
Regression Pendulum ODE
Laplace's Equation Complex Class
Final Project Poster Session on May 7
Student Solutions to Homework

Linear

LINEAR plots two linear equations and calculates their intersection. The program does this simple job very well. Beginning Delphi students should study the interface. It is very clean, attractive and easy to use. Notice that the program starts with realistic data in the input fields. Notice that the graph scales itself in order to put the intersection near the center of the screen.
Linear.ZIP Source code. Linear.EXE (472K) Run the application.

Regress

REGRESS does a linear regression for a set of (x,y) data points. Datum are displayed in both graphical and text format. This was the first student exercise that had an about box and help available from a main menu. Would anyone like to add the ability to edit or remove a single datum?
Regress.ZIP Source code. Regress.EXE (472K) Run the application.

Pendulum

Solves the ODE for a pendulum using various numerical methods. The animations is a nice feature although some graphics cards have trouble with this drawing operation and leave stray dots on on the screen.
Pendulum.ZIP Source code. Pendulum.EXE (472K) Run the application.

Temperature

This project and the following project both solve Laplace's equation but the two student authors come up with quite different user interfaces. These programs are not fast since they use a system timer for each calculation step but they do give a good introduction into how a finite difference method works for a two dimensional problem.
Temperature.ZIP (212K) Source code. Temperature.EXE (K) (718K) Run the application.

Laplace

Similar to the Temperature program above but with a different user interface. The legend for the contour scale is a nice touch.
Laplace.ZIP (213K) Source code. Laplace.EXE (507K) Run the application.

Complex

This program tests the COMPLEX object class that was assigned for homework. Although there isn't much room for originality in this type of project, the program is easy to use, attractive, and tests all the class methods as expected.
Complex.ZIP (235K) Source code. Complex.EXE (600K) Run the application.

How to Attack the Programming Exercises.

THINK

Try and do the problem using pencil and paper using a very special case or a small amount of data. This will help you understand the algorithm and generate values that you can use to debug the program.

ORGANIZE

BUILD A SHELL

MAKE IT WORK

MAKE IT USEFUL

LEARN FROM OTHERS

THE GOLDEN RULES

  1. Do only one change at a time and make sure it works before you go on to the next change.
  2. Save your work often.
  3. Start early.