[Numpy-discussion] Numerical Recipes (for Python)?

Virgil Stokes vs at it.uu.se
Fri Jun 4 10:04:05 EDT 2010


On 04-Jun-2010 08:09, Anne Archibald wrote:
> On 4 June 2010 00:24, Wayne Watson<sierra_mtnview at sbcglobal.net>  wrote:
>    
>> The link below leads me to http://numpy.scipy.org/, with or without the
>> whatever. IRAF is not mentioned on the home page.
>>      
> Um. I was not being specific. For a concrete example of what I mean,
> suppose you wanted to solve an ordinary differential equation. I would
> recommend you read the chapter on ODEs in Numerical Recipes in (say)
> C. This would talk about adaptive versus fixed step sizes, how to
> convert higher-order ODEs into first-order ODEs, how to formulate and
> solve boundary value problems, and so on. It would also describe in
> detail one particular adaptive integrator, a Runge-Kutta 4/5
> integrator. My recommendation would be to take that understanding of
> what integrators can and can't do and how they should be treated, and
> then use scipy.integrate.odeint or scipy.integrate.ode to solve your
> actual problem. These two packages contain careful thoroughly-tested
> implementations of adaptive integrators of the sort described in NR.
> They will correctly handle all sorts of awkward special cases, and are
> fairly hard to fool. If these are not sufficient (and I know their
> interface in scipy is not ideal) I'd recommend going to pydstool,
> which has a much more flexible interface, better performance, and more
> modern algorithms under the hood. Only in extremis would I consider
> implementing my own ODE solver: perhaps if I needed one with special
> features (a symplectic integrator, perhaps) and I couldn't find public
> well-tested code to do that.
>
> So: read Numerical Recipes, by all means, in any programming language
> you like; but use, if at all possible, existing libraries rather than
> implementing anything described in NR. Getting numerical code right is
> really hard. Let someone else do it for you. In the case of python,
> scipy itself is pretty much a library providing what's in NR.
>
> Anne
>
>
>    
>> On 6/1/2010 9:04 PM, Anne Archibald wrote:
>>      
>>> On 2 June 2010 00:33, Wayne Watson<sierra_mtnview at sbcglobal.net>  Â wrote:
>>>
>>>        
>>>> Subject is a book title from some many years ago, I wonder if it ever
>>>> got to Python? I know there were C and Fortran versions.
>>>>
>>>>          
>>> There is no Numerical Recipes for python. The main reason there isn't
>>> a NR for python is that practically everything they discuss is already
>>> implemented as python libraries, and most of it is in numpy and/or
>>> scipy. (Their algorithms are also not suitable for pure-python
>>> implementation, but that's a whole other discussion.)
>>>
>>> I should also say that while NR is justifiably famous for its
>>> explanations of numerical issues, its code is not under a free license
>>> (so you may not use it without the authors' permission) and many
>>> people feel it has many bugs. The algorithms they discuss are also not
>>> always the best available.
>>>
>>> I generally recommend that people doing scientific programming read
>>> all or part of NR to understand the algorithms' limitations but then
>>> use the implementations available in
>>> numpy/scipy/scikits/IRAF/whatever.
>>>
>>> Anne
>>>
>>>
>>>        
>>>> --
>>>> Â  Â  Â  Â  Â  Â  Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
>>>>
>>>> Â  Â  Â  Â  Â  Â  Â  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
>>>>                Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
>>>>
>>>> Â  Â  Â  Â  Â  Â  Â  Â  "Science and democracy are based on the rejection
>>>> Â  Â  Â  Â  Â  Â  Â  Â  "of dogma." Â -- Dick Taverne, The March of Unreason
>>>>
>>>>
>>>> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â Web Page:<www.speckledwithstars.net/>
>>>>
>>>> _______________________________________________
>>>> NumPy-Discussion mailing list
>>>> NumPy-Discussion at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>
>>>>
>>>>          
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>>        
>> --
>> Â  Â  Â  Â  Â  Â Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
>>
>> Â  Â  Â  Â  Â  Â  Â (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
>>               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
>>
>> Â  Â  Â  Â  Â  Â  Â  Â "Science and democracy are based on the rejection
>> Â  Â  Â  Â  Â  Â  Â  Â "of dogma." Â -- Dick Taverne, The March of Unreason
>>
>>
>> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Web Page:<www.speckledwithstars.net/>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>      
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>    
I agree with you Anne!

--V. Stokes
IT dept., Uppsala University




More information about the NumPy-Discussion mailing list