I am trying to perform a numerical integration of a large integrand which includes the K_0 or the Hankel function as a part. I began with the study of behavior of K_0 and Hankel function alone and plotted the graphs and obtained the numerical values using mathematica and then python vegas package. Now here is the problem, Mathematica and python give totally different results. I am not sure about any result or even my coding as I am not a mathematician. The mathematica code is as follows.
Hankel
In[32]:= Integrandh = HankelH1[0, Sqrt[D1h] b1]
Out[32]= HankelH1[0, b1 Sqrt[35.5614 + 19.2684 x1]]
Plot3D[Integrandh, {x1, 0.0001, 1}, {b1, 0.0001, 3.99},
PlotRange -> All, AxesLabel -> {"x1", "b1", "Bessel[x1, b1]"},
PlotLabel -> "3D Plot"]
In[46]:= f11 = NIntegrate[Integrandh, {x1, 0.1, .2}, {b1, 0.1, 3.99}]
Out[46]= 0.00407019 + 0.00884887 I
$K_0$ Bessel
$\text{Integrand}=K_0\left(\text{b1} \sqrt{\text{mD} \left(\text{mD}-\text{mB} \text{x1} \left(\eta +\sqrt{\eta ^2-1}\right)\right)}\right)$
$K_0\left(1.40321 \text{b1} \sqrt{1.969\, -9.78586 \text{x1}}\right)$
Plot3D[Integrand, {x1, 0.0001, 1}, {b1, 0.0001, 3.99},
PlotRange -> {0, 1.2}, AxesLabel -> {"x1", "b1", "Bessel[x1, b1]"},
PlotLabel -> "3D Plot"]
In[45]:= f11 = NIntegrate[Integrand, {x1, 0.1, .3}, {b1, 0.1, 3.99}]
Out[45]= 0.142902 - 0.211705 I
I could not find the file attach option so I am copying the python code here.
import math
import vegas
from scipy.special import hankel1
import numpy as np
def integrand(x):
x1, b1 = x
return hankel1(0, b1 * np.sqrt(35.5614 + 19.2684 * x1))
# return kv(0, 1.40321 * b1 * math.sqrt(1.969 - 9.78586 * x1))
# Define the integration range
x1_range = [0.0001, 1]
b1_range = [0.0001, 3.99]
# Define the vertical range
vertical_range = [0, 1.2]
# Set up the vegas integrator
integ = vegas.Integrator([x1_range, b1_range])
# Perform the integration
result = integ(integrand, nitn=10, neval=10000)
# Print the result
print(result.summary())
print("Estimated result: ", result.mean)
print("Standard error: ", result.sdev)
This is the output
