Mathematica 与 PrimaryValue 集成中的错误 -> True
看来 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不认为这是
PrincipalValue
中的错误。在第一行中,PrincipalValue
无法“正确”工作,因为直到完成Integrate
后才知道极点的位置。编辑:
我在 Mathematica 中玩了一下,这正是发生的情况。您可以使用
Trace[]
命令。输出有点混乱(这就是为什么我不在这里复制它),但您可以看到集成在哪里完成,x0
的值在哪里被替换,以及它如何与本金价值
。编辑2:
那么回到解决你的实际问题。如果您使用指定 x=1/2 x0 位于哪一侧的假设,则这两个示例给出相同的答案。
I don't think this is a bug in
PrincipalValue
. In the first linePrincipalValue
does not work "correctly" because the position of the pole is not known until afterIntegrate
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 forx0
is substituted and how that messes withPrincipalValue
.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.
似乎在8.0中已修复:
Seems to be fixed in 8.0:
嗯,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.