python - scipyIntegrate.tplquad 的不同结果

标签 python scipy wolfram-mathematica

使用 Matematica,这个积分给我 3。wolfram alpha 使用Integrate.tplquad,我得到-3。
这是 Matematica 代码。

Integrate[1-x, {(0,2),(0,3-1.5*x),(0,6-3*x -2*y)}]   

我看不出 ntegrate.tplquad 做错了什么

f = lambda x,y,z: 1-x   

x1, x2 = 0,2

y1, y2 = lambda x : 0 , lambda x:3-1.5*x

z1, z2  = lambda x,y:0, lambda x,y: 6 -3*x -2*y

print(integrate.tplquad(f,x1,x2, y1, y2, z1, z2)[0])
-3.0

最佳答案

仔细检查 tplquad docstring ;您会看到函数 f 的签名是 f(z, y, x)。所以看起来你的被积函数应该是:

   f = lambda x, y, z: 1 - z

关于python - scipyIntegrate.tplquad 的不同结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52710223/

相关文章:

python - DateTimeField 收到一个天真的日期时间

python - SMTPAuthenticationError-535,b'5.7.8用户名和密码不被接受。 -从Docker发送电子邮件

python - 从维基百科数据库转储生成纯文本

python - 如何使用 pip 安装带有额外组件的本地 Python 包?

wolfram-mathematica - 数学: flatten a nested list with repetitions

python - 使用 scipy 集成功能?

python - 元素明智地访问非常大的稀疏矩阵的有效结构(Python/Cython)

python - 在 python 中调用 C 库?

wolfram-mathematica - 使用 Mathematica 中的 Manipulation 函数 :

string - 在 Mathematica 中使用 "CreateDocument"函数而不丢失格式