Optimal. Leaf size=37 \[ \frac {2 \tan ^{-1}\left (\frac {\sqrt {1-a} \tan \left (\frac {x}{2}\right )}{\sqrt {a+1}}\right )}{\sqrt {1-a^2}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.02, antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {2659, 205} \[ \frac {2 \tan ^{-1}\left (\frac {\sqrt {1-a} \tan \left (\frac {x}{2}\right )}{\sqrt {a+1}}\right )}{\sqrt {1-a^2}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 205
Rule 2659
Rubi steps
\begin {align*} \int \frac {1}{1+a \cos (x)} \, dx &=2 \operatorname {Subst}\left (\int \frac {1}{1+a+(1-a) x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )\\ &=\frac {2 \tan ^{-1}\left (\frac {\sqrt {1-a} \tan \left (\frac {x}{2}\right )}{\sqrt {1+a}}\right )}{\sqrt {1-a^2}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.03, size = 31, normalized size = 0.84 \[ \frac {2 \tanh ^{-1}\left (\frac {(a-1) \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-1}}\right )}{\sqrt {a^2-1}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.46, size = 111, normalized size = 3.00 \[ \left [\frac {\log \left (-\frac {{\left (a^{2} - 2\right )} \cos \relax (x)^{2} - 2 \, \sqrt {a^{2} - 1} {\left (a + \cos \relax (x)\right )} \sin \relax (x) - 2 \, a^{2} - 2 \, a \cos \relax (x) + 1}{a^{2} \cos \relax (x)^{2} + 2 \, a \cos \relax (x) + 1}\right )}{2 \, \sqrt {a^{2} - 1}}, -\frac {\sqrt {-a^{2} + 1} \arctan \left (\frac {\sqrt {-a^{2} + 1} {\left (a + \cos \relax (x)\right )}}{{\left (a^{2} - 1\right )} \sin \relax (x)}\right )}{a^{2} - 1}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.01, size = 53, normalized size = 1.43 \[ -\frac {2 \, {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, x\right ) - \tan \left (\frac {1}{2} \, x\right )}{\sqrt {-a^{2} + 1}}\right )\right )}}{\sqrt {-a^{2} + 1}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.02, size = 30, normalized size = 0.81 \[ \frac {2 \arctanh \left (\frac {\left (a -1\right ) \tan \left (\frac {x}{2}\right )}{\sqrt {\left (a +1\right ) \left (a -1\right )}}\right )}{\sqrt {\left (a +1\right ) \left (a -1\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.32, size = 28, normalized size = 0.76 \[ \frac {2\,\mathrm {atanh}\left (\frac {\mathrm {tan}\left (\frac {x}{2}\right )\,\sqrt {a-1}}{\sqrt {a+1}}\right )}{\sqrt {a-1}\,\sqrt {a+1}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 3.19, size = 110, normalized size = 2.97 \[ \begin {cases} \tan {\left (\frac {x}{2} \right )} & \text {for}\: a = 1 \\- \frac {1}{\tan {\left (\frac {x}{2} \right )}} & \text {for}\: a = -1 \\- \frac {\log {\left (- \sqrt {\frac {a}{a - 1} + \frac {1}{a - 1}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a \sqrt {\frac {a}{a - 1} + \frac {1}{a - 1}} - \sqrt {\frac {a}{a - 1} + \frac {1}{a - 1}}} + \frac {\log {\left (\sqrt {\frac {a}{a - 1} + \frac {1}{a - 1}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a \sqrt {\frac {a}{a - 1} + \frac {1}{a - 1}} - \sqrt {\frac {a}{a - 1} + \frac {1}{a - 1}}} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________