Reputation: 119
I am running the following Julia code.
using HCubature
f(x) = 1 / (exp(x[1]^2 + x[2]^2 + x[3]^2) - 1)
c = 0
a = [c, c, c]
b = [1.0, 1.0, 1.0]
result, error = hcubature(f, a, b)
println("result = ", result)
println("error = ", error)
It returns
result = Inf
error = NaN
However, this 3-d integral is clearly converged at x=(0,0,0). Why does HCubature have such a problem? And what should I do to get the correct result?
I change the variable c from 0 to 1e-8 and the program returns
result = 1.4994522443953553
error = 2.234083860406827e-8
But if I change it to 1e-9, the program returns Inf again. Maybe HCubature cannot properly deal with the singularity. What should I do to make it can deal with the singularity?
Upvotes: 0
Views: 41