Can you make a list of first spin-2 spherical harm...

Criado em: 31 de julho de 2025

Respondido usando O3 por Chat01

Pergunta

Can you make a list of first spin-2 spherical harmonics up to l=3? What formula did you use to construct these functions?

Python

python
import sympy as sp theta, phi = sp.symbols('theta phi', real=True) l=3 m=2 s=2 # sympy wigner d function small d maybe sp.functions.special.tensor_functions.wigner_d? dir(sp.functions.special) ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'bessel', 'beta_functions', 'bsplines', 'delta_functions', 'elliptic_integrals', 'error_functions', 'gamma_functions', 'hyper', 'mathieu_functions', 'polynomials', 'singularity_functions', 'spherical_harmonics', 'tensor_functions', 'zeta_functions']

Python

python
dir(sp.functions.special.tensor_functions) ['Eijk', 'Function', 'Integer', 'KroneckerDelta', 'LeviCivita', 'S', 'SYMPY_INTS', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'default_sort_key', 'eval_levicivita', 'fuzzy_not', 'has_dups', 'prod']

Python

python
dir(sp.functions.special.spherical_harmonics) ['Abs', 'ArgumentIndexError', 'Dummy', 'Function', 'I', 'S', 'Ynm', 'Ynm_c', 'Znm', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_x', 'assoc_legendre', 'cos', 'cot', 'exp', 'factorial', 'pi', 'sin', 'sqrt', 'sympify']

Python

python
import sympy as sp theta, phi = sp.symbols('theta phi', real=True) def Y(l,m): return sp.functions.special.spherical_harmonics.Ynm(l,m,theta,phi) # complex spherical harmonic def eth(f, s_in): sin = sp.sin(theta) return - (sin**s_in) * ( sp.diff( (sin**(-s_in)) * f, theta) + sp.I/sp.sin(theta) * sp.diff( (sin**(-s_in))*f, phi) ) def sY(l,m,s): # for s>=0 integer if s<0: raise NotImplementedError f = Y(l,m) s_in = 0 for k in range(s): f = eth(f, s_in) s_in += 1 norm = sp.sqrt(sp.factorial(l - s)/sp.factorial(l + s)) return sp.simplify(norm * f) sY22 = sp.simplify(sY(2,2,2)) sY21 = sp.simplify(sY(2,1,2)) sY20 = sp.simplify(sY(2,0,2)) sY2m1 = sp.simplify(sY(2,-1,2)) sY2m2 = sp.simplify(sY(2,-2,2)) sY22 sqrt(6)*(cos(theta) - 1)**2*Ynm(2, 2, theta, phi)/(6*sin(theta)**2)

Python

python
import sympy as sp theta, phi = sp.symbols('theta phi', real=True) def wigner_d(l,m,mp,theta): # small-d Wigner k=sp.symbols('k', integer=True) # pre-factor sqrt factorials pref = sp.sqrt(sp.factorial(l+m)*sp.factorial(l-m)*sp.factorial(l+mp)*sp.factorial(l-mp)) expr = 0 # determine k limits such that factorial args nonnegative # constraints: l+m-k>=0 => k<=l+m # k>=0 # m'-m + k >= 0 => k >= m - m' # l - m' - k >=0 => k <= l - m' kmin = max(0, m - mp) kmax = min(l+m, l - mp) for ki in range(kmin, kmax+1): term = ((-1)**(ki-m+mp) * pref / (sp.factorial(l+m-ki)*sp.factorial(ki)*sp.factorial(mp-m+ki)*sp.factorial(l-mp-ki)) * sp.cos(theta/2)**(2*l + m - mp - 2*ki) * sp.sin(theta/2)**(mp - m + 2*ki)) expr += term return sp.simplify(expr) def sY_by_wigner(l,m,s=2): d = wigner_d(l,m,-s,theta) return sp.simplify(sp.sqrt((2*l+1)/(4*sp.pi)) * d * sp.exp(sp.I*m*phi)) for L in (2,3): res = {} for m in range(-L, L+1): res[m] = sp.simplify(sp.together(sY_by_wigner(L,m,2))) print(L, res[2]) print(L, res[1]) print(L, res[0])

Python

python
from sympy import sin, cos, exp, I, pi, sqrt def simplify_half_angle(expr): # Replace sin(θ/2)^odd * cos(θ/2)^odd patterns etc expr = sp.expand(expr) # We'll rewrite powers explicitly expr = sp.together(expr) expr = sp.simplify(expr) # Replace sin(θ/2)*cos(θ/2) -> sin θ /2 expr = expr.replace(lambda x: x.is_Pow and x.base==sin(theta/2) and x.exp==1, sin(theta/2)) expr = expr.replace(lambda x: x.is_Pow and x.base==cos(theta/2) and x.exp==1, cos(theta/2)) # Use identities: sin(θ/2)^2 = (1 - cosθ)/2, cos(θ/2)^2 = (1 + cosθ)/2 expr = expr.rewrite(sp.cos) expr = sp.simplify(expr) # Replace sin(θ/2)*cos(θ/2) with sinθ/2 expr = expr.subs(sp.sin(theta/2)*sp.cos(theta/2), sp.sin(theta)/2) # Now replace even powers expr = expr.subs(sp.sin(theta/2)**2, (1-sp.cos(theta))/2) expr = expr.subs(sp.cos(theta/2)**2, (1+sp.cos(theta))/2) # Higher powers: reduce using above repeatedly expr = sp.simplify(sp.expand(expr)) return expr L=3 for m in range(-L,L+1): expr = sY_by_wigner(L,m,2) print(m, sp.simplify(sp.expand_trig(expr.rewrite(sp.cos))))

Python

python
import random import cmath import math def sY2_formula_l2(m,theta,phi): if m==2: return math.sqrt(5/(64*math.pi))* (1-math.cos(theta))**2 * cmath.exp(2j*phi) if m==1: return math.sqrt(5/(16*math.pi))* math.sin(theta)*(1-math.cos(theta)) * cmath.exp(1j*phi) if m==0: return math.sqrt(15/(32*math.pi))* (math.sin(theta)**2) if m==-1: return -math.sqrt(5/(16*math.pi))* math.sin(theta)*(1+math.cos(theta)) * cmath.exp(-1j*phi) if m==-2: return math.sqrt(5/(64*math.pi))* (1+math.cos(theta))**2 * cmath.exp(-2j*phi) raise def sY_wigner(l,m,theta,phi): # from earlier sympy result but numeric version using that function is heavy; let's just evaluate sympy expression we computed for given l,m expr = sY_by_wigner(l,m,2) f = sp.lambdify((theta,phi), expr, 'numpy') import numpy as np return complex(f(theta,phi)) theta_val = 1.1 phi_val = 0.7 for m in range(-2,3): a = sY2_formula_l2(m,theta_val,phi_val) b = sY_wigner(2,m,theta_val,phi_val) print(m, a, b, abs(a-b))

Python

python
def sY_wigner_numeric(l,m,theta_val,phi_val): expr = sY_by_wigner(l,m,2) f = sp.lambdify((theta,phi), expr, 'numpy') import numpy as np return complex(f(theta_val,phi_val)) theta_val = 1.1 phi_val = 0.7 for m in range(-2,3): a = sY2_formula_l2(m,theta_val,phi_val) b = sY_wigner_numeric(2,m,theta_val,phi_val) print(m, abs(a-b))

Python

python
def sY2_formula_l2_correct(m,theta,phi): if m==2: return math.sqrt(5/(64*math.pi))* (1-math.cos(theta))**2 * cmath.exp(2j*phi) if m==1: return math.sqrt(5/(16*math.pi))* math.sin(theta)*(1-math.cos(theta)) * cmath.exp(1j*phi) if m==0: return math.sqrt(15/(32*math.pi))* (math.sin(theta)**2) if m==-1: return math.sqrt(5/(16*math.pi))* math.sin(theta)*(1+math.cos(theta)) * cmath.exp(-1j*phi) if m==-2: return math.sqrt(5/(64*math.pi))* (1+math.cos(theta))**2 * cmath.exp(-2j*phi) for m in range(-2,3): a = sY2_formula_l2_correct(m,theta_val,phi_val) b = sY_wigner_numeric(2,m,theta_val,phi_val) print(m, abs(a-b))

Python

python
def sY2_formula_l3(m,theta,phi): if m==3: return math.sqrt(42)/(16*math.sqrt(math.pi)) * math.sin(theta) * (1-math.cos(theta))**2 * cmath.exp(3j*phi) if m==2: return math.sqrt(7)/(8*math.sqrt(math.pi)) * (3*math.cos(theta)+2) * (1-math.cos(theta))**2 * cmath.exp(2j*phi) if m==1: return math.sqrt(70)/(16*math.sqrt(math.pi)) * (3*math.cos(theta)+1) * math.sin(theta) * (1-math.cos(theta)) * cmath.exp(1j*phi) if m==0: return math.sqrt(210)/(8*math.sqrt(math.pi))* (math.sin(theta)**2) * math.cos(theta) if m==-1: return math.sqrt(70)/(16*math.sqrt(math.pi)) * (3*math.cos(theta)-1) * math.sin(theta) * (1+math.cos(theta)) * cmath.exp(-1j*phi) if m==-2: return math.sqrt(7)/(8*math.sqrt(math.pi)) * (3*math.cos(theta)-2) * (1+math.cos(theta))**2 * cmath.exp(-2j*phi) if m==-3: return - math.sqrt(42)/(16*math.sqrt(math.pi)) * math.sin(theta) * (1+math.cos(theta))**2 * cmath.exp(-3j*phi) for m in range(-3,4): a = sY2_formula_l3(m,theta_val,phi_val) b = sY_wigner_numeric(3,m,theta_val,phi_val) print(m, abs(a-b))

Pensamento

Formulas validated

Great! The formulas are now validated using the Wigner d approach. We can now present the normalized forms for l=2l = 2 and l=3l = 3, specifically for s=2s = 2.

For both cases, I’ll list the formulas as specified. I’ll also note the formula definition and state the normalization convention. In addition, I’ll clarify the use of the Condon-Shortley phase, domain conventions, and the symmetry relationships to avoid confusion. All constants and signs from the earlier derivation will be included.

Thought for 2m 59s

Resposta

Below are the (spin-weight s = 2) spherical harmonics for the first allowed multipoles, ℓ = 2 and ℓ = 3. I use the standard Condon–Shortley phase and the usual normalization

sYm(θ,ϕ)sYm(θ,ϕ)dΩ=δδmm.\int {}_sY_{\ell m}(\theta,\phi)\,{}_sY^{*}_{\ell' m'}(\theta,\phi)\,d\Omega = \delta_{\ell\ell'}\delta_{mm'}.

Angles satisfy θ[0,π], ϕ[0,2π)\theta\in[0,\pi],\ \phi\in[0,2\pi).


Explicit functions

ℓ = 2

2Y2,2=564π(1cosθ)2e2iϕ,2Y2,1=516πsinθ(1cosθ)eiϕ,2Y2,0=1532πsin2θ,2Y2,1=516πsinθ(1+cosθ)eiϕ,2Y2,2=564π(1+cosθ)2e2iϕ.\begin{aligned} {}_2Y_{2,2} &= \sqrt{\frac{5}{64\pi}}\,(1-\cos\theta)^2\,e^{2i\phi},\\[2pt] {}_2Y_{2,1} &= \sqrt{\frac{5}{16\pi}}\,\sin\theta\,(1-\cos\theta)\,e^{i\phi},\\[2pt] {}_2Y_{2,0} &= \sqrt{\frac{15}{32\pi}}\,\sin^2\theta,\\[2pt] {}_2Y_{2,-1}&= \sqrt{\frac{5}{16\pi}}\,\sin\theta\,(1+\cos\theta)\,e^{-i\phi},\\[2pt] {}_2Y_{2,-2}&= \sqrt{\frac{5}{64\pi}}\,(1+\cos\theta)^2\,e^{-2i\phi}. \end{aligned}

ℓ = 3

2Y3,3=4216πsinθ(1cosθ)2e3iϕ,2Y3,2=78π(3cosθ+2)(1cosθ)2e2iϕ,2Y3,1=7016π(3cosθ+1)sinθ(1cosθ)eiϕ,2Y3,0=2108πsin2θcosθ,2Y3,1=7016π(3cosθ1)sinθ(1+cosθ)eiϕ,2Y3,2=78π(3cosθ2)(1+cosθ)2e2iϕ,2Y3,3=4216πsinθ(1+cosθ)2e3iϕ.\begin{aligned} {}_2Y_{3,3} &= \frac{\sqrt{42}}{16\sqrt{\pi}}\,\sin\theta\,(1-\cos\theta)^2\,e^{3i\phi},\\[2pt] {}_2Y_{3,2} &= \frac{\sqrt{7}}{8\sqrt{\pi}}\,(3\cos\theta+2)\,(1-\cos\theta)^2\,e^{2i\phi},\\[2pt] {}_2Y_{3,1} &= \frac{\sqrt{70}}{16\sqrt{\pi}}\,(3\cos\theta+1)\,\sin\theta\,(1-\cos\theta)\,e^{i\phi},\\[2pt] {}_2Y_{3,0} &= \frac{\sqrt{210}}{8\sqrt{\pi}}\,\sin^2\theta\,\cos\theta,\\[2pt] {}_2Y_{3,-1} &= \frac{\sqrt{70}}{16\sqrt{\pi}}\,(3\cos\theta-1)\,\sin\theta\,(1+\cos\theta)\,e^{-i\phi},\\[2pt] {}_2Y_{3,-2} &= \frac{\sqrt{7}}{8\sqrt{\pi}}\,(3\cos\theta-2)\,(1+\cos\theta)^2\,e^{-2i\phi},\\[2pt] {}_2Y_{3,-3} &= -\,\frac{\sqrt{42}}{16\sqrt{\pi}}\,\sin\theta\,(1+\cos\theta)^2\,e^{-3i\phi}. \end{aligned}

(As a check, note the symmetry sY,m=(1)s+msYm {}_sY_{\ell,-m}=(-1)^{s+m}\,{}_sY_{\ell m}^{*}.)


Formula used (two equivalent constructions)

(A) Wigner-d definition

sYm(θ,ϕ)=2+14π  dm,s(θ)  eimϕ\boxed{\quad {}_sY_{\ell m}(\theta,\phi) = \sqrt{\frac{2\ell+1}{4\pi}}\; d^{\,\ell}_{m,-s}(\theta)\; e^{i m\phi}\quad}

where dmm(θ)d^{\,\ell}_{m m'}(\theta) is the (real) Wigner small-dd matrix element.
I generated the explicit forms above by evaluating dm,2(θ)d^{\,\ell}_{m,-2}(\theta) and simplifying.

(B) Spin-raising (eth) operator

ðsf=sins ⁣θ(θ+icscθϕ) ⁣[sins ⁣θsf],ðsYm=(s)(+s+1)  s+1Ym.\eth\, {}_s f = -\sin^s\!\theta\left(\partial_\theta + i\,\csc\theta\,\partial_\phi\right)\!\left[\sin^{-s}\!\theta\, {}_s f\right],\qquad \eth\, {}_sY_{\ell m} = \sqrt{(\ell-s)(\ell+s+1)}\;{}_{s+1}Y_{\ell m}.

Starting from the scalar YmY_{\ell m} and applying ð\eth twice gives

2Ym=1(+1)(1)(+2)  ððYm\boxed{\quad {}_2Y_{\ell m} = \frac{1}{\sqrt{\ell(\ell+1)(\ell-1)(\ell+2)}}\;\eth\,\eth\,Y_{\ell m}\quad}

which yields the same expressions as above.

If you’d like, I can also list the s=2s=-2 versions (often used in gravitational-wave work) or provide these in half-angle form.

Compartilhar esta Q&A