您能解释一下 Mathematica $Asminations 的行为吗?
考虑以下三行 Mathematica 代码,请注意输入行 1 和 3 完全相同(这是我发现的演示此行为的最小代码段)。
>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]
0
>> $Assumptions = {t > 0};
>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]
8/3 Sqrt[a^2+b^2] E^-a^2
请注意,积分应该产生 0,就像 Mathematica 的第一个答案一样。我输入的假设显然与集成无关。这是一个错误吗(我使用 Mathematica 8.0)?
更奇怪的是,如果我将积分分成 2 个或 3 个积分的总和,每个积分都会产生 0。如果我从积分中取出不依赖于 p 的部分,也会发生同样的情况。
对我来说,这看起来像是一个错误,但如果我缺少什么,请告诉我。
Consider the following three lines of Mathematica code and note that input line 1 and 3 are exactly the same (This is the smallest piece of code I found to demonstrate this behaviour).
>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]
0
>> $Assumptions = {t > 0};
>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]
8/3 Sqrt[a^2+b^2] E^-a^2
Note that the integral should yield 0, like in Mathematica's first answer. The assumption I enter has apparently nothing to do with the integration. Is this a bug (I use Mathematica 8.0)?
Even stranger, if I split the integral into a sum of 2 or 3 integrals, each of them yields 0. Same thing if I take parts out of the integral which do not depend on p.
For me it looks like a bug but if there is something I'm missing, please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Mathematica 7.0.1 中结果是 0,而在 8.0.4 中我们得到
因此它一定是一个 bug,更糟糕的是它是一个错误。幸运的是,无需计算机就可以轻松验证结果,但如果涉及更复杂的积分,这将是一个大问题。
In Mathematica 7.0.1 the result is 0, while in 8.0.4 we get
Thus it has to be a bug, even worse it is an error. Fortunately, one can easily verify the result without a computer, but in case of a more involved integral it would be a major problem.
这似乎已经解决了。在 9.0 版本中,两者都给出结果 0。
This seems to have been solved. In 9.0 version, both give results 0.