# Action Integral

In the theory of action-angle variables, you wind up having to solve integrals with a characteristic square-root behavior near the endpoints to express the action in terms of the orbital quantities. For the Kepler potential, this integral is $$I = \int_{a}^{b}{\sqrt{\left(r - a\right)\left(b - r\right)} \over r}\,{\rm d}r$$

I believe from external sources that this works out to $$I = \pi [ \frac{a+b}{2} - \sqrt{a b}]$$ In other words, proportional to the difference of the arithmetic and geometric means.

However, apparently I suck at doing integrals, so I'm unable to figure out why. I suspect that there is a transformation that would be useful in solving this integral, and quite possibly some similar integrals arising from other potentials. Such a transformation might also be useful in numerically calculating integrals for potentials where you can't solve it analytically. I'd like to try several alternate potentials that are more realistic than Kepler for a problem I have where action-angle theory is useful. But all of the transformations I've tried have run up blind alleys. Can someone explain to me how to derive this? Thanks in advance.

-
When you say 'derive this', what are referring to? The formula for $I$, or some general transformation technique? If the former, I'm afraid MO isn't the site for such questions, see the FAQ for a detailed explanation why. – David Roberts May 7 '12 at 4:55
I've never tried this particular integral, but off the top of my head I would start by trying $r=a+(b-a)\sin^2 \theta$. Then double angle formulae. Did you already try this? – Yemon Choi May 7 '12 at 9:21
To reduce an integral of the type $$\int R\left( x,\sqrt{ax^{2}+bx+c}\right) dx$$ to an integral of a rational function one may use the so called Euler substitutions. See Euler substitutions, L.D. Kudryavtsev (originator), Encyclopedia of Mathematics. URL: encyclopediaofmath.org/…. – Américo Tavares May 7 '12 at 12:20
The transformation suggested by Yemon Choi is very useful. First of all, it gets rid of the square-root singularities at the endpoints, so the numerical integration is easier for arbitrary potentials. It is also closely related to the rational parameterization mentioned by the other commenters, since I think $\theta = \phi/2$ where $\phi$ is the azimuthal coordinate of the circle introduced by Igor. – Raymond May 8 '12 at 4:09
Well, my feeling on seeing the name Kepler and seeing the form of the final answer was that there must be an ellipse involved... – Yemon Choi May 8 '12 at 10:43

There are multiple ways of going about the evaluation of this integral and different methods are appropriate depending on what you need and how you intend to generalize the integrand.

If you are only interested in the numerical value for fixed parameters $a$ and $b$. Then this integral can be handled essentially "out of the box" by any computer algebra or numerical software package. The reason is that the integrand is very smooth, with not too much variation over the integration domain. Look up the QAGS routine if you want finer control of how the integration is done close to the square-root singularities at the boundary. This will work for a large class of similar integrands as well.

Another very useful technique is contour integration. Namely, imagine that $C$ is a tight clockwise contour about the segment $[a,b]$ in the complex $z$ plane. Then you have the identity $$I = \frac{1}{2i}\int_C \frac{\sqrt{-(z-a)(b-z)}}{z} \mathrm{d}z ,$$ where the principal branch of the square root is used, with the branch cut on $[a,b]$. The reason for the identity is that this contour picks up the difference between the values of the square root on either side of the branch cut, which is precisely $2i\sqrt{(z-a)(b-z)}$. The integral can now be evaluated using residues, which is easier after the substitution $z=w^{-1}+(a+b)/2$: $$I = -\frac{1}{2i}\int_{C'} \frac{\sqrt{(w+\frac{2}{b-a})(\frac{2}{b-a}-w)}}{w^2(w+\frac{2}{a+b})} \mathrm{d}w ,$$ where again the principal square root branch is used, with the branch cut on the real line excluding $(-\frac{2}{b-a},\frac{2}{b-a})$, and the integration contour $C'$ is now counter-clocwise and encircles the poles at $w=0$ and $w=-2/(a+b)$. These residues contribute respectively $2\pi i (a+b)/2/(-2i)$ and $-2\pi i\sqrt{ab}/(-2i)$, which shows that I'm a minus sign off from your answer. (Finding the sign mistake is left as an exercise to the reader. :-) This method will still work if the functions in the denominator and under the square root are replaced by a large class of analytic functions.

Another method uses the fact that the integrand is rational in $s=\sqrt{(r-a)(b-r)}$ and $r$, while these two expressions satisfy the equation $s^2+(r-\frac{a+b}{2})^2 = (\frac{b-a}{2})^2$. This equation defines a circle in the $rs$-plane and hence has a rational parametrization $$s(t) = \frac{b-a}{2}\frac{2t}{1+t^2} \quad\text{and}\quad r(t) = \frac{b-a}{2}\frac{1-t^2}{1+t^2} + \frac{a+b}{2} .$$ This remarkable fact means that the integrand becomes rational as well (no square roots) upon the substitution $r=r(t)$. Any rational expression can be integrated using partial fractions. In this form, the integral is $$I = \int_0^\infty\left[ -\frac{2ab}{at^2+b}+\frac{2b}{t^2+1}-\frac{2(b-a)}{(t^2+1)^2} \right] = -\pi\sqrt{ab} + \pi b - \pi\frac{b-a}{2} ,$$ which agrees with your expression. This method works only when the integral is a rational in two expressions $s$ and $r$, which are linked by rationally parametrizable curve in the $rs$-plane. This last method is a souped up version of the Euler substitution mentioned in the comment by Américo Tavares.

These three methods work in cases of roughly decreasing generality.

-
I'm sorry for the slightly off-topic question which it appears should have gone in a different forum...but not really, as I might not have gotten that fantastic answer from Igor. :-> Thanks! (Still trying to wrap my head around some details of the complex integration method. I note in the last equation the sign of the last term should be flipped). I'll try the same technique on some other potentials. I guess Américo Tavares is suggesting something along the same lines. – Raymond May 8 '12 at 4:10
Thanks for spotting that! Fixed. Now you just need to find the sign mistake in the contour method. ;-) – Igor Khavkine May 8 '12 at 10:20

