REVIEW - Numerical Recipes with Source Code CD-ROM 3rd Edition - The Art of Scientific Computing


Numerical Recipes with Source Code CD-ROM 3rd Edition

The Art of Scientific Computing


William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P. Flannery


Cambridge University Press (2007)




Paul Floyd


May 2014



Reviewed: May 2014

This is a book that I ought to have read decades ago. The thing that put me off was the very negative comments on usenet and mailing lists about the quality of the C++ example code. More on that in a bit. Perhaps stung by these remarks, there is a put-down of the weak attempts at numerical analysis often found in computer science texts.

I’ve worked in or around numerical analysis for most of my career, so about 1/3 of the material in this book was reasonably familiar to me.

The positive points are that the book offers a lot of example code and is quite compendious, so if you just want to jump in and get something working, it’s a great resource. Beware though that just buying the book doesn’t get you access to the code (unless you’re prepared to type it yourself). I bought book + CD, otherwise you have to pay extra to access the source. If you want to redistribute anything compiled with Numerical Recipes source, that is also licensed. The licensing is fairly draconian, and also something of a bone of contention, being used as another reason to avoid the book.

I have seen some of the code from the 2nd edition, and the 3rd edition is considerably better. It’s still not great, certainly not production quality code. Gone are the 1-based Fortran arrays. It is a great shame that the code integrates poorly with standard library containers – they have their own Vector and Matrix template classes which have interfaces that are incompatible with the standard library algorithms. Some of the code is just ugly. I’ll just give two examples. The Base_interp class contains two pointers to Doub which need to point to arrays with lifetimes at least as long as the Base_interp instance. For reasons that escape me, the constructor takes a pointer and reference to Vector array. One of the member pointers is initialised with the constructor formal argument, the other member pointer with &x[0] . Secondly, the Hash class has a ‘special tweak’ in order to be able to handle C-strings. This is to ‘special case’ elements of size 1 and to treat them as C-strings. I reckon that this could be done cleanly with the right template specialization. It would be interesting to compare the performance with some std::unsorted_ma p implementations.

Despite these critical remarks, the breadth of the coverage is a great strength, and for this I give quite a high rating.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.