[SciPy-dev] Numerical stability of special functions (here: chebyu)

Gary Ruben gruben at bigpond.net.au
Mon Apr 24 06:38:58 CDT 2006


Hi Norbert,
No comment in answer to your question, but you can avoid the 'new' 
variable by changing the loop to

     for n in range(N):
        current, previous = 2*x*current - previous, current

Gary R.

Norbert Nemec wrote:
> def chebyu(N,x):
>     previous = 0.0
>     current = 1.0
>     for n in range(N):
>        new = 2*x*current - previous
>        previous = current
>        current = new
>     return current




More information about the Scipy-dev mailing list