#47 Fix legendre_p(-n,x) & assoc_legendre_p(-n,m,x): all zeros

None
closed
nobody
None
5
2012-12-01
2012-10-04
No

assoc_legendre_p() is broken wrt negative degrees: it seems to be identically zero. 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

This can also be seen doing something like "plot2d(assoc_legendre_p(-3,1,x),[x,-1,1])"

In the comments of orthopoly.lisp it refers to an equation in A&S relating positive and negative degrees, but it wasn't actually implemented. I've uploaded a very simple patch to do this:

(%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)

Let me know what you think.

Thanks,
Kris Katterjohn

Discussion

  • Kris Katterjohn

    Kris Katterjohn - 2012-10-04

    Patch to fix assoc_legendre_p(-n,m,x)

     
  • Kris Katterjohn

    Kris Katterjohn - 2012-10-27

    Patch to fix legendre_p(-n,x)

     
  • Kris Katterjohn

    Kris Katterjohn - 2012-11-05
    • summary: Fix assoc_legendre_p(-n,m,x): identically zero --> Fix legendre_p(-n,x) & assoc_legendre_p(-n,m,x): all zeros
     
  • Robert Dodier

    Robert Dodier - 2012-12-01

    I've applied the patches and added test cases to test_orthopoly, and committed it all as 3823546518e5dc. Thanks for your help, Kris.

     
  • Robert Dodier

    Robert Dodier - 2012-12-01
    • status: open --> closed
    • milestone: -->
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks