In Mathematica's documentation, the Spherical Harmonics are said to be defined as follows, for $l \geq 0$:

enter image description here

Furthermore, we know that $\cos(x)=\cos(-x)$, hence one can be led to believe that $Y_l^m(-\theta,\phi)=Y_l^m(\theta,\phi)$.

A quick check with mathematica shows us that might not be the case

Table[Table[{SphericalHarmonicY[l, m, -(\[Pi]/2), 0], 
   SphericalHarmonicY[l, m, \[Pi]/2, 0]}, {m, -l, l}], {l, 0, 2}]

enter image description here

as the $l=1=m$ values differ.

Am I doing something wrong? Does the value of $\theta$ need to be in the canonical range $[0,\pi]$. If so, how do I relate $-\frac{\pi}{2}$ to something in that range. The formulae I know allow me to relate it to $\frac{3\pi}{2}$, which is still outside the range.

  • $\begingroup$ Indeed, something weird is going on: Simplify[Table[SphericalHarmonicY[l, m, th, ph] == Sqrt[(2 l + 1)/(4 Pi)] (Sqrt[Gamma[l - m + 1]]/Sqrt[Gamma[l + m + 1]]) Exp[I ph m] LegendreP[l, m, 2, Cos[th]], {l, 0, 2}, {m, -l, l}], 0 <= th <= Pi && 0 <= ph <= 2 Pi] $\endgroup$
    – J. M.'s torpor
    Jan 6 at 18:51
  • $\begingroup$ @J.M. That remaining equation is an identity under the conditions you specified though, isn't it? At least, the lhs does evaluate to $0$ for all positive values of th. That's more a failure of plain Simplify than of the definitions. Indeed, if you change to FullSimplify, and add ComplexExpand as a TransformationFunction (which should be ok, since variables are real), then all results are True. Or am I missing something else? $\endgroup$
    – MarcoB
    Jan 6 at 20:07
  • $\begingroup$ @J.M. What is this fourth argument in LegendreP ? The documentation allows only 3. And why the extra phase factor? Are the Gamma functions doing something under the hood, as for integer arguments, they are equvalent to factorials. $\endgroup$ Jan 6 at 21:28
  • $\begingroup$ @Thunder, the extra argument in LegendreP[] modifies the branch cut convention of the Legendre function used. Please have a look at the docs for more details, but in brief, the discrepancy apparently happens since we are using "type 2" Legendre functions. $\endgroup$
    – J. M.'s torpor
    Jan 8 at 4:43
  • $\begingroup$ @Marco, ah you are right! Things work out when I change one of the conditions to 0 < th <= Pi. $\endgroup$
    – J. M.'s torpor
    Jan 8 at 4:48

The definition with Cos[phi]is a bit misleading. Consider e.g.

SphericalHarmonicY [1,1,phi,theta] == ... LegendreP[1,1,Cos[phi]] ..

Now the associated Legendre Polynomial LegendreP[1,1,x]is defined by:

LegendreP[1, 1, x] == -Sqrt[1 - x^2]


LegendreP[1,1,Cos[phi]] ==  -Sqrt[1 - Cos[phi]^2] ==  -Sqrt[Sin[phi]^2] == -Sin[phi]

Therefore, we get for the full blown function:

SphericalHarmonicY [1,1,[phi],theta] == [![enter image description here][1]][1]

  • $\begingroup$ Ok, you are making a choice of sign for the square root, which is ok if you are on $0\leq \theta\leq \pi$. And I guess the definition in terms of Associated Legendre Polynomials is probably only defined on the standard range of coordinates on $S^2$. How do I then transform my $-\frac{\pi}{2}$ Spherical harmonic to one in that range? $\endgroup$ Jan 7 at 12:14
  • $\begingroup$ What do you think about taking the absolute value of -Pi/2 and add Pi tp ϕ? $\endgroup$ Jan 7 at 12:48
  • $\begingroup$ I guess that should work. Does it work for any values of $\theta$ and $\phi$? $\endgroup$ Jan 7 at 13:14
  • $\begingroup$ You would have to ask Wolfram for this. $\endgroup$ Jan 7 at 13:19
  • 1
    $\begingroup$ @Thunder, as you might have already noticed, if you use the explicit definition of the spherical harmonics that uses "type-2" Legendre functions, for l = m = 1, there is a dangling factor of $\frac{\cos \theta-1}{\sqrt{1-\cos\theta}}$. The result you were expecting would be valid if the "type 1" Legendre function, LegendreP[l, m, 1, Cos[th]], had been used instead. $\endgroup$
    – J. M.'s torpor
    Jan 8 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.