Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the past, the Numerical Recipes book was considered the gold standard reference for numerical algorithms. The earliest Fortran Edition was followed by editions in C and C++ and others, bringing it then more up-to-date. Through these, it provided reference code for the state-of-the-art algorithms of the day.

Older editions are available online for free nowadays.

Unfortunately, I think it is now mostly useful only as a historic tome. The "software engineering" practices seem to me to be outdated, and the actual content hasn't kept pace with the literature.

What similarly comprehensive yet approachable references should the modern programmer look at instead?

share|improve this question

closed as off-topic by durron597, MichaelT, Snowman, GlenH7, Dan Pichelman Jul 21 '15 at 15:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – durron597, Community, Snowman, GlenH7, Dan Pichelman
If this question can be reworded to fit the rules in the help center, please edit the question.

The algorithms themselves are very good for general purpose problem-solving. It is their implementations that might leave something to be desired. But that is OK because the code in the book is simple enough to modify to whatever your tastes are. The implementations in the chapters are fairly "self-contained" and free of cruft. Numerical recipes is still a good reference for times when you need to implement some basic numerical stuff but don't want/need a huge complex or expensive library or framework. – Angelo Nov 14 '11 at 12:52
As it stands, this question could be considered offensive, it's certainly not very constructive. I have made use of Numerical Recipes throughout my career and would highly recommend it to anyone needing a ready reference for algorithms to solve complex problems. I have never used the code directly, but I have always implemented the algorithms in my own languages using my own preferred interfaces. The problems you appear to see are superficial, and there will usually be better algorithms out there if you care to look, but even then NR is useful to point you in the right direction. – Mark Booth Nov 14 '11 at 13:10
I have to agree that the C and C++ code provided in the books proves once again that a good Fortran programmer can write good Fortran code in any language. However, these books are still a great reference. The explanations of the algorithms are very clear. The code is usable out of the box, and if it really offends your sensibilities you can always rewrite it yourself. It would still be much easier than to implement it from scratch. – Dima Nov 14 '11 at 18:28
Remember that the copyright restrictions on the code in NR are quite draconian. You are only allowed to personally key in the code for up to ten routines, and your are NOT allowed to distribute the resulting program to any other person or computer. In almost any working environment this means you are going to have to re-implement the algorithm anyway, so what would be the benefit of the authors providing a sophisticated OO or functional implementation? The service provided by the book is a clear explanation of important algorithms, not the provision of a strong math library. – Charles E. Grant Nov 14 '11 at 19:38
Who cares what the code is like? Wrap it up nicely and never look at it. – David Heffernan Nov 17 '11 at 23:06

In terms of Numerical Recipes, we need two things - the understanding of how algorithms translates into programming implementation and second, a reference implementation that books things.

There seems to be NO combination of BOOK + Reference software. However, there are some good reference softwares and some of this provides reference to papers on the basis of such an algorithms.

Here is a list of some reference (mostly open source) libraries that might help:

  1. GNU Scientific Library
  2. LAPACK it has a good book as a user manual There is also LAPACK++ and other (TNT) derived/related packages. See this for more information.
  3. Boost Linear Algebra
  4. Armadillo
  5. BLAS

Other specific things are

  1. Apophenia for statistical models
  2. Colt
  3. FFTW
  4. The R package - and a book
  5. OpenCV
  6. Intel Math kernel Library
  7. For pattern recognition

You can also check out "Data Analysis with Open Source Tools".

Here is a huge list of comparison though i haven't verified everything.

share|improve this answer

Numerical Recipes is still, IMO, a useful book. It describes the algorithms really well, including their derivation, the situations in which they're useful, and alternatives to consider when they aren't. I've been using the book for years.

One thing I have never used is their code. I always write my own implementation based on the algorithms they describe. In that respect the quality of their code doesn't matter (and it is indeed questionable: in the 2nd edition C book, they define a collection of functions and macros to make arrays unit-indexed because the authors come from a Fortran background). As an example: I once had to implement FFT in Objective-C, so I used NR in Fortran to understand what FFT did and how the code should look.

Think of NR the same way you think of Knuth: you would never paste code from that book into your project.

share|improve this answer

Personally I like it, it's about the level I can understand

The code is Fortran translated to 'C' but that's OK you can just translate it back to Fortran and then into C++ yourself! There are advantages to the Fortran or C versions in that the code is pretty much self contained, you don't have to drag in a bunch of C++ classes to do matrices, complex, etc - especially given the quality of their coding!

There is a justifiable objection to the ludicrous copyright claims by the authors and I know a number of lecturers that ban NR in their classes. Among numerical experts the books also have a reputation as "enough information to get you into trouble". But their only suggestion is generally to use their personal code or buy NAG.

A suggested collection of alternate high quality numerical libs is at

share|improve this answer
+1 for netlib suggestion – mctylr Dec 22 '11 at 20:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.