Edited: changed $\displaystyle\int_{a}^{b}f(g(t))g'(t) \, dt = \int_{g(a)}^{g(b)}f(x) \, dx$ TO $\displaystyle\int_{a}^{b}f(t) \, dt = \int_{f(a)}^{f(b)}u \, \frac{du}{f'(f^{-1}(u))}$
I am wondering about this idea in general, but for concreteness let's say I am attempting to numerically integrate the following:
$$ \int_{-\pi}^{\pi} K\left(\sqrt{1-\frac{1}{4}\left(\sqrt{3}\varepsilon+\cos(x)\right)^2}\right)dx=\int_{-\pi}^{\pi} K\left(\alpha\right)dx $$ Where $K$ is the elliptic integral of the first kind, $-\sqrt{3}<\varepsilon<\sqrt{3}$ is a parameter and for compactness I've defined $\alpha\equiv \sqrt{1-\frac{1}{4}\left(\sqrt{3}\varepsilon+\cos(x)\right)^2}$.
Let's say I want to make a change in variables before trying to crunch this numerically, for whatever reason. Let's also say I have settled on the substitution $u^3=\alpha-1$.
My question is how do I determine the bounds on the new integral? I know (thought I knew?) that in general I just solve $u^3=\alpha-1$ for $x=\pi$ and $x=-\pi$ to get my new bounds. In this case however, that results in both bounds being the same. No problem, I notice the integrand is symmetric in $x$ so I can do twice the integral from $0$ to $\pi$, which gives me different $u$-bounds. My question then is when are we allowed to apply: $$ \int_{a}^{b}f(t) \, dt = \int_{f(a)}^{f(b)}u \, \frac{du}{f'(f^{-1}(u))}\quad \text{ with } \ u=f(t) \to dt=\frac{du}{f'(f^{-1}(u))} $$ if it doesn't work when $u(a)=u(b)$? Furthermore, even going from $0$ to $\pi$ I run into the same problem when $\varepsilon=0$. I could again exploit symmetry to break up the integral, or scrap this idea entirely and try a different substitution, but I am looking for a more general method here or some insight into where this failure comes from. For example, if I let $|\varepsilon|\ll1$ my bounds in $u$ are different, but just barely. I would expect this to fail as well even though the bounds are different. It seems like there must be some need to take into account the shape of $g(t)$, perhaps $g'(t)\geq0$ or $g'(t)\leq0$ for $a<t<b$ or something like that? Any insight is appreciated, thanks in advance!