您能解释一下 Mathematica $Asminations 的行为吗?

发布于 2024-12-19 02:12:33 字数 548 浏览 1 评论 0原文

考虑以下三行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟火散人牵绊 2024-12-26 02:12:33

在 Mathematica 7.0.1 中结果是 0,而在 8.0.4 中我们得到

8/3 Sqrt[a^2+b^2] E^-a^2

因此它一定是一个 bug,更糟糕的是它是一个错误。幸运的是,无需计算机就可以轻松验证结果,但如果涉及更复杂的积分,这将是一个大问题。

In Mathematica 7.0.1 the result is 0, while in 8.0.4 we get

8/3 Sqrt[a^2+b^2] E^-a^2

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.

酒几许 2024-12-26 02:12:33

这似乎已经解决了。在 9.0 版本中,两者都给出结果 0。

This seems to have been solved. In 9.0 version, both give results 0.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文