The basic imports and the variables we'll be using:


In [39]:
from __future__ import division, print_function
import sympy
from sympy import *
from sympy import Rational as frac
import simpletensors
from simpletensors import Vector, xHat, yHat, zHat
from simpletensors import TensorProduct, SymmetricTensorProduct, Tensor
init_printing()


var('vartheta, varphi')
var('nu, m, delta, c, t')

# These are related scalar functions of time
var('v, gamma, r', cls=Function)
v = v(t)
x = v**2
Omega = v**3
#gamma = v**2*(1 + (1-nu/3)*v**2 + (1-65*nu/12)*v**4) # APPROXIMATELY!!!  Change this later
#r = 1/gamma
gamma = gamma(t)
r = r(t)
r = 1/v**2 # APPROXIMATELY!!!  Just for testing.  Change this later

# These get redefined momentarily, but have to exist first
var('nHat, lambdaHat, ellHat', cls=Function)
# And now we define them as vector functions of time
nHat = Vector('nHat', r'\hat{n}', [cos(Omega*t),sin(Omega*t),0,])(t)
lambdaHat = Vector('lambdaHat', r'\hat{\lambda}', [-sin(Omega*t),cos(Omega*t),0,])(t)
ellHat = Vector('ellHat', r'\hat{\ell}', [0,0,1,])(t)

# These are the spin functions -- first, the individual components as regular sympy.Function objects; then the vectors themselves
var('S_n, S_lambda, S_ell', cls=Function)
var('Sigma_n, Sigma_lambda, Sigma_ell', cls=Function)
SigmaVec = Vector('SigmaVec', r'\vec{\Sigma}', [Sigma_n(t), Sigma_lambda(t), Sigma_ell(t)])(t)
SVec = Vector('S', r'\vec{S}', [S_n(t), S_lambda(t), S_ell(t)])(t)

Defining the spherical-harmonic tensors

Thorne (1980) gives a nice review, along with the following formula for $Y^{\ell,m}_L$. Also note the Eqs. (74) and the footnote on page 32 of Blanchet's Living Review (2013), which explains the necessary normalizations for getting the metric perturbation modes from the tensors.


In [60]:
from __future__ import division
import sympy
from sympy import *
from sympy import Rational as frac
import simpletensors
from simpletensors import Vector, xHat, yHat, zHat
from simpletensors import TensorProduct, SymmetricTensorProduct, Tensor
init_printing()

var('vartheta, varphi')

DefaultOrthogonalRightHandedBasis=[xHat(t), yHat(t), zHat(t)]

def C(ell,m):
    return (-1)**abs(m) * sympy.sqrt( frac(2*ell+1,4) * frac(factorial(ell-m), factorial(ell+m)) / sympy.pi )

def a(ell,m,j):
    return frac((-1)**j, 2**ell * factorial(j) * factorial(ell-j)) * frac(factorial(2*ell-2*j), factorial(ell-m-2*j))

def YlmTensor(ell, m, OrthogonalRightHandedBasis=DefaultOrthogonalRightHandedBasis):
    if(ell<0 or abs(m)>ell):
        raise ValueError("YlmTensor({0},{1}) is undefined.".format(ell,m))
    from sympy import prod
    xHat, yHat, zHat = OrthogonalRightHandedBasis
    if(m<0):
        mVec = Tensor(SymmetricTensorProduct(xHat), SymmetricTensorProduct(yHat,coefficient=-sympy.I))
        #mVec = VectorFactory('mBarVec', [1,-sympy.I,0])(t)
    else:
        mVec = Tensor(SymmetricTensorProduct(xHat), SymmetricTensorProduct(yHat,coefficient=sympy.I))
        #mVec = VectorFactory('mVec', [1,sympy.I,0])(t)
    def TensorPart(ell,m,j):
        return sympy.prod((mVec,)*m) * SymmetricTensorProduct(*((zHat,)*(ell-2*j-m))) \
            * sympy.prod([sum([SymmetricTensorProduct(vHat, vHat) for vHat in OrthogonalRightHandedBasis]) for i in range(j)])
    if(m<0):
        Y = sum([TensorPart(ell,-m,j) * (C(ell,-m) * a(ell,-m,j))
                 for j in range(floor(frac(ell+m,2))+1) ]) * (-1)**(-m)
    else:
        Y = sum([TensorPart(ell,m,j) * (C(ell,m) * a(ell,m,j))
                 for j in range(floor(frac(ell-m,2))+1) ])
    try:
        Y.compress()
    except AttributeError:
        pass
    return Y

