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

Anne Archibald aarchiba@physics.mcgill...
Fri Jun 4 13:50:03 CDT 2010


On 4 June 2010 14:32, Wayne Watson <sierra_mtnview@sbcglobal.net> wrote:
> At one point  in my career I was very familiar, and that's an
> understatement :-), with many of these methods (NR and beyond). I have
> zero interest in implementing them.I do not need explanations of the
> theory behind them. What I need to know is where some of these methods
> exist in libraries? Optimization (linear, nonlinear), regression
> (multiple, stepwise, and others), matrix inverse, eigenvalues, Fourier
> transforms, ..., on and on    I would expect to find a site that lists
> all of them, and I can pick the ones I need. Python of course.

Read the scipy documentation.

Anne

>
> On 6/3/2010 11:09 PM, Anne Archibald wrote:
>> On 4 June 2010 00:24, Wayne Watson<sierra_mtnview@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@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@scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> NumPy-Discussion mailing list
>>>> NumPy-Discussion@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@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@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@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list