【发布时间】:2021-01-26 10:53:56
【问题描述】:
嘿,我正在尝试以紧凑的方式表达球谐函数。我无法弄清楚如何在表格中表达这一点,我在列表中得到了 l = 0,1,2 和 m = -l, ...,+l 的球面谐波。但想要一个表格中的表格:
m -2 -1 0 1 2
l
0 x
1 x x x
2 x x x x x
有谁知道如何做到这一点,因为我只是想用普通表头创建更简单的表格。我有列表 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)))
【问题讨论】:
标签: python format sympy tabulate