[SciPy-user] Legendre Polynomials
Thu Aug 23 04:58:22 CDT 2007
I am using: Python 2.4 and Scipy 5.0.1-3ubuntu2
I have run into problems trying to expand a function into
The calculated coefficients start to explode from l=33 on...
The problem is that (for some reason) the evaluation of the Legendre
Polynomials near x <= -1 starts to become wrong from l=33 on!
See for example:
Moreover the xrange of that error grows with l:
The problem occures also for the even Polynomials but interestingly again
for the negative arguments only as you can see here:
[<matplotlib.lines.Line2D instance at 0xb6053b2c>]
A first quick (but not satisfying) idea was to use the values calculated
for x>=0 and copy them (of course correcting for the minus sign if l is
-> WHY is the evaluation wrong for x close to -1?
-> Can I trust the routine at all?
As a test I tried to expand cos(x) over Legendre-Polynomials because I
know the result: Coefficient 1 should be 1 and the others as small as
It works quite fine as long as l<33!
More information about the SciPy-user