我希望在SciPy中复制以下MATLAB代码的结果.
MATLAB Version:个
f = @(x, y) besselh(0, 2, x.^2 + y.^2);
integral2(f, -0.1, 0.1, -0.1, 0.1)
MatLab结果为:
ans =
0.0400 + 0.1390i
SciPy Version:个
f = lambda x, y: scipy.special.hankel2(0, x**2 + y**2)
scipy.integrate.dblquad(f, -0.1, 0.1, lambda x: -0.1, lambda x: 0.1)
但是,当我运行SciPy代码时,我收到以下警告:
IntegrationWarning: The occurrence of roundoff error is detected ...
并且结果与MatLab的输出不同:
(nan, 2.22e-15)
有没有人能解释一下为什么我会收到这个警告,以及如何获得类似于MatLab的结果?