我一直在尝试使用scipy.integrate.tplquadrature来解决方程,但是没有完全理解符号,因此不知道如何解决以下等式。任何帮助将非常感激。
IMG http://i42.tinypic.com/t69sfo.gif
谢谢,
答案 0 :(得分:1)
在您的示例中,它给出了零积分结果。我对1.e22
使用了一个高值inf
:
from scipy import exp, pi
inf = 1.e22
from scipy.integrate import tplquad
func = lambda x,y,z: x**2 * exp(-x**2) * exp(-0.5*y*z/x)
x1,x2 = 0, pi
y1,y2 = lambda x: 0, lambda x: inf
z1,z2 = lambda x,y: 0, lambda x,y: inf
print tplquad( func, x1, x2, y1, y2, z1, z2 )
#(0.0, 0.0)
这是一个示例to calculate the volume of a sphere:
import scipy
from scipy.integrate import quad, dblquad, tplquad
from numpy import *
# limits for radius
r1 = 0.
r2 = 1.
# limits for theta
t1 = 0
t2 = 2*pi
# limits for phi
p1 = 0
p2 = pi
def diff_volume(p,t,r):
return r**2*sin(p)
volume = tplquad(diff_volume, r1, r2, lambda r: t1, lambda r: t2,
lambda r,t: p1, lambda r,t: p2)[0]