rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

spherical_harmonic: Bad argument to genfact #3378

Closed rtoy closed 2 months ago

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 23:34:16 Created by reimarfinken on 2008-12-05 17:49:55 Original: https://sourceforge.net/p/maxima/bugs/1538


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)

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 23:34:17 Created by reimarfinken on 2008-12-05 17:49:55 Original: https://sourceforge.net/p/maxima/bugs/1538/#7bac


patch to share/orthopoly/orthopoly.lisp

Attachments:

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 23:34:20 Created by willisbl on 2008-12-06 12:26:03 Original: https://sourceforge.net/p/maxima/bugs/1538/#3d1d


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.

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 23:34:24 Created by willisbl on 2008-12-06 12:26:22 Original: https://sourceforge.net/p/maxima/bugs/1538/#935b