2
$\begingroup$

Mathematica isn't evaluating this integral and I'm wondering if there's a bug in how I'm asking:

the function I want to integrate is

$$f(\theta) = \cos^2(\theta)\sqrt{A \cos^2{\theta} + B \sin^2{\theta} + m^2} $$

And I want to do

$$\int\limits_0^{2\pi} d\theta f(\theta)$$

I'm asking Mathematica to

f = Cos[th]^2 Sqrt[A Cos[th]^2 + B Sin[th]^2 + m^2]

Integrate[f,{th,0,2Pi}, Assumptions->{Element[A,Reals], Element[B,Reals], Element[m,Reals]}] 

and not getting an output, though the indefinite integral spits out something cumbersome. Any ideas?

$\endgroup$
1
  • 2
    $\begingroup$ Please give a complete example as Mathematica code next time (including how you defined f) $\endgroup$
    – Szabolcs
    Commented Mar 12, 2019 at 18:24

3 Answers 3

3
$\begingroup$

Decreasing powers and making an assumption to deal with the reals , one obtains

Integrate[(Cos[2 \[Theta]] + 1)/2*Sqrt[a*(Cos[2 \[Theta]] + 1)/2+b*(-Cos[2 \[Theta]]+1)/2 + 
m^2], {\[Theta], 0, 2*Pi}, Assumptions -> m^2 > RealAbs[a] + RealAbs[b]]

(1/(3 (a - b)))2 (Sqrt[(a + m^2)/(b + m^2)] Sqrt[ b + m^2] ((2 a - b + m^2) EllipticE[(a - b)/( a + m^2)] - (b + m^2) EllipticK[(a - b)/(a + m^2)]) + Sqrt[a + m^2] Sqrt[(b + m^2)/( a + m^2)] ((2 a - b + m^2) EllipticE[(-a + b)/( b + m^2)] - (a + m^2) EllipticK[(-a + b)/(b + m^2)]))

$\endgroup$
1
  • $\begingroup$ The result is numerically confirmed for $\left\{m=\sqrt{5},a=-1,b=-2\right\} $. The answer by Bill Watts produces the same value. $\endgroup$
    – user64494
    Commented Mar 12, 2019 at 21:08
2
$\begingroup$

You can help Mathematica out a little by using a Jacobi elliptic function substitution:

(Cos[t]^2 Sqrt[A (1 - Sin[t]^2) + B Sin[t]^2 + m^2 // Simplify] /. 
 t -> JacobiAmplitude[u, (A - B)/(A + m^2)]) D[JacobiAmplitude[u, (A - B)/(A + m^2)], u]

This yields

   JacobiCN[u, (A - B)/(A + m^2)]^2 JacobiDN[u, (A - B)/(A + m^2)]
   Sqrt[A + m^2 + (-A + B) JacobiSN[u, (A - B)/(A + m^2)]^2]

which means the integral of interest is

expr = Sqrt[A + m^2] Integrate[JacobiCN[u, (A - B)/(A + m^2)]^2
                               JacobiDN[u, (A - B)/(A + m^2)]^2, u];

(expr /. u -> 4 EllipticK[(A - B)/(A + m^2)]) - (expr /. u -> 0) /. 
EllipticE[JacobiAmplitude[4 EllipticK[m_], m_], m_] :> 4 EllipticE[m]

which yields the result

(Sqrt[A + m^2] (8 Sqrt[2] (A + m^2) (2 A - B + m^2) Sqrt[(2 A + 2 m^2)/(A + m^2)] 
 EllipticE[(A - B)/(A + m^2)] - 8 Sqrt[2] (A + m^2) (B + m^2) Sqrt[(2 A + 2 m^2)/(A + m^2)]
 EllipticK[(A - B)/(A + m^2)]))/(6 (A - B) (2 A + 2 m^2))

(Note that I have tacitly assumed A > B > 0.)

$\endgroup$
0
$\begingroup$

Plotting the function with some values for A, B, and m shows the function to be continuous from 0 to 2 π at least when the values are real. Integrate can handle the indefinite integral.

f = Cos[θ]^2 Sqrt[A Cos[θ]^2 + B Sin[θ]^2 + m^2]

F[θ_] = Integrate[f, θ]//Simplify

int = F[2 π] - F[0] // Simplify
(*(4 Sqrt[A +  m^2] ((2 A - B + m^2) EllipticE[(A - B)/( m^2 + A)] - (B + m^2) EllipticK[(A - B)/(m^2 + A)]))/(3 (A - B))*)

Maybe Integrate cannot tell if there are circumstances where the function might be discontinuous in the interval and would not commit to a definite integral result. The are undoubtedly values you could pick that make the function complex or discontinuous.

$\endgroup$
1
  • $\begingroup$ It would be useful to test the answer numerically, say for $\{m^2=\frac 1 {100}, A=-3,B=1\}$. If I am not mistaken, I obtain $-0.107351+4.2018 i$ from your formula and $0.107356\, +4.2018 i$ numerically integrating. The real parts differ in sign. $\endgroup$
    – user64494
    Commented Mar 12, 2019 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.