I want to perform MCMC or HMC for solving minimization problem of a function $f(x)$, then define the corresponding density $$g(x) = \exp\left(-f(x)\right)$$ Because the function of the future apply is only valid in a finite domain, I perform a variable transform by $$y = \log(x - lb) - \log(ub - x)$$, where $lb$ and $ub$ is the lower and upper boundary. Through the Jacobian formula $$G(y) = \frac{g(x)}{|J(x)|}$$ written in logarithmic form $$\log\left(G(y)\right) = -f(x) - \log\left(|J(x)|\right)$$ A new function is used for MCMC $$h(x) = -\log\left(G(y)\right) = f(x) + \log\left(|J(x)|\right)$$ I thought the minimal location of $h(x)$ is the same as $f(x)$, but the result shows it's not. I'm confused why they're different, is the jacobian formula completely correct or I misunderstand something?
Below is the McCormick function, the minimal is at (-0.55, -1.55), but the minimal of $h(x)$ is at (-0.27, -1.32). Another figure is along x axis when y = -1.55