[Maxima] [PATCH] Fix assoc_legendre_p(-n,m,x): identically zero

Kris Katterjohn katterjohn at gmail.com
Wed Oct 3 21:01:34 CDT 2012

Hey everyone,

I've found a bug in assoc_legendre_p(): the results seem to always be zero
when a negative degree is given.  For example:

(%i2) assoc_legendre_p(-3,2,1/8);
(%o2)                                  0
(%i3) assoc_legendre_p(-5,3,1/7);
(%o3)                                  0
(%i4) assoc_legendre_p(-8,1,1/6);
(%o4)                                  0

I've created a simple patch to fix this (attached), and created a patch
tracker for it[1].  I think it does The Right Thing.

(%i5) load(orthopoly)$
(%i6) assoc_legendre_p(-3,2,1/8),numer;
(%o6)              interval(2.953125, 8.135094160810487E-15)
(%i7) assoc_legendre_p(-5,3,1/7),numer;
(%o7)        interval(- 14.54316713060748, 2.376273306325054E-13)
(%i8) assoc_legendre_p(-8,1,1/6),numer;
(%o8)         interval(.7000229997231038, 4.669118735062099E-14)

The comments in orthopoly.lisp refer to an equation in A&S relating positive
and negative degrees, but it wasn't actually implemented.

Let me know if there are any problems!

Kris Katterjohn


-------------- next part --------------
A non-text attachment was scrubbed...
Name: assocleg-negdeg.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20121003/ce0d7b7e/attachment.bin>

More information about the Maxima mailing list