Numerical Recipes applied


This is a bunch of old C programs based on the good ol' Numerical Recipes (

There are three computational physics problems proposed:

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


C programs:

$ gcc filename.c -o filename -lm

C++ programs:

$ g++ filename.cpp -o filename


$ ./filename