# How to write Spin weighted spherical Harmonics in Mathematica?

I want to do some calculations which involve spin-weighted spherical harmonics of spin weight -2. How can I write that in Mathematica? Is there any built-in symbol for that?

• Commented Feb 23, 2022 at 10:26
• Yes. I have seen it. But it doesn't show how to write it in Mathematica. I do not want to plot anything. I want to do analytical calculations, integrations that involve spin-weighted spherical harmonics of spin weight -2.
– apk
Commented Feb 23, 2022 at 11:27
• @apk Then please include what you've tried so far and what calculations you would like to carry out. Commented Feb 23, 2022 at 11:34

You can download the source of the demonstrations project Daniel mentioned his comment, which contains the definition you are looking for

Y[s_, l_, m_, th_, ph_] := (-1)^m*Simplify[
Sqrt[((l + m)!*(l - m)!*(2*l + 1))/((l + s)!*(l - s)!*4*Pi)]*
Sin[th/2]^(2*l)*Sum[
Binomial[l - s, r]*Binomial[l + s, r + s - m]*
(-1)^(l - r - s)*E^(I*m*ph)*Cot[th/2]^(2*r + s - m),
{r, 0, l - s}],
Assumptions -> {Element[ph, Reals], Element[th, Reals]}
];


This is a direct implementation of the formula found on Wikipedia (which itself is taken from eq. (3.1) of this paper, with a different normalization).

• Thanks. And for its conjugate, i.e. for Y bar (l,m,s), I will just replace I with -I in the above formula i.e the only change will be the term E^(-I m phi) in the above formula instead of E^(I m phi). Right?
– apk
Commented Feb 24, 2022 at 6:53
• I'm not sure if the relation Y bar (l,m,s) = Y(-l,m,s) holds, but you are better up applying a UpSet such as Conjugate@Y[s_, l_, m_, \[Theta]_, \[Phi]_] ^= Y[s, l, m, \[Theta], -\[Phi]]. You can also use the SpinWeightedSpherodialHarmonics package from bhptoolkit.org/users.html Commented Sep 21, 2023 at 13:46