Skip to content
A bunch of old C programs that use the Numerical Recipes to solve three thermodynamics problems. Learn more at
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Computational Physics

Numerical recipes applied to thermodynamics

This is a bunch of old C programs based on the good ol' Numerical Recipes Vectors' components start in 1 and not in 0 as we are used to.


	for (i=1; i<=N; i++) {
		printf("Enter initial value of parameter %d: ", i);
		scanf("%lf", &a[i]);

Folder structure

There are three computational physics problems proposed:

  • Folder breitwigner: Solving the Breit-Wigner formula, actually a Nuclear Physics problem.
  • Folder pvdiagrams: Pressure-Volume (PV) diagrams and the van der Waals equation.
  • Folder gibbs: Vapor-liquid equilibrium and calculation of the excess Gibbs potential.

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.

Compiling and running

The -lm is needed to link the math libraries.


$ gcc filename.c -o filename -lm


$ ./filename

Dedicated site

Learn more at


License All code is GNU licensed.

License Numerical Recipes libraries are licensed according to these terms.

You can’t perform that action at this time.