Hey I am trying to express the spherical harmonics in a compact way. I can not figure out how to express this in a table I got the spherical Harmonics for l = 0,1,2 and m = -l, ...,+l in a list. But wanted a Table in the form:
m -2 -1 0 1 2
l
0 x
1 x x x
2 x x x x x
Does anyone know how to do this since I only worked out to create simpler tables with tabulate using with normal headers. I have got the functions in the list sph_harmonics[].
from sympy import Ynm
from tabulate import tabulate
sph_harmonics = []
for l in range (0, 3):
for m in range(-l, l+1):
print('l =', l)
print('m =',m)
print(sp.simplify(Ynm(l, m, theta, phi).expand(func=True)))
sph_harmonics.append(sp.simplify(Ynm(l, m, theta, phi).expand(func=True)))