Re: SphericalHarmonics strange behavior
- To: mathgroup at smc.vnet.net
- Subject: [mg100982] Re: SphericalHarmonics strange behavior
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 19 Jun 2009 20:45:45 -0400 (EDT)
- Organization: Uni Leipzig
- References: <h1en59$i5n$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, there is *no* sign error. Mathematica don't know that your polar angle can only take values 0<=th1<=Pi and diffY[1, 1, th1, ph1] // FullSimplify[#, 0 <= th1 <= Pi] & work as expected. Regards Jens lbloy at seas.upenn.edu wrote: > Hi all, > > working with some spherical harmonics and have some questions about the code as implemented in mathematica. > > based on http://mathworld.wolfram.com/SphericalHarmonic.html > > I put together the following code to see what is implemented > > th1 = 1.324; > ph1 = 5.231; > > diffY[l_, m_, t_, p_] := > Module[{val1, val2}, val1 = SphericalHarmonicY[l, m, t, p]; > val2 = > Sqrt[((2*l + 1)*(l - m)!)/((4*Pi)*(l + m)!)]* > LegendreP[l, m, Cos[t]]*E^(I*m*p); > Print[{val1, val2, Abs[val1 - val2]}]; > Return[Abs[val1 - val2]]; ]; > > diffY[1, 1, th1, ph1] > > diffY[1, -1, th1, ph1] > > Clearly there is some sign error somewhere I was wondering if anyone had any suggestions. > > thanks > Luke >