ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 13 Feb 2020 18:07:59 +0100gen_lengendre_p bughttps://ask.sagemath.org/question/49891/gen_lengendre_p-bug/Hi, wonder if someone here familiar with associated Legendre function can verify:
<pre>
sage: gen_legendre_P(2, 2, x)
3*x^2 - 3
</pre>
I think it should be
<pre>
3 - 3*x^2
</pre>
In Sage 8.9
ThanksWed, 12 Feb 2020 18:40:28 +0100https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/Answer by bso for <p>Hi, wonder if someone here familiar with associated Legendre function can verify:</p>
<pre>sage: gen_legendre_P(2, 2, x)
3*x^2 - 3
</pre>
<p>I think it should be</p>
<pre>3 - 3*x^2
</pre>
<p>In Sage 8.9</p>
<p>Thanks</p>
https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?answer=49895#post-id-49895Thanks, 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:
<pre>
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
</pre>Thu, 13 Feb 2020 02:38:42 +0100https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?answer=49895#post-id-49895Comment by eric_g for <p>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).</p>
<p>Correct definition:</p>
<pre>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
</pre>
https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?comment=49908#post-id-49908Thanks for signing up! The standard starting point for Sage development is the [Developer's guide](https://doc.sagemath.org/html/en/developer/). You may find some summary [here](https://sagemanifolds.obspm.fr/contrib.html) (it's focused on manifolds, but most of the content is valid for any project).Thu, 13 Feb 2020 15:46:28 +0100https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?comment=49908#post-id-49908Comment by bso for <p>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).</p>
<p>Correct definition:</p>
<pre>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
</pre>
https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?comment=49910#post-id-49910Like. Thanks.Thu, 13 Feb 2020 18:07:59 +0100https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?comment=49910#post-id-49910Answer by eric_g for <p>Hi, wonder if someone here familiar with associated Legendre function can verify:</p>
<pre>sage: gen_legendre_P(2, 2, x)
3*x^2 - 3
</pre>
<p>I think it should be</p>
<pre>3 - 3*x^2
</pre>
<p>In Sage 8.9</p>
<p>Thanks</p>
https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?answer=49893#post-id-49893You 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 + 3Wed, 12 Feb 2020 21:19:00 +0100https://ask.sagemath.org/question/49891/gen_lengendre_p-bug/?answer=49893#post-id-49893