I would suggest the most elementary way I can imagine to compute this integral in this case is transforming the given via substitution : $\frac{r-a}{b-r} = t^2$ , assuming $b>a$ are both real. The substituion is real version of so called Möbius tranformation. The reason for that is that the Möbius transform has a nice inversion relation relatively easy to compute and differentiate (of course with appropriate constants) and also the square root of the nasty quadratic function can be rewriten in a such way to appear in that fraction form of rational linears : $$\sqrt{(r-a)(b-r)}=\sqrt{\frac{r-a}{b-r}}(b-r)$$ This choice of substitution transforms the given integral into : $$I = 2(b-a)^2\int_0^\infty \frac{t^2}{(bt^2+a)(1+t^2)^2} \mathrm{d}t$$ This integral can be computed using partial fraction decomposition - all with elimination of using the complex methods, which can be tricky and somehow difficult to accomplish sometimes. Howewer, this integrad is symetric in a $t$ variable, so the range can be extended to minus infinity and then using the residue theorem the integral can be done extremely quickly using the semi-infinity circular contour in the upper half plane (recognising the double pole at $i$ and at $i\sqrt{a/b}$) : the honoration of combination of real and complex methods.

Albeit in fact the substitution given above is precisely one of three Euler substitutions (the third one according to Wikipedia).

-
It should be noted that your proposed substitution is exactly the same as the third method from my answer. So, not surprisingly, the partial fraction decomposition of your $t$-integral is essentially in the last equation of my answer. – Igor Khavkine May 16 '15 at 21:01
I apologize for not mentioning that, althought my attempt was made independently of your solution, I do have known your substitution would lead to the exactly same integral, however this "answer" was the first one of mine on this site and in the rules i have read in answers : "avoid responding to other answers ...", so I thought it would not be necessary to write there this connection – Machinato May 19 '15 at 17:55

The fact that the integral is proportional to the difference of the arithmetic and geometric means can be established in the following way, without calculating any integral. Let consider $\alpha=\frac{a+b}{2}$ and $\beta=\sqrt{ab}$ as independent variables. Then for the integral $$I(\alpha,\beta)=\int\limits_a^b \frac{\sqrt{(r-a)(b-r)}}{r}\,dr= \int\limits_a^b \frac{\sqrt{2r\alpha-r^2-\beta^2}}{r}\,dr,$$ we have $$\frac{\partial I}{\partial \alpha}=\int\limits_a^b \frac{dr}{\sqrt{2r\alpha-r^2-\beta^2}}=\int\limits_a^b \frac{dr}{\sqrt{(r-a)(b-r)}}.$$ Note that this last integral does not depend on $a$ and $b$. Indeed, if we make a substitution $$x=\frac{r-a}{b-a},$$ we get $$\int\limits_a^b \frac{dr}{\sqrt{(r-a)(b-r)}}=\int\limits_0^1\frac{dx}{\sqrt{x(1-x)}}.$$ On the other hand, $$\frac{\partial I}{\partial \beta}=-\int\limits_a^b \frac{\beta}{r\sqrt{2r\alpha-r^2-\beta^2}}\,dr=-\int\limits_a^b \frac{\sqrt{ab}}{r\sqrt{(r-a)(b-r)}}\,dr.$$ After substituting $$r=\frac{ab}{s}$$ in the last integral, we get $$\frac{\partial I}{\partial \beta}=-\int\limits_a^b \frac{\sqrt{ab}}{\sqrt{(ab-as)(bs-ab)}}\,ds=-\int\limits_a^b \frac{ds}{\sqrt{(b-s)(s-a)}}=-\frac{\partial I}{\partial \alpha} \tag{1}$$ Equation (1), combined with the fact, that for $\alpha=\beta=a$ (that is for $a=b$) the integral $I(a,a)=0$, implies that $$I(\alpha,\beta)=J(\alpha-\beta),$$ where $$J=\int\limits_a^b \frac{dr}{\sqrt{(r-a)(b-r)}}=\int\limits_0^1\frac{dx}{\sqrt{x(1-x)}}.$$

To complete the calculation, we need just to calculate $J$. This is done by the Euler substitution $$\sqrt{(r-a)(b-r)}=t(r-a)$$ which gives $$J=\int\limits_a^b \frac{dr}{\sqrt{(r-a)(b-r)}}=2\int\limits_0^\infty\frac{dt}{1+t^2}=\pi.$$ Even a simpler option is to use the substitution $x=\sin^2\varphi$: $$J=\int\limits_0^1\frac{dx}{\sqrt{x(1-x)}}=2\int\limits_0^{\pi/2}d\varphi=\pi.$$

-