# How to calculate $\int \sqrt{(\cos{x})^2-a^2} \, dx$

How to calculate: $$\int \sqrt{(\cos{x})^2-a^2} \, dx$$

-
This seems distinctly nontrivial - I get elliptic integrals. I doubt it is expressible in elementary functions. Where did it come from? I can do 1 instead of $a^2$ though, pretty easily. That good enough? –  mixedmath Jun 27 '11 at 17:38
I'm trying to find the probability that two cars be in reach after time $\tau$ .. I assumed a model and I'm stuck with that –  Osama Gamal Jun 27 '11 at 17:39
Do you want the indefinite integral or do you need actually a certain definite integral? (very often in applications one need to integral from a point where the argument of the $\sqrt{\cdot}$ is zero to another point with these properties) –  Fabian Jun 27 '11 at 17:42
Is a bounded by anything? –  mixedmath Jun 27 '11 at 17:44
Further - from this integral, how will you determine the probability? As this will likely have an imaginary component, will you just mod the answer? –  mixedmath Jun 27 '11 at 17:48

$$\int\sqrt{\cos^2 x-a^2}\;dx =\frac{1}{k} \int \sqrt{1-k^2\sin^2x}\;dx$$ where $k=\frac{1}{\sqrt{1-a^2}}$ As this seems to come from a physical problem, introduce limits and look into elliptic integrals of the second kind.

-
Does it makes a difference if the integral is $\int_a^b{\int_0^{2\pi}{\sqrt{y^2(\cos^2{\theta}-1)+1}}\mathrm{d}\theta}\mathrm{‌​d}y$? I thought I can start with the inner integral and simplify it to what I wrote. But, I don't want to do the elliptic integral thing! –  Osama Gamal Jun 29 '11 at 14:00

In SWP (Scientific WorkPlace), with Local MAPLE kernel, I got the following evaluation

$$\begin{eqnarray*} I &:&=\int \sqrt{\cos ^{2}x-a^{2}}dx \\ &=&-\frac{\sqrt{\sin ^{2}x}}{\sin x}a^{2}\text{EllipticF}\left( \left( \cos x\right) \frac{\text{csgn}\left( a^{\ast }\right) }{a},\text{csgn}\left( a\right) a\right) \\ &&-\text{EllipticF}\left( \left( \cos x\right) \frac{\text{csgn}\left( a^{\ast }\right) }{a},\text{csgn}\left( a\right) a\right) \\ &&+\text{EllipticE}\left( \left( \cos x\right) \frac{\text{csgn}\left( a^{\ast }\right) }{a},\text{csgn}\left( a\right) a\right) F \end{eqnarray*}$$

where

$$F=\sqrt{\frac{-\cos ^{2}x+a^{2}}{a^{2}}}\sqrt{\cos ^{2}x-a^{2}}\text{csgn}\left( a^{\ast }\right) \frac{a}{-\cos ^{2}x+a^{2}}$$

As an example:

$$\begin{eqnarray*} \int \sqrt{\cos ^{2}x-2^{2}}dx &=&\frac{\sqrt{\sin ^{2}x}}{\sin x}3\text{EllipticF}\left( \frac{1}{2}\cos x,2\right) \\ &&+\text{EllipticE}\left( \frac{1}{2}\cos x,2\right) \frac{\sqrt{-\cos ^{2}x+4}}{\sqrt{\cos ^{2}x-4}} \end{eqnarray*}$$

-
Do you know how to evaluate it in Matlab? It will really help me. –  Osama Gamal Jun 29 '11 at 14:06
@Osama Gamal: No, I don't. I have no Matlab intalled and has never worked with it. –  Américo Tavares Jun 29 '11 at 15:41
@OsamaGamal You should just be able to type lookfor elliptic and find something that estimates them. I'd be very surprised if MATLAB didn't have something for that. –  John Moeller May 16 '13 at 21:44
@OsamaGamal In fact, here it is –  John Moeller May 16 '13 at 22:03