def YlmTensorConjugate(ell, m, OrthogonalRightHandedBasis=DefaultOrthogonalRightHandedBasis):
    return YlmTensor(ell, -m, OrthogonalRightHandedBasis) * (-1)**abs(m)

# This is Blanchet's version of the above
def alphalmTensor(ell, m, OrthogonalRightHandedBasis=DefaultOrthogonalRightHandedBasis):
    return YlmTensor(ell, -m, OrthogonalRightHandedBasis) * ( (-1)**abs(m) * (4*pi*factorial(ell)) / factorial2(2*ell+1) )

NVec = Vector('NVec', r'\hat{N}', [sympy.sin(vartheta)*sympy.cos(varphi),
                                   sympy.sin(vartheta)*sympy.sin(varphi),
                                   sympy.cos(vartheta)])(t)

def NTensor(ell):
    return SymmetricTensorProduct(*((NVec,)*ell))

# These give the SWSH modes components from the given radiative tensors
def Ulm(U_L, m):
    ell = U_L.rank
    return (alphalmTensor(ell, m) | U_L) * (frac(4,factorial(ell))*sqrt(frac((ell+1)*(ell+2), 2*ell*(ell-1))))
def Vlm(V_L, m):
    ell = V_L.rank
    return (alphalmTensor(ell, m) | V_L) * (frac(-8,factorial(ell))*sqrt(frac(ell*(ell+2), 2*(ell+1)*(ell-1))))
def hlm(U_L, V_L, m):
    return ( -Ulm(U_L,m) + sympy.I * Vlm(V_L,m) ) / sympy.sqrt(2)

Let's take a look at those tensors:


In [3]:
for ell in range(2,5):
    print('')
    for m in range(-ell, ell+1):
        print('(ell,m) = ({0},{1}):'.format(ell,m))
        display( YlmTensor(ell,m) )


