Sign issue in special values of Legendre Polynomials

62 views
Skip to first unread message

Dan Cross

unread,
Jun 6, 2022, 2:38:06 PM6/6/22
to sage-devel
Hi,
It seems the special values of the Legendre Polynomials evaluated at zero are hard coded to be positive, but the sign should alternate.  So, while legendre_P(0,0) correctly gives 1 and legendre_P(4,0) correctly gives 3/8, legendre_P(2,0) gives +1/2 instead of -1/2.  Evaluating legendre_P(2,x) for any x close to zero gives a value close to -1/2 as it should.  This problem is even evident on the documentation page (https://paulmasson.github.io/sagemath-docs/functions/legendre_P.html) which shows the graph of P_2 passing through -1/2 but tabulates the special value at zero as +1/2.

Thanks.

Vincent Delecroix

unread,
Jun 6, 2022, 6:21:01 PM6/6/22
to sage-devel
There is indeed a problem

sage: legendre_P(2, 0)
1/2
sage: legendre_P(2.0, 0.0)
-0.500000000000000
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/9745505a-d332-4b63-9acd-770123e0291dn%40googlegroups.com.

dmo...@deductivepress.ca

unread,
Jun 8, 2022, 3:37:02 PM6/8/22
to sage-devel
Thanks for reporting the bug. I opened trac ticket #33962 to fix it.
Reply all
Reply to author
Forward
0 new messages