Hello everyone,
I’m transitioning from python to Julia and I’m trying to compute some integrals using hcubature
I’m trying to compute the following integral, for which the constant \beta is equal to 1
As seen from the picture, the numerical result to the integral is approximately 25.80
In Julia, I am trying to compute the integral above this way:
using HCubature
β = 1
hcubature(x -> log(cosh(2 * β) ^ 2 - sinh(2 * β) * (cos(x[1]) + cos(x[2]))), (pi, 0), (pi,0))[1]
which gives 0.0 as the answer.
In python, I would compute the same integral using nquad the following way:
import numpy as np
from scipy.integrate import nquad
ff = lambda x1, x2: np.log(np.cosh(2 * beta) ** 2 - np.sinh(2 * beta) * (np.cos(x1) + np.cos(x2)))
nquad(ff, [[0, np.pi], [0, np.pi]])[0]
this gives me the correct result of 25.80.
What am I doing wrong with hcubature?
Thank you in advance!