具有许多奇点的 Mathematica 积分
让 Mathematica 7 或 8 进行积分的最佳方法是什么
NIntegrate[Exp[-x]/Sin[Pi x], {x, 0, 50}]
每个整数都有极点 - 我们需要柯西原理值。 这个想法是获得从 0 到无穷大的积分的良好近似值。
对于Integrate
,有一个选项PrincipleValue ->确实如此。
使用NIntegrate
,我可以给它选项Exclusions -> (Sin[Pi x] == 0)
,或者通过原始命令和上述两个 NIntegrate
技巧手动给出极点,
NIntegrate[Exp[-x]/Sin[Pi x], Evaluate[{x, 0, Sequence@@Range[50], 50}]]
得到结果 60980 +/- 10< /代码>。但他们都吐出了错误。在 Mathematica 不想给出错误的情况下,获得快速可靠的积分结果的最佳方法是什么?
What's the best way of getting Mathematica 7 or 8 to do the integral
NIntegrate[Exp[-x]/Sin[Pi x], {x, 0, 50}]
There are poles at every integer - and we want the Cauchy principle value.
The idea is to get a good approximation for the integral from 0 to infinity.
With Integrate
there is the option PrincipleValue -> True
.
With NIntegrate
I can give it the option Exclusions -> (Sin[Pi x] == 0)
, or manually give it the poles by
NIntegrate[Exp[-x]/Sin[Pi x], Evaluate[{x, 0, Sequence@@Range[50], 50}]]
The original command and the above two NIntegrate
tricks give the result 60980 +/- 10
. But they all spit out errors. What is the best way of getting a quick reliable result for this integral without Mathematica wanting to give errors?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
西蒙,有理由相信你的积分是收敛的吗?
看起来问题出在 x==0 处。对于 k 的整数值,将被积函数 k+eps 拆分为 k+1-eps:
如您所见,存在对数奇点。
编辑
上面代码的 Out[79] 给出了 eps->0 的级数展开式,如果将这两个对数项组合起来,我们
显然会得到 -Log[eps]/Pi 来自 x==0 处的极点。因此,如果减去这个,就像主值法对其他极点执行此操作一样,您最终会得到一个有限值:
当然,这个结果很难用数字来验证,但您可能比我对您的问题了解更多。
编辑 2
此编辑是为了证明计算原始正则化积分的 In[65] 输入是合理的。我们正在计算
第三行 Sin[Pi*(k+x)] == (-1)^k*Sin[Pi*x] 对于整数 k 使用。
Simon, is there reason to believe your integral is convergent ?
It looks like the problem is at x==0. Splitting integrand k+eps to k+1-eps for integer values of k:
As you see there is a logarithmic singularity.
EDIT
Out[79] of the code above gives the series expansion for eps->0, and if these two logarithmic terms get combined, we get
Clearly the -Log[eps]/Pi came from the pole at x==0. So if one subtracts this, just like principle value method does this for other poles you end up with a finitely value:
Of course, this result is difficult to verify numerically, but you might know more that I do about your problem.
EDIT 2
This edit is to justify In[65] input that computes the original regularized integral. We are computing
In the third line Sin[Pi*(k+x)] == (-1)^k*Sin[Pi*x] for integer k was used.
西蒙,我没有花太多时间研究你的积分,但你应该尝试看看稳态相位近似。您拥有的是平滑函数 (exp) 和高度振荡函数 (sine)。现在涉及的工作是将
1/sin(x)
转换成exp(if(x))
的形式。另外,您也可以使用
余割
(在极点无效):请注意,对于所有
m>-1
,您有以下结果:但是,将级数与余割系数相加(来自维基百科) ,不包括
1/x Exp[-x]
情况,它不收敛于[0,Infinity]
。也不收敛...
所以,我不确定您是否可以计算出无穷大积分的近似值,但如果您对达到某个大 N 的解决方案感到满意,我希望这些有所帮助。
Simon, I haven't spent much time with your integral, but you should try looking at stationary phase approximation. What you have is a smooth function (exp), and a highly oscillatory function (sine). The work involved is now in brow-beating the
1/sin(x)
into the formexp(if(x))
Alternatively, you could use the series expansion of the
cosecant
(not valid at poles):Note that for all
m>-1
, you have the following:However, summing the series with the coefficients of cosecant (from wikipedia), not including
1/x Exp[-x]
case, which doesn't converge on[0,Infinity]
.does not converge either...
So, I'm not sure that you can work out an approximation for the integral to infinity, but I if you're satisfied with a solution upto some large N, I hope these help.
我必须同意 Sasha,积分似乎不是收敛。但是,如果排除
x == 0
并将积分分解为n >= 0 && 的 片段。 Element[n, Integers]
,那么看来你可能会得到一个交替的序列,现在我只取出到
n == 4
,但看起来很合理。然而,对于上面的积分假设 ->元素[n, 整数] && n >= 0 Mathematica 给出的结果并不符合具体情况。作为补充说明,如果极点位于积分区域的边界,即您的极限是
{x, n, n + 1}
,您只能得到DirectedInfinity
。快速查看该图意味着您在限制{x, n, n + 1}
的情况下只有严格的正或负被积函数,因此无限值可能是由于缺乏补偿{x, n + 1/2, n + 3/2}
为您提供。使用{x, n, n + 2}
检查,但它只输出未计算的积分。I have to agree with Sasha, the integral does not appear to be convergent. However, if you exclude
x == 0
and break the integral into pieceswhere
n >= 0 && Element[n, Integers]
, then it seems you may get an alternating seriesNow, I only took it out to
n == 4
, but it looks reasonable. However, for the integral above withAssumptions -> Element[n, Integers] && n >= 0
Mathematica giveswhich just doesn't conform to the individual cases. As an additional note, if the pole lies at the boundary of the integration region, i.e. your limits are
{x, n, n + 1}
, you only getDirectedInfinity
s. A quick look at the plot implies that you with the limits{x, n, n + 1}
you only have a strictly positive or negative integrand, so the infinite value may be due to the lack of compensation which{x, n + 1/2, n + 3/2}
gives you. Checking with{x, n, n + 2}
, however it only spits out the unevaluated integral.