-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lpmn wrong results for |z| > 1 (Trac #1877) #2396
Comments
@pv wrote on 2013-03-26 Doesn't affect |
Not a blocker it looks like to me. |
I do not think that there really is a problem. At least from checking the above example with n=2, m=1 I find agreement with the representation of the associated Legendre function of the second kind P in terms of the hypergeometric function given in http://dlmf.nist.gov/14.3#E8. There is actually another issue with the Legendre functions. Instead of returning infinity for appropriate arguments, they return 10**300 as generated by the Fortran code. These special cases should probably be handled correctly by the Python code. Otherwise relations like http://dlmf.nist.gov/14.2#E5 and http://dlmf.nist.gov/14.2#E11 will yield incorrect results for arguments very close to 1. |
The reason why the function definition switches at z=1 indeed seems to be the desire to get real-valued results on the real axis. Fixing just the documentation to state this is probably good enough. I'm not so sure that this is good behavior for the complex-valued function, however, as it messes up analytic properties by introducing a discontinuity essentially arbitrarily at |z|=1. |
I agree, there is an issue with |
Fixed in 44e7c61 |
The |
In my opinion It should be noted however, that the change from In [1]: from mpmath import legenp In [2]: legenp(1, 1, 0.5, type=2) In [3]: legenp(1, 1, 0.5, type=3) In [4]: legenp(1, 1, 1.5, type=2) In [5]: legenp(1, 1, 1.5, type=3) Could it be that this unexpected behavior in the interval (-1, 1) leads to failing of tests? A side remark: According to http://dlmf.nist.gov/14.21, the cut is not restricted to [-1, 1] but actually is given by (-inf, 1]. If I should submit a PR as proposed above, I could adapt the documentation of |
Just in case it might be useful to somebody: An apparent problem with negative |
The PR fixing lpmn: gh-2808 About the cut: numerically I don't see it at |
According to DLMF, the connection between positive and negative As the discussion goes on, I am coming more and more to the conclusion that the idea of I am not completely sure why the cut in DLMF includes the complete negative real axis. May be it is due to the fact that |
This was addressed in the PRs. |
Original ticket http://projects.scipy.org/scipy/ticket/1877 on 2013-03-26 by @pv, assigned to @pv.
The
lpmn
function appears to produce wrong factors of -1 and i for |z| > 1:The text was updated successfully, but these errors were encountered: