具有严重抑制指数的 Matlab 双积分

Matlab double integral with heavily suppressed exponentials

我最近一直在尝试计算函数的二重积分fun = @(v,x)(10^4)*0.648*(1+v*0.001).*( exp(-2.83./( 10^-8+(sqrt(1+2*v*0.001)).*(x.^2)) ) -1).*(exp(-(v.^2)*0.33)),v 的范围是 (-1000,1000),x 的范围是 (0,a),其中 a 是一个非常大数或无穷大。我发现,虽然在 a = inf 的情况下,该值似乎相当准确(它减少到一个单一的积分,在数值上评估起来不那么麻烦),但如果我从 0 积分到 10^9 和从 10 ^9 到无穷大,积分总和不为正确值,后者为零。我真正感兴趣的是从 0 到 10^9 的积分,但这些结果让我怀疑我是否完全可以相信它。 在我所做的事情中,我还必须在函数前面使用一个大的预因子 (10^200) 来 "compensate" 来表示小数字;否则结果都是废话。我曾尝试使用 vpa,但没有成功。我做错了什么?

罗布

看起来你的问题与 Matlab 用于不同情况的不同方法以及你正在处理的大数字有关。

我们可以通过 ezsurf 查看您的函数,只是想知道它的行为方式。

所以提示 1 是该值将是一个负值,让我们在小范围内积分以查看它的近似值。

integral2(fun,-100,100,0,100)

%ans =
%  -5.9050e+04

假设函数趋于零,我们知道最终值应该在邻域内。

现在提示2:

integral2(fun,-1000,1000,0,100)

%ans =
%  -2.5613e-29

这没什么意义,通过增加极限范围积分基本上变成了零。检查后 documentation of integral2

'Method' — Integration method 'auto' (default) | 'tiled' | 'iterated'

Integration method, specified as the comma-separated pair consisting of 'Method' and one of the methods described below.

Integration Method Description

'auto' For most cases, integral2 uses the 'tiled' method. It uses the 'iterated' method when any of the integration limits are infinite. This is the default method.

'tiled' integral2 transforms the region of integration to a rectangular shape and subdivides it into smaller rectangular regions as needed. The integration limits must be finite.

'iterated' integral2 calls integral to perform an iterated integral. The outer integral is evaluated over xmin ≤ x ≤ xmax. The inner integral is evaluated over ymin(x) ≤ y ≤ ymax(x). The integration limits can be infinite.

好的,所以如果我们不定义方法,如果限制是有限的,它将使用 "tiled",如果限制是无限的,它将使用 "interpolated"。

会不会是范围太大,"tiled"方法生成的瓦片太大,无法准确计算积分?如果是这样那么 "iterated" 应该没有那个问题,让我们检查一下

integral2(fun,-1000,1000,0,100,'Method','iterated')

%ans =
%  -5.9050e+04

有趣,看来我们正在研究某事。我们来试试原题

integral2(fun,-1000,1000,0,inf)

%ans =
%  -5.9616e+04

integral2(fun,-1000,1000,0,10^9,'Method','tiled')

%ans =
%  -2.1502e-33

integral2(fun,-1000,1000,0,10^9,'Method','iterated')

%ans =
%  -5.9616e+04

integral2(fun,-1000,1000,10^9,inf)

%ans =
%     0

看起来好多了。所以看起来 'tiled' 方法是你的函数的问题,因为它的特性和限制范围的大小。所以只要你用'iterated'就可以了。