Menu

#1538 spherical_harmonic: Bad argument to genfact

closed
nobody
5
2012-12-04
2008-12-05
No

Calling spherical_harmonic(l,m,theta,phi) from orthopoly does not work for m != 0:

load(orthopoly);
(%o2) /tmp/local-finken/maxima/5.16post/share/orthopoly/orthopoly.lisp
(%i3) spherical_harmonic(2,2,theta,phi);

Bad argument to `genfact'
-- an error. Entering the Maxima Debugger dbm
Enter `:h' for help

The problem is that `%genfact' is called with arguments (2m-1), (m+1/2), 2 in `assoc-leg-cos'. According to the definition of genfact, this is a product, where the last factor vanishes. I don't know the exact relation between ultraspherical polynomials and the associated legendre functions, but replacing the (m+1/2) with (m-1/2) in the call successfully reproduces the spherical harmonics up to l=2 from Mathematica (modulo the (-1)^m phase). In addition, the tests from test_orthopoly.mac now pass. The patch to orthopoly.lisp is attached.

For the record:
(%i8) build_info();

Maxima version: 5.16post
Maxima build date: 14:30 12/5/2008
host type: i686-suse-linux-gnu
lisp-implementation-type: CMU Common Lisp
lisp-implementation-version: Snapshot 2008-11 (19E)

Discussion

  • Reimar Finken

    Reimar Finken - 2008-12-05

    patch to share/orthopoly/orthopoly.lisp

     
  • Barton Willis

    Barton Willis - 2008-12-06

    Thanks for the bug report and the fix; the bug should be fixed in orthopoly.lisp CVS revsion 1.12.
    The bug was caused by recent changes to %genfact. Thanks for the help.

     
  • Barton Willis

    Barton Willis - 2008-12-06
    • status: open --> closed
     

Log in to post a comment.