Introduction
This is a bunch of old C programs based on the good ol' Numerical Recipes (http://www.nr.com).
There are three computational physics problems proposed:
- Folder
breitwigner
: Solving the Breit-Wigner formula, actually a Nuclear Physics problem. - Folder
pbdiagrams
: Pressure-Volume (PV) diagrams and the *van der Waals* equation. - Folder
gibbs
: Vapor-liquid equilibrium and calculation of the excess Gibbs potential.
You can find the code at GitHub, BitBucket, and GitLab.
The Numerical Recipes libraries used for this calculations are stored in the folder nr
, but you can also install them in your system and load them normally, if you prefer. Check the NR documentation to learn more about it.
The libraries in the nr
folder used for these computational physics problems are NOT included due to license restrictions. The snippets might not work without them.
Vectors' components start in 1 and not in 0. Example:
for (i=1; i<=N; i++) {
printf("Enter initial value of parameter %d: ", i);
scanf("%lf", &a[i]);
}
Compiling and running
Compile
C programs:
$ gcc filename.c -o filename -lm
C++ programs:
$ g++ filename.cpp -o filename
Run
$ ./filename