(ell,m) = (2,-2):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{30}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{30} i}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{30}}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (2,-1):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{30}}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{30} i}{4 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right\}\end{align*}$$
(ell,m) = (2,0):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{5}}{2 \sqrt{\pi}}\right)\, \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{5}}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{5}}{4 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (2,1):
$$\begin{align*}&\left\{ \left[ \left(- \frac{\sqrt{30}}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{30} i}{4 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right\}\end{align*}$$
(ell,m) = (2,2):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{30}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{30} i}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{30}}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (3,-3):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (3,-2):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{210}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{210} i}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{210}}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right\}\end{align*}$$
(ell,m) = (3,-1):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{21}}{2 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{21} i}{2 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{21}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{21}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{21} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{21} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (3,0):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{7}}{2 \sqrt{\pi}}\right)\, \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{7}}{4 \sqrt{\pi}}\right)\, \hat{z} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{7}}{4 \sqrt{\pi}}\right)\, \hat{z} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (3,1):
$$\begin{align*}&\left\{ \left[ \left(- \frac{\sqrt{21}}{2 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{21} i}{2 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{21}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{21}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{21} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{21} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (3,2):
$$\begin{align*}&\left\{ \left[ \left(\frac{\sqrt{210}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{210} i}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{\sqrt{210}}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right\}\end{align*}$$
(ell,m) = (3,3):
$$\begin{align*}&\left\{ \left[ \left(- \frac{\sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{\sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (4,-4):
$$\begin{align*}&\left\{ \left[ \left(\frac{3 \sqrt{70}}{32 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{70} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{70}}{16 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{70} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{70}}{32 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (4,-3):
$$\begin{align*}&\left\{ \left[ \left(\frac{3 \sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right\}\end{align*}$$
(ell,m) = (4,-2):
$$\begin{align*}&\left\{ \left[ \left(\frac{9 \sqrt{10}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{10} i}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{10}}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{10}}{16 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{10} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{10} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{10}}{16 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (4,-1):
$$\begin{align*}&\left\{ \left[ \left(\frac{3 \sqrt{5}}{2 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{5} i}{2 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{5}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{5}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{5} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{5} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (4,0):
$$\begin{align*}&\left\{ \left[ \left(\frac{3}{2 \sqrt{\pi}}\right)\, \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9}{2 \sqrt{\pi}}\right)\, \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9}{2 \sqrt{\pi}}\right)\, \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9}{16 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9}{16 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (4,1):
$$\begin{align*}&\left\{ \left[ \left(- \frac{3 \sqrt{5}}{2 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{5} i}{2 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{5}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{5}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{5} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{5} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (4,2):
$$\begin{align*}&\left\{ \left[ \left(\frac{9 \sqrt{10}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{10} i}{4 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{10}}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{10}}{16 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{10} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{10} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{10}}{16 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$
(ell,m) = (4,3):
$$\begin{align*}&\left\{ \left[ \left(- \frac{3 \sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{9 \sqrt{35}}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{35} i}{8 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{z} \right] \right\}\end{align*}$$
(ell,m) = (4,4):
$$\begin{align*}&\left\{ \left[ \left(\frac{3 \sqrt{70}}{32 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{70} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{9 \sqrt{70}}{16 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(- \frac{3 \sqrt{70} i}{8 \sqrt{\pi}}\right)\, \hat{x} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right. \nonumber \\&\quad \left. + \left[ \left(\frac{3 \sqrt{70}}{32 \sqrt{\pi}}\right)\, \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \otimes_{\mathrm{s}} \hat{y} \right] \right\}\end{align*}$$

In [4]:
NTensor(2)


Out[4]:
$$\left(\hat{N} \otimes_{\mathrm{s}} \hat{N}\right)$$

Spherical-harmonic functions

So now, I can just contract the $Y^{\ell,m}_L$ tensors with the $N_L$ tensors to get the usual spherical harmonics:


In [5]:
YlmTensor(0,0)


Out[5]:
$$\frac{1}{2 \sqrt{\pi}}$$

In [6]:
for ell in range(1,3):
    print('')
    for m in range(-ell, ell+1):
        print('(ell,m) = ({0},{1}):'.format(ell,m))
        display(exptrigsimp( YlmTensor(ell,m) | NTensor(ell) ))


(ell,m) = (1,-1):
$$\frac{\sqrt{6} e^{- i \varphi}}{4 \sqrt{\pi}} \sin{\left (\vartheta \right )}$$
(ell,m) = (1,0):
$$\frac{\sqrt{3}}{2 \sqrt{\pi}} \cos{\left (\vartheta \right )}$$
(ell,m) = (1,1):
$$- \frac{\sqrt{6} e^{i \varphi}}{4 \sqrt{\pi}} \sin{\left (\vartheta \right )}$$
(ell,m) = (2,-2):
$$\frac{\sqrt{30}}{8 \sqrt{\pi}} e^{- 2 i \varphi} \sin^{2}{\left (\vartheta \right )}$$
(ell,m) = (2,-1):
$$\frac{\sqrt{30} e^{- i \varphi}}{4 \sqrt{\pi}} \sin{\left (\vartheta \right )} \cos{\left (\vartheta \right )}$$
(ell,m) = (2,0):
$$\frac{\sqrt{5}}{4 \sqrt{\pi}} \left(- 3 \sin^{2}{\left (\vartheta \right )} + 2\right)$$
(ell,m) = (2,1):
$$- \frac{\sqrt{30} e^{i \varphi}}{4 \sqrt{\pi}} \sin{\left (\vartheta \right )} \cos{\left (\vartheta \right )}$$
(ell,m) = (2,2):
$$\frac{\sqrt{30} e^{2 i \varphi}}{8 \sqrt{\pi}} \sin^{2}{\left (\vartheta \right )}$$

These values match, e.g., the ones on Wikipedia's spherical-harmonics page.

Traces of the Spherical-harmonic tensors

We can also see that the traces are zero. This is nice because it means we don't have to explicitly remove the traces from either these or the tensors with which they will be contracted.


In [7]:
AllTracesZero = True
for ell in range(2,9):
    print('')
    for m in range(-ell, ell+1):
        print('(ell,m) = ({0},{1}):'.format(ell,m))
        tmp = YlmTensor(ell,m).trace()
        if(tmp!=0): AllTracesZero=False
        display( tmp )
if(AllTracesZero):
    print("Indeed, all traces were explicitly zero.")
else:
    print("Not all traces were explicitly zero!  Maybe they just failed to simplify...", file=sys.stderr)


(ell,m) = (2,-2):
$$0$$
(ell,m) = (2,-1):
$$0$$
(ell,m) = (2,0):
$$0$$
(ell,m) = (2,1):
$$0$$
(ell,m) = (2,2):
$$0$$
(ell,m) = (3,-3):
$$0$$
(ell,m) = (3,-2):
$$0$$
(ell,m) = (3,-1):
$$0$$
(ell,m) = (3,0):
$$0$$
(ell,m) = (3,1):
$$0$$
(ell,m) = (3,2):
$$0$$
(ell,m) = (3,3):
$$0$$
(ell,m) = (4,-4):
$$0$$
(ell,m) = (4,-3):
$$0$$
(ell,m) = (4,-2):
$$0$$
(ell,m) = (4,-1):
$$0$$
(ell,m) = (4,0):
$$0$$
(ell,m) = (4,1):
$$0$$
(ell,m) = (4,2):
$$0$$
(ell,m) = (4,3):
$$0$$
(ell,m) = (4,4):
$$0$$
(ell,m) = (5,-5):
$$0$$
(ell,m) = (5,-4):
$$0$$
(ell,m) = (5,-3):
$$0$$
(ell,m) = (5,-2):
$$0$$
(ell,m) = (5,-1):
$$0$$
(ell,m) = (5,0):
$$0$$
(ell,m) = (5,1):
$$0$$
(ell,m) = (5,2):
$$0$$
(ell,m) = (5,3):
$$0$$
(ell,m) = (5,4):
$$0$$
(ell,m) = (5,5):
$$0$$
(ell,m) = (6,-6):
$$0$$
(ell,m) = (6,-5):
$$0$$
(ell,m) = (6,-4):
$$0$$
(ell,m) = (6,-3):
$$0$$
(ell,m) = (6,-2):
$$0$$
(ell,m) = (6,-1):
$$0$$
(ell,m) = (6,0):
$$0$$
(ell,m) = (6,1):
$$0$$
(ell,m) = (6,2):
$$0$$
(ell,m) = (6,3):
$$0$$
(ell,m) = (6,4):
$$0$$
(ell,m) = (6,5):
$$0$$
(ell,m) = (6,6):
$$0$$
(ell,m) = (7,-7):
$$0$$
(ell,m) = (7,-6):
$$0$$
(ell,m) = (7,-5):
$$0$$
(ell,m) = (7,-4):
$$0$$
(ell,m) = (7,-3):
$$0$$
(ell,m) = (7,-2):
$$0$$
(ell,m) = (7,-1):
$$0$$
(ell,m) = (7,0):
$$0$$
(ell,m) = (7,1):
$$0$$
(ell,m) = (7,2):
$$0$$
(ell,m) = (7,3):
$$0$$
(ell,m) = (7,4):
$$0$$
(ell,m) = (7,5):
$$0$$
(ell,m) = (7,6):
$$0$$
(ell,m) = (7,7):
$$0$$
(ell,m) = (8,-8):
$$0$$
(ell,m) = (8,-7):
$$0$$
(ell,m) = (8,-6):
$$0$$
(ell,m) = (8,-5):
$$0$$
(ell,m) = (8,-4):
$$0$$
(ell,m) = (8,-3):
$$0$$
(ell,m) = (8,-2):
$$0$$
(ell,m) = (8,-1):
$$0$$
(ell,m) = (8,0):
$$0$$
(ell,m) = (8,1):
$$0$$
(ell,m) = (8,2):
$$0$$
(ell,m) = (8,3):
$$0$$
(ell,m) = (8,4):
$$0$$
(ell,m) = (8,5):
$$0$$
(ell,m) = (8,6):
$$0$$
(ell,m) = (8,7):
$$0$$
(ell,m) = (8,8):
$$0$$

Testing contractions with the multipole moments

We can just add in a couple low-order terms for $I_{jk}$ and $J_{jk}$, and see how they come out. I expect to find some new terms proportional to $\Sigma_n + i\, \Sigma_\lambda$ in the $(2,\pm2)$ modes, and recover the usual leading-order terms in the $(2,\pm1)$ modes. Note, however, that I am not conjugating the YlmTensor objects, as I should, so the normalization and signs will be screwy.


In [49]:
I_jk = SymmetricTensorProduct(nHat, nHat, coefficient = (m*nu*r**2))

J_jk = SymmetricTensorProduct(SigmaVec, nHat, coefficient = (r*nu/c)*(-frac(3,2))) \
      + SymmetricTensorProduct(ellHat, nHat, coefficient = -nu*m*delta*r**2*v)

In [66]:
U_jk = diff(I_jk,t,2).subs(t,0)
V_jk = diff(J_jk,t,2).subs(t,0)
display(U_jk)
display(V_jk)


$$\begin{align*}&\left( \left\{ \left[ - \frac{4 m \nu}{v^{5}{\left (0 \right )}} \left. \frac{d^{2}}{d t^{2}} v{\left (t \right )} \right|_{\substack{ t=0 }} + \frac{20 m \nu}{v^{6}{\left (0 \right )}} \left(\left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }}\right)^{2} \right]\, \left.\hat{n}\right|_{t=0} \otimes_{\mathrm{s}} \left.\hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ - \frac{16 m \nu}{v^{5}{\left (0 \right )}} \left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }} \right]\, \left.\partial_t \hat{n}\right|_{t=0} \otimes_{\mathrm{s}} \left.\hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ \frac{2 m \nu}{v^{4}{\left (0 \right )}} \right]\, \left.\partial_t^{2} \hat{n}\right|_{t=0} \otimes_{\mathrm{s}} \left.\hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ \frac{2 m \nu}{v^{4}{\left (0 \right )}} \right]\, \left.\partial_t \hat{n}\right|_{t=0} \otimes_{\mathrm{s}} \left.\partial_t \hat{n}\right|_{t=0} \right\} \right)\end{align*}$$
$$\begin{align*}&\left( \left\{ \left[ \frac{3 \nu}{c v^{3}{\left (0 \right )}} \left. \frac{d^{2}}{d t^{2}} v{\left (t \right )} \right|_{\substack{ t=0 }} - \frac{9 \nu}{c v^{4}{\left (0 \right )}} \left(\left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }}\right)^{2} \right]\, \left.\vec{\Sigma}\right|_{t=0} \otimes_{\mathrm{s}} \left.\hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ \frac{6 \nu}{c v^{3}{\left (0 \right )}} \left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }} \right]\, \left.\partial_t \vec{\Sigma}\right|_{t=0} \otimes_{\mathrm{s}} \left.\hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ \frac{6 \nu}{c v^{3}{\left (0 \right )}} \left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }} \right]\, \left.\vec{\Sigma}\right|_{t=0} \otimes_{\mathrm{s}} \left.\partial_t \hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ - \frac{3 \nu}{2 c v^{2}{\left (0 \right )}} \right]\, \left.\partial_t^{2} \vec{\Sigma}\right|_{t=0} \otimes_{\mathrm{s}} \left.\hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ - \frac{3 \nu}{c v^{2}{\left (0 \right )}} \right]\, \left.\partial_t \vec{\Sigma}\right|_{t=0} \otimes_{\mathrm{s}} \left.\partial_t \hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ - \frac{3 \nu}{2 c v^{2}{\left (0 \right )}} \right]\, \left.\vec{\Sigma}\right|_{t=0} \otimes_{\mathrm{s}} \left.\partial_t^{2} \hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ \frac{3 \delta m \nu}{v^{4}{\left (0 \right )}} \left. \frac{d^{2}}{d t^{2}} v{\left (t \right )} \right|_{\substack{ t=0 }} - \frac{12 \delta m \nu}{v^{5}{\left (0 \right )}} \left(\left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }}\right)^{2} \right]\, \left.\hat{\ell}\right|_{t=0} \otimes_{\mathrm{s}} \left.\hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ \frac{6 \delta m \nu}{v^{4}{\left (0 \right )}} \left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }} \right]\, \left.\hat{\ell}\right|_{t=0} \otimes_{\mathrm{s}} \left.\partial_t \hat{n}\right|_{t=0} \right\} \right. \nonumber \\&\quad \left. + \left\{ \left[ - \frac{\delta m \nu}{v^{3}{\left (0 \right )}} \right]\, \left.\hat{\ell}\right|_{t=0} \otimes_{\mathrm{s}} \left.\partial_t^{2} \hat{n}\right|_{t=0} \right\} \right)\end{align*}$$

In [68]:
Ulm(U_jk, 2)


Out[68]:
$$2 \sqrt{3} \left(\frac{4 \sqrt{30} \sqrt{\pi} m \nu}{15 v^{6}{\left (0 \right )}} \left(- v{\left (0 \right )} \left. \frac{d^{2}}{d t^{2}} v{\left (t \right )} \right|_{\substack{ t=0 }} + 5 \left(\left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }}\right)^{2}\right) - \frac{4 m}{15} \sqrt{30} \sqrt{\pi} \nu v^{2}{\left (0 \right )} + \frac{4 \sqrt{30} i \sqrt{\pi} m \nu}{15 v^{2}{\left (0 \right )}} \left. \frac{d}{d t} v{\left (t \right )} \right|_{\substack{ t=0 }}\right)$$

In [86]:
Ulm(U_jk, 2).subs([(diff(v,t,2).subs(t,0), 0),#(9216*nu**2/25)*v.subs(t,0)**17),
                   ((diff(v,t).subs(t,0))**2,0),
                   (diff(v,t).subs(t,0),(32*nu/5)*v.subs(t,0)**9)])


Out[86]:
$$2 \sqrt{3} \left(\frac{128 i}{75} \sqrt{30} \sqrt{\pi} m \nu^{2} v^{7}{\left (0 \right )} - \frac{4 m}{15} \sqrt{30} \sqrt{\pi} \nu v^{2}{\left (0 \right )}\right)$$

In [63]:
expand(_ * -1/sqrt(2))


Out[63]:
$$\frac{32768 m}{125} \sqrt{5} \sqrt{\pi} \nu^{3} v^{12}{\left (0 \right )} - \frac{256 i}{25} \sqrt{5} \sqrt{\pi} m \nu^{2} v^{7}{\left (0 \right )} + \frac{8 m}{5} \sqrt{5} \sqrt{\pi} \nu v^{2}{\left (0 \right )}$$

In [70]:
expand(_69 * (-1 / (sqrt(2)*(2*m*nu*v.subs(t,0)**2)*sqrt(16*pi/5)) ) )


Out[70]:
$$- \frac{1024 \nu^{2}}{5} v^{10}{\left (0 \right )} - \frac{32 i}{5} \nu v^{5}{\left (0 \right )} + 1$$

In [ ]:


In [ ]:
dvdt = dOmega**1/3dt = (1/3)*Omega**(-2/3)*dOmegadt = (1/3)*v**-2*dOmegadt

In [ ]:
Omega = v**3

In [ ]:
dOmegadt = (96*nu/5)*v**11

In [ ]:
dvdt = (32*nu/5)*v**9

In [ ]:
d2vdt2 = (288*nu/5)*v**8 * dvdt = (288*nu/5)*v**8 * (32*nu/5)*v**9 = (9216*nu**2/25)*v**17

In [56]:
32*288


Out[56]:
$$9216$$

In [58]:
dvdt = (32*nu/5)*v**9
diff(dvdt,v)


Out[58]:
$$\frac{288 \nu}{5} v^{8}{\left (t \right )}$$

In [ ]:


In [ ]: