Integral for physics problem

1. Jun 22, 2008

Phizyk

Hi,
How can I integrate this
$$\int_{0}^{2\pi}\frac{A+Bcosx}{\sqrt{A^{2}+B^{2}+2ABcosx}}dx$$
Thanks for help.

2. Jun 22, 2008

DeaconJohn

isn't that an elliptic integral?

3. Jun 22, 2008

ice109

is it just a coincidence that the bottom is 1 sign away from being the law of cosines?

here's the soln mathematica gives me.

for some values there is an integral where E and K are the ellipticE and ellipticK fns and the funky R and E or Z or w/e it is are Real part and Imaginary Part respectively.

$$\text{If}\left[\Re\left((A-B)^2\right)>0\land \Re\left((A+B)^2\right)>0\land \left(\Re\left(\frac{A}{B}+\frac{B}{A}\right)\geq 2\lor \Re\left(\frac{A}{B}+\frac{B}{A}\right)\leq -2\lor \Im\left(\frac{A}{4 B}+\frac{B}{4 A}\right)\neq 0\right)$$
$$\frac{\sqrt{(A+B)^2} E\left(-\frac{4 A B}{(A-B)^2}\right) (A-B)^2+(A+B) \left(\sqrt{(A-B)^2} (A+B) E\left(\frac{4 A B}{(A+B)^2}\right)+(A-B) \left(\sqrt{(A+B)^2} K\left(-\frac{4 A B}{(A-B)^2}\right)+\sqrt{(A-B)^2} K\left(\frac{4 A B}{(A+B)^2}\right)\right)\right)}{A \sqrt{(A-B)^2} \sqrt{(A+B)^2}}$$

apparently for some values there is no integral

$$\text{Integrate}\left[\frac{A}{\sqrt{A^2+2 B \cos (x) A+B^2}}+\frac{B \cos (x)}{\sqrt{A^2+2 B \cos (x) A+B^2}},\{x,0,2 \pi \},\text{Assumptions}\to \left(\Im\left(\frac{A}{4 B}+\frac{B}{4 A}\right)=$$
$$0\land -2<\Re\left(\frac{A}{B}+\frac{B}{A}\right)<2\right)\lor \Re\left((A-B)^2\right)\leq 0\lor \Re\left((A+B)^2\right)\leq 0\right]\right]$$

Last edited: Jun 22, 2008
4. Jun 22, 2008

DeaconJohn

Probably not. Elliptic integrals often arise in applied problems where one has to integrate an inner product in the denominator. Inner products are equal to cosines.

And again, from another viewpoint, about the sign. The whole function under the integrand is periodic w. period 2pi. Add pi to x and the cosine changes sign. Of course one then integrates from pi to 3pi instead of from 0 to 2pi or whatever.

Deacon John

5. Jun 23, 2008

Phizyk

I used to function calculator and I received:
$$\int{\frac{A+Bcosx}{\sqrt{A^{2}+B^{2}+2ABcosx}}}=\frac{(B^{4}-4AB^{3}+4A^{2}B^{2})x^{5}}{5(24B^{4}+96AB^{3}+144A^{2}B^{2}+96A^{3}B+24A^{4})}-\frac{B^{2}x^{3}}{3(2B^{2}+4AB+2A^{2})}+x+O(x^{7})+C$$
I think what I can neglect $$O(x^{7})$$... Is it correct?

6. Jun 23, 2008

DeaconJohn

Phizyk.
Thanks for your fascinating formula. I have no way to verify it's correctness quickly. You are correct that you can neglect O(x^7), when x is small, of course. How small? Well, at least x < 1/2, but it really depends on the value of A and B and the application. Unfortunately the constant involved in the O is not given. If it is large, x has to be smaller.
The numberator in the first term is O(x^8). The numerator in the second term is O(x^3). For A and B less than one and x small, one would expect the second erm to dominate. For A and B greater than two, the first term is likely to dominate if x is not too small, say for x greater than .1. However, as x gets smaller, say x< .001, the second term can be expected to dominate for single digit values of A and B. This line of reasoning says that there is a real danger that the constant in O(x^7) is a real concern. More specifically, the constant in O(x^7) can expected to be within an order of magnitude of the constant in the first two terms. That is because this is probably a rational function approximation (see Abrahamowitz and Stegen) or something like that and that is how they work.

A remark for beginners: the constant C at the end is just the constant of integration.

Deacon John

7. Jun 23, 2008

Phizyk

So, we can not integrate this... But if A=B, we have
$$\int{\frac{cos^{2}\frac{x}{2}}{|cos\frac{x}{2}|}}dx$$
and it can be simple integrate...

8. Jun 23, 2008

tiny-tim

No coincidence … it's a very simple geometric problem …

Draw a circle of radius A, centre at the origin O = (0,0).

Define P = (-B,0).

Then, for any point Q on the circle, if θ is the angle between OQ and the x-axis, and φ is the angle between PQ and the x-axis,

the integral is ∫cosφ dθ.

(and if A = B, then φ = θ/2)

9. Jun 23, 2008

DeaconJohn

Very nice. Thanks.

10. Jun 23, 2008

Phizyk

This is a brilliant solution. Thanks for all...