def func_nb():
    outer_sum = 0
dk = 0.01
X = np.arange(dk, 0.4, dk)
Y = np.arange(dk, 20, dk)
for i in range(X.shape[0]):
    k = X[i]
inner_sum = 0
for j in range(Y.shape[0]):
    A = Y[j]
inner_sum += dk * f_big_nb(A, k, 1e-05, 1e-05)
outer_sum += inner_sum * dk
return outer_sum
Используйте numba для ускорения цикла