# gen_lengendre_p bug

Hi, wonder if someone here familiar with associated Legendre function can verify:

sage: gen_legendre_P(2, 2, x)
3*x^2 - 3


I think it should be

3 - 3*x^2


In Sage 8.9

Thanks

edit retag close merge delete

Sort by ยป oldest newest most voted

Thanks, Eric_G. I am interested to help out. Is there a page with Sage volunteering process? I will sign up. I have computer science degrees but new to math (but seriously interested to learn).

Correct definition:

def legendre_function(l, m, f):
return ((-1)^m * (1 - x^2)^(m/2) * diff(legendre_P(l, x), x, m)).subs(x = f)

sage: legendre_function(2, 2, x)
-3*x^2 + 3

sage: legendre_function(2, 2, cos(x))
-3*cos(x)^2 + 3

more

Thanks for signing up! The standard starting point for Sage development is the Developer's guide. You may find some summary here (it's focused on manifolds, but most of the content is valid for any project).

( 2020-02-13 15:46:28 +0200 )edit

Like. Thanks.

( 2020-02-13 18:07:59 +0200 )edit

You are unfortunately facing a known issue, which is not solved yet:

https://trac.sagemath.org/ticket/25034

Associated Legendre functions and spherical harmonics in Sage require someone to work of them. Would you volunteer to do it?

EDIT (17 May 2021): the bug has been fixed in SageMath 9.3 (released a week ago):

sage:  gen_legendre_P(2, 2, x)
-3*x^2 + 3

more