Mathematica 与 PrimaryValue 集成中的错误 -> True

发布于 2024-09-04 08:36:14 字数 994 浏览 2 评论 0原文

看来 Mathematica 对主值积分的处理在某些极端情况下失败了。考虑这两个表达式(它们应该给出相同的结果):

Integrate[UnitBox[x]/(x0 - x), {x, -Infinity, Infinity},
  PrincipalValue -> True, Assumptions -> {x0 > 0}] /. x0 -> 1 // Simplify
Integrate[UnitBox[x]/(x0 - x) /. x0 -> 1, {x, -Infinity, Infinity}, 
  PrincipalValue -> True]

在 Mathematica 7.0.0 中,我得到

I Pi+Log[3]
Log[3]

Has this be returned in later versions?有人有(或多或少)一般解决方法的想法吗?

编辑:上面的两个表达式应该计算相同的结果,第一个通过计算积分的一般形式并在 x0=1 处求值,第二个通过使用 x0 执行积分代码> 设置为 <代码>1。由于柯西主值有精确的数学定义,Mathematica 应该给出相同的结果或拒绝回答。

编辑2:同一错误的一个可能更简单的示例,在 Integral 内部和外部放置一个 -1 因子给出不同的答案(第二个给出了正确的答案,第一个没有):

-Integrate[ UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, PrincipalValue -> True, Assumptions -> {x0 > 0}]
 Integrate[-UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, PrincipalValue -> True, Assumptions -> {x0 > 0}]

It seems that Mathematica's handling of principal value integrals fails on some corner cases. Consider these two expressions (which should give the same result):

Integrate[UnitBox[x]/(x0 - x), {x, -Infinity, Infinity},
  PrincipalValue -> True, Assumptions -> {x0 > 0}] /. x0 -> 1 // Simplify
Integrate[UnitBox[x]/(x0 - x) /. x0 -> 1, {x, -Infinity, Infinity}, 
  PrincipalValue -> True]

In Mathematica 7.0.0 I get

I Pi+Log[3]
Log[3]

Has this been fixed in later versions? Does anybody have an idea for a (more or less) general workaround?

EDIT: The two expressions above should calculate the same result, the first by calculating a general form of the integral and evaluating it at x0=1, the second by performing the integral with x0 set to 1. Since the Cauchy principal value has a precise mathematical definition, Mathematica should give the same result or decline to answer.

EDIT 2: A perhaps simpler example of the same bug, putting a factor of -1 inside and outside the Integral give different answers (second one gives the correct answer, first one doesn't):

-Integrate[ UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, PrincipalValue -> True, Assumptions -> {x0 > 0}]
 Integrate[-UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, PrincipalValue -> True, Assumptions -> {x0 > 0}]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

屋檐 2024-09-11 08:36:14

我不认为这是 PrincipalValue 中的错误。在第一行中,PrincipalValue 无法“正确”工作,因为直到完成Integrate 后才知道极点的位置。

编辑:
我在 Mathematica 中玩了一下,这正是发生的情况。您可以使用 Trace[] 命令。输出有点混乱(这就是为什么我不在这里复制它),但您可以看到集成在哪里完成,x0 的值在哪里被替换,以及它如何与 本金价值

编辑2:
那么回到解决你的实际问题。如果您使用指定 x=1/2 x0 位于哪一侧的假设,则这两个示例给出相同的答案。

I don't think this is a bug in PrincipalValue. In the first line PrincipalValue does not work "correctly" because the position of the pole is not known until after Integrate is done.

EDIT:
I played around in Mathematica a bit and this is exactly what happens. You can see for yourself by using the Trace[] command. The output is a bit messy (which is why I don't replicate it here), but you can see where the integration gets done and where the value for x0 is substituted and how that messes with PrincipalValue.

EDIT2:
So back to solving your actual problem. If you use an Assumption that specifies which side of x=1/2 x0 lies, then the two examples give the same answer.

你的笑 2024-09-11 08:36:14

似乎在8.0中已修复:

In[1]:= $Version
Out[1]= "8.0 for Mac OS X x86 (32-bit) (November 13, 2010)"

In[2]:= 
Integrate[UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, 
   PrincipalValue -> True, Assumptions -> {x0 > 0}] /. 
  x0 -> 1 // Simplify

Out[2]= Log[3]

In[3]:= Integrate[
 UnitBox[x]/(x0 - x) /. x0 -> 1, {x, -Infinity, Infinity}, 
 PrincipalValue -> True]

Out[3]= Log[3]

Seems to be fixed in 8.0:

In[1]:= $Version
Out[1]= "8.0 for Mac OS X x86 (32-bit) (November 13, 2010)"

In[2]:= 
Integrate[UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, 
   PrincipalValue -> True, Assumptions -> {x0 > 0}] /. 
  x0 -> 1 // Simplify

Out[2]= Log[3]

In[3]:= Integrate[
 UnitBox[x]/(x0 - x) /. x0 -> 1, {x, -Infinity, Infinity}, 
 PrincipalValue -> True]

Out[3]= Log[3]
贵在坚持 2024-09-11 08:36:14

嗯,Wolfram Alpha,我假设它使用最新版本的 Mathematica,不喜欢你的第一个表达式,并给出了第二个表达式:
log(3)+常量

http://www.wolframalpha.com/input/?i=Integrate[UnitBox[x]%2F%28x0+-+x%29+%2F.+x0+-% 3E+1%2C+{x%2C+-Infinity%2C+Infinity}%2C++++PrincipalValue+-%3E+True]

这篇文章可能适用于这种情况,但我不是数学家专家所以我不知道?
然而,在某些情况下,几个不同的答案都同样符合正式的数学定义。因此,例如,在计算符号积分时,通常存在几种不同的表达式,它们都产生相同的导数。 哪些表达式实际上是由 Integrate 生成的,具体取决于 Integrate 内部的工作方式。

Well Wolfram Alpha, which I would assume uses the latest version of Mathematica, doesn't like your first expression and gives this for the second:
log(3)+constant

http://www.wolframalpha.com/input/?i=Integrate[UnitBox[x]%2F%28x0+-+x%29+%2F.+x0+-%3E+1%2C+{x%2C+-Infinity%2C+Infinity}%2C++++PrincipalValue+-%3E+True]

It may be that this article applies in this case but I'm not a math expert so I wouldn't know?
There are some situations, however, where several different answers are all equally consistent with the formal mathematical definitions. Thus, for example, in computing symbolic integrals, there are often several different expressions which all yield the same derivative. Which of these expressions is actually generated by Integrate can then depend on how Integrate works inside.

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