1
$\begingroup$

There is a similar post: How to specify the domain of a variable?, but it doesn't work well for me.

I want to evaluate the integral below, with a parameter $\gamma$. The result is obviously different depending on $\gamma>1/2$ or $\gamma<1/2$. I tried the "AddAssumption" method in that post, but it doesn't work out. It gives the result for $\gamma<1/2$ either way.

$Assumptions = True
AddAssumption[assumption_] := $Assumptions = DeleteDuplicates[$Assumptions && assumption]
AddAssumption[\[Gamma] > 1/2]
Integrate[1/(\[Gamma] + 1/2 Cos[2 \[Phi]]), \[Phi]]
$\endgroup$
14
  • 1
    $\begingroup$ The claim "The result is obviously different depending on $ \gamma>1/2$ or $\gamma<1/2$" does not correspond to Integrate[1/(\[Gamma] + 1/2 Cos[2 \[Phi]]), \[Phi]] which produces a generic answer $$-\frac{2 \tanh ^{-1}\left(\frac{(2 \gamma -1) \tan (\phi )}{\sqrt{1-4 \gamma ^2}}\right)}{\sqrt{1-4 \gamma ^2}}$$ $\endgroup$
    – user64494
    Oct 23 at 15:43
  • $\begingroup$ I don't agree. $\gamma>1/2$ obviously gives a complex number for the denominator. Are you arguing that the result is generic in the sense we do a series of complex analysis? $\endgroup$
    – Apocalypse
    Oct 23 at 15:44
  • $\begingroup$ Simplify[D[-((2 ArcTanh[((-1 + 2 \[Gamma]) Tan[\[Phi]])/ Sqrt[1 - 4 \[Gamma]^2]])/Sqrt[1 - 4 \[Gamma]^2]), \[Phi]]] results in 2/(2 \[Gamma] + Cos[2 \[Phi]]). $\endgroup$
    – user64494
    Oct 23 at 15:47
  • $\begingroup$ @user64494 Try $\gamma =1$, which gives $\frac{2\arctan{\frac{\tan(\frac{x}{2})}{\sqrt{3}}}}{\sqrt{3}}$ $\endgroup$
    – Apocalypse
    Oct 23 at 15:47
  • $\begingroup$ @user64494 So you are arguing that this result is generic in the sense of complex analysis while I just want a simplied real expression. $\endgroup$
    – Apocalypse
    Oct 23 at 15:50
2
$\begingroup$

Un uncommon trick (for a mathematical expert) does it:

Integrate[1/(EulerGamma + 1/2 Cos[2 \[Phi]]), \[Phi]] /. 
     EulerGamma -> \[Gamma]

(*   (2 ArcTan[((-1 + 2 \[Gamma]) Tan[\[Phi]])/Sqrt[-1 + 4 \[Gamma]^2]])/
      Sqrt[-1 + 4 \[Gamma]^2]   *)
$\endgroup$
3
  • $\begingroup$ Both the numerator and denominator are complexvalued if RealAbs[\[Gamma]] < 1/2. All you derive by this incorrect trick is ArcTan instead of ArcTanh. $\endgroup$
    – user64494
    Oct 23 at 17:51
  • $\begingroup$ @user64494 , You know very well that this is only intented and valid for RealAbs[gamma] greater than 1/2 because EulerGamma >1/2 and it is absolutely correct for this case (you can further test with Reduce or else, so the trick can be validated.). So please save your comments if you don't have a better solution. Thanks for the -1, if from you!? $\endgroup$
    – Akku14
    Oct 23 at 20:21
  • $\begingroup$ I made the observation, that this trick with definite numbers works in more than a few cases. ------------------Let me give a general statement:-----------------This mehtod works and can only work, if and because MMA already knows the underlying rules to solve it. I think, for undefined parameters, it has problems with the test routines for validity ranges, mainly for parameter values up to infinity.------------------------------ Of course, if you got a result, you have to test for validity ranges with other methods, means you have in parts do the job MMA does not in that case. $\endgroup$
    – Akku14
    Oct 23 at 20:56
5
$\begingroup$

It is indeed possible to get a real antiderivative, but you need to use the Rubi package (easy to install).

<< Rubi`

Now we consider 3 cases

Assuming[γ>1/2,Int[1/(γ+1/2 Cos[2 ϕ]),ϕ]]

$$\frac{2 \tan ^{-1}\left(\sqrt{-\frac{1-2 \gamma }{2 \gamma +1}} \tan (\phi )\right)}{\sqrt{4 \gamma ^2-1}}$$

Assuming[-1/2<γ<1/2,Int[1/(γ+1/2 Cos[2 ϕ]),ϕ]]

$$\frac{2 \tanh ^{-1}\left(\sqrt{\frac{1-2 \gamma }{2 \gamma +1}} \tan (\phi )\right)}{\sqrt{1-4 \gamma ^2}}$$

Assuming[γ<-1/2,Int[1/(γ+1/2 Cos[2 ϕ]),ϕ]]

$$\frac{2 \sqrt{-\frac{2 \gamma +1}{1-2 \gamma }} \tan ^{-1}\left(\sqrt{-\frac{1-2 \gamma }{2 \gamma +1}} \tan (\phi )\right)}{2 \gamma +1}$$

$\endgroup$
1
  • $\begingroup$ Very nice packages! Thanks for sharing! $\endgroup$
    – Apocalypse
    Oct 24 at 4:56
0
$\begingroup$

I will answer my own question. The result is this ugly monster $$\frac{\frac{2 \tan ^{-1}\left(\frac{\sqrt{4 \gamma +2} \tan \left(\frac{\phi }{2}\right)+2}{\sqrt{4 \gamma -2}}\right)}{\sqrt{\gamma -\frac{1}{2}}}-\frac{2 \tan ^{-1}\left(\frac{2-\sqrt{4 \gamma +2} \tan \left(\frac{\phi }{2}\right)}{\sqrt{4 \gamma -2}}\right)}{\sqrt{\gamma -\frac{1}{2}}}}{2 \sqrt{\gamma +\frac{1}{2}}}$$ and Mathematica just tries to simplify it (by introducing complex quantities).

Originally I thought there should be a nice real expression, as in the case of $\gamma=1$, but Mathematica kept giving me a "complex" result. It turns out now, as we see the expression is horrible if we put it into real numbers by force, that Mathematica is really trying to get the answer as simple as possible by making it complex.


An update on the result. The expression above could be simplified significantly (to get the one in other answers). The best way to integrate this thing is through the following trig-substitution $$\int\frac{1}{\gamma+\frac{1}{2}\cos2\phi}d\phi=\int\frac{\sec^2\phi}{1+(\gamma-\frac{1}{2})\sec^2\phi}d\phi=\int\frac{d(\tan\phi)}{1+(\gamma-\frac{1}{2})(1+\tan^2\phi)}$$

I chose a much more stupid way when I evaluated for the first time and ended up with the monstrous result above.

$\endgroup$
2
  • 2
    $\begingroup$ Your answer is incomplete as the domain is not specified. Please see my answer $\endgroup$
    – yarchik
    Oct 23 at 18:29
  • $\begingroup$ @yarchik My answer is intended for the $\gamma>1/2$ case, which is also the one I need. $\endgroup$
    – Apocalypse
    Oct 24 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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