Mathematica is having issues with the following code:

AreaH = Integrate[Integrate[\[Sqrt](a*Sin[\[Theta]]^2 - J^2*Sin[\[Theta]]^4), {\[Theta], 0, \[Pi]}], {\[Phi], 0, 2*\[Pi]}]
SEn = AreaH/4;
Plot[SEn, {J, 0, 100}]

It is stuck attempting to do the integral and so doesn't output the solution. How can I re-code this to actually make it produce the solutions I want?

  • $\begingroup$ Edit - I simplified it down significantly to just the integral $\endgroup$
    – Sophia
    Commented Apr 29, 2021 at 18:51
  • $\begingroup$ If the integrand does not depend on $\phi$ this is a line-integral. = 2 \[Pi] Integrate[\[Sqrt](a*Sin[\[Theta]]^2 - J^2*Sin[\[Theta]]^4), {\[Theta], 0, \[Pi]}] $\endgroup$
    – A.G.
    Commented Apr 29, 2021 at 22:10

1 Answer 1


If a and J are real and positive, then this gives a partial result:

Integrate[√(a*Sin[θ]^2 - J^2*Sin[θ]^4),
  {θ, 0, π}, {ϕ, 0, 2*π},
  Assumptions -> a > 0 && J > 0]
   2*Pi*(Sqrt[a] + (a/J - J)*
          ArcCosh[Sqrt[a/(a - J^2)]]), a > J^2]
  • $\begingroup$ I also did get this eventually, but only after my Notebook spent a solid 5 mins computing it. Why is this so slow? $\endgroup$
    – Sophia
    Commented Apr 29, 2021 at 19:02
  • $\begingroup$ @Sophia It takes my MacBook Pro only 13 sec. It takes some time to analyze singularities that depend on parameters (on a and J in this case). I'm not sure what yours takes so much longer than mine. It could be a version difference. I'm using V12.2. $\endgroup$
    – Michael E2
    Commented Apr 29, 2021 at 19:13
  • $\begingroup$ This is two seconds faster: Integrate[\[Sqrt](a*Sin[\[Theta]]^2 - J^2*Sin[\[Theta]]^4), {\[Theta], 0, Pi/2, \[Pi]}, {\[Phi], 0, 2*\[Pi]}, Assumptions -> a > 0 && J > 0 && a > J^2] $\endgroup$
    – Michael E2
    Commented Apr 29, 2021 at 19:13
  • $\begingroup$ Really odd. I have a custom built computer that I know has really good specs. I wonder if it being throttled for some reason. I will try the second version you posted too! Thank you! $\endgroup$
    – Sophia
    Commented Apr 29, 2021 at 19:55

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.