I am trying to solve a Lagrange multiplier problem for the following equation
$$ L= - \int_{-\infty}^\infty \rho(x) \ln \frac{\rho(x)}{q(x)} dx + \alpha \left( 1- \int_{-\infty}^\infty \rho(x) dx \right) +\beta \left( \overline{O} - \int_{-\infty}^\infty O(x) \rho(x) dx \right) \tag{1} $$
for $\frac{\partial L}{\partial \rho(w)} =0$.
Where the first term is the relative entropy, the second term is the constraint that it sums to one, and the last term is the constraint of an observable involving its average value. The problem solves for the probability measure that maximizes the relative entropy of a continuous parametrization x.
An interesting property of the relative entropy is that its equations remains invariant with respect to a change in variable. Indeed,
$$ \int_{-\infty}^\infty \rho(x)\ln \frac{\rho(x)}{q(x)} dx \to \int_{-\infty}^\infty \rho(y(x)) \left|\frac{\partial y}{\partial x}\right|\ln \frac{\rho(y(x))\left|\frac{\partial y}{\partial x}\right|}{q(y(x)) \left|\frac{\partial y}{\partial x}\right|} dx = \int_{-\infty}^\infty \rho(y)\ln \frac{\rho(y)}{q(y)} dy \tag{2} $$
and
$$ \int_{-\infty}^\infty \rho(x)dx \to \int_{-\infty}^\infty \rho(y(x)) \left|\frac{\partial y}{\partial x}\right| dx = \int_{-\infty}^\infty \rho(y) dy \tag{3} $$
However, the last term isn't. Indeed:
$$ \int_{-\infty}^\infty O(x) \rho (x) dx \to \int_{-\infty}^\infty O(y(x)) \left|\frac{\partial y}{\partial x}\right| \rho (y(x)) \left|\frac{\partial y}{\partial x}\right| dx = \int_{-\infty}^\infty O(y) \rho (y(x)) \left|\frac{\partial y}{\partial x}\right| dy \tag{4} $$
How can I modify the integral that contains O so that it is coordinate invariant?
What is the expression for the average of a function O(x) over a continuous parametrization x, such that the average value is coordinate invariant?