Buying algorithms

I'd like to ask a general question of the experts on this forum. When do you think it is a good idea to buy code from a service, and when to program it yourself? A number of libraries offer code for algorithms of complex mathematical functions, and the programs are thoroughly checked for accuracy. If you had to make a choice, when would you go with a library? Thanks in advance
For example, the Numerical Algorithm Group (www.nag.com) offers unlimited downloads of many mathematical codes for a set price of $3000 per year, as well as customer support for the implementation. Do you think that is a wise choice for complex programming tasks?
That's one week salary for someone capable of writing such a library.
Is $156k a year standard salary for 5+ years of experience in the software field? If so, I'd like to know where you work.
Yes, if you're talking about C++. Manhattan.
@Cubbi: I thought that your answer would focus more on this:
...for someone capable of writing such a library.

What percentage of C++ programmers with 5+ years of experience also have the needed Phd in applied mathematics?
Quite a few around here, but my real point was that it's a lot more expensive to develop your own production-ready library than to buy one. It only makes sense when you have something to justify the cost and the risks involved.
Topic archived. No new replies allowed.