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

Gary Ruben gruben at bigpond.net.au
Mon Apr 24 07:38:58 EDT 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