Numerical Recipes in C/Fortran/Pascal/C++/ALGOL-68/whatever is a very useful book for scientists who have to crunch numbers, but can't spend a vast amount of time sorting through the applied math literature. In other words, practically everybody in the non-wet sciences these days (and some of the wet scientists). If you are, say, an astronomer reading this and thinking, "Hey, I never need to write programs or read Numerical Recipes," it probably means you've hired a postdoc or a grad student to do it for you. |
There are applied math websites out there dedicated to pointing out that NR does not always provide the best or most current routines for a problem. That's not my complaint - big whoop. Its routines are generally quite adequate for use as tools, and the book is very useful as pedagogy, i.e. even a dumb astronomer like me can read it and learn without being a numerical analysis expert. |
The real problem is the Numerical Recipes license, which is extremely restrictive - probably more so than most users realize. I won't dignify it with a link, but you can find licensing terms on their website. NR routines are copyrighted (fine) and cannot be redistributed as source (annoying but not uncommon for COMMERCIAL software, somewhat unusual for scientific software). There is no exception for noncommercial or scientific use, which is Grinchy and irritating, especially given that two of the authors acknowledge funding from the NSF for work on numerical methods. Beyond that, the single-CPU/single-screen terms of their license are almost impossible for a working scientist to comply with, especially in a networked environment. |
Suppose you have a single legitimate NR license, after having bought it beyond the cost of the book. You are allowed to compile programs on one computer. You may have other people run the binary on other screens. You may redistribute the binary (as long as it is impossible to rextract the NR library routines). You can redistribute your source, without the NR routine, so that someone with a legit NR license can recompile it against their library. (God help you if you have a Fortran license and they have a C license.) Practically everything else is illegal. |
You can't compile programs on both your desktop and your laptop - even if you just want to program at home and make sure the code compiles correctly, not to run it on the laptop. You can't have your grad student work on the code, unless he or she logs into your computer to compile it. Actually, if I interpret the NR single-screen license correctly, if your grad student "uses" the software in any manner other than running a binary, you have a problem - even logging in remotely, compiling the software on the licensed computer, and viewing the output of the compilation on a distinct physical screen violates the single-screen license. The same goes if you log in from your home computer screen to compile the code on your workstation. You can't, of course, test-compile code on two different machines - what do you do if you want to make sure your code compiles correctly under both Solaris and Linux? Buy more licenses, apparently. |
You can't redistribute the source, which is not so unusual for proprietary software. But these are implementations of public algorithms. If you modify an NR routine so that it works better, you won't be able to give it away since it's a derivative work, and your program will no longer compile against your collaborator's vanilla NR library. You're screwed. I guess you could call up your collaborator and describe the modifications over the phone. Or send them a diff of the subroutine and hope they patch it correctly - one hopes that a a patch file does not count as a derivative work, although of necessity it does contain elements of the original code. |
These conditions are so restrictive that of course everybody breaks them, often without knowing it. Thus, the NR license makes itself a farce. I assume that corporations with big compliance departments get more anally restrictive about these things, but if the NR authors wish to extract licensing fees from corporations, they could do it while offering a more liberal non-profit licensing policy. Hell, it is good business - why do you think MS and Apple give huge educational discounts? Like any good crack dealer, they want to get the users hooked early. |
The NR license makes RSI, the makers of IDL, my previous licensing bugaboo, look innocent by comparison. At least RSI will sell an N-user site license, so that for example only 5 people at most can run IDL simultaneously in a 50-computer department, but you don't have to buy 50 licenses. |
All of this would be pretty much standard if we were talking about Microsoft. But, there's a reason many scientists don't use Microsoft's OS. More importantly, these restrictive licensing conditions run counter to a tradition in the community of freely sharing software. Free sharing of data after publication is a requirement in science (read the Astrophysical Journal policy if you don't believe me). Algorithms and code are not data, but the tradition of sharing them helps the sciences to develop. The net effect of the NR license on science is to discourage people from helping others by sharing their work. I personally have a body of useful code that I want to distribute, but haven't devoted the time to extracting it from the death grip of the NR license, because in a publish-or-perish world, I can't justify spending the time when I could be writing a paper instead. When this situation also bit a grad student I know, I got frustrated and wrote this page. |
The NR authors, of course, benefited from many years of work by various numerical methods and applied math researchers. They re-implemented the code (or claim to have) so that they own the copyrights; I am not minimizing the amount of work needed to make the NR compilation, but I wonder if every single NR routine would really stand up as a non-derivative work on a close reading. Once you've used an NR routine, you may have to tie yourself in knots to reimplement it without being derivative. Can you copyright the coefficients of an error-function routine? |
There are alternatives. There are well known scientific libraries (LAPACK, LINPACK, etc). You can use the GNU Scientific Library: http://www.gnu.org/software/gsl/ which is free of encumbrances and clearly written at least partly in response to the NR license. Unfortunately for cavepeople like me who sometimes program in Fortran while not hunting woolly mammoths, the GSL is in C, but there are ways around that. Thanks to the NR authors for encouraging this duplication of effort. |
Numerical Recipes is a good book for learning about numerical methods. As a subroutine library, it's a useful trap. In the meantime, I'm a hypocrite. I've still got code that uses NR and haven't reimplemented it all yet. That's for people with tenure. Or NSF grants. Like the authors of Numerical Recipes. |
Benjamin Weiner
bjw at astro.umd.edu
|