def test_spherical_harmonic(scheme):
'''Assert the norm of the spherical harmonic
Y_1^1(phi, theta) = -1/2 sqrt(3/2/pi) * exp(i*phi) * sin(theta)
is indeed 1, i.e.,
int_0^2pi int_0^pi
Y_1^1(phi, theta) * conj(Y_1^1(phi, theta)) * sin(theta)
dphi dtheta = 1.
'''
def spherical_harmonic_11(azimuthal, polar):
# y00 = 1.0 / numpy.sqrt(4*numpy.pi)
y11 = -0.5 * numpy.sqrt(3.0/2.0/numpy.pi) \
* numpy.exp(1j*azimuthal) * numpy.sin(polar)
return y11 * numpy.conjugate(y11)
val = quadpy.sphere.integrate_spherical(
spherical_harmonic_11,
rule=scheme
)
assert abs(val - 1.0) < 1.0e-15
return
评论列表
文章目录