Phy409 Sample Programs
The programs below are examples to help you with your own programs.
1. Test Program:
test.c
2. "Bracket and Half" Program for finding the zeros of a function:
brachalf.c
3. "lyup" Program for examining the sensitivity to initial conditions for
the logistic map:
lyup.c
4. "euler" Program for demonstrating the euler algorithm for solving
differential equations:
euler.c
5. "rkexample" Program for demonstrating the Runge-Kutta algorithm for solving
differential equations:
rkexample.c
6. The "drivenp" Program is another example of the Runge-Kutta algorithm for solving
differential equations. It solves the differential equation for a damped driven
mechanical pendulum. By varying the amplitude of the driving force the solution
exhibits the period doubling route to chaos:
drivenp.c
7. The program
rectint.c
is a sample program demonstating the rectangle rule for numerical integration.
8. The program
wavread.c
is a sample program which can be used to read a *.wav file.
9. The program
rangen.c
is a sample program that demonstrates how one can make a pseudo random number
generator to produce random numbers between zero and one.
10. The program
randgauss.c
is a sample program which demonstrates how to use the built in pseudo random number
generator and how to "throw" a random variable with a Gaussian probability
distribution.
11. The program
metropolis.c
is a sample program which demonstrates how to use the Metropolis Algorithm to
generate a random walk with a specific probabililty distribution.