\(\int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx\) [496]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 16, antiderivative size = 33 \[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\frac {\arctan \left (\frac {\sqrt {a+c} \tan (x)}{\sqrt {a+b}}\right )}{\sqrt {a+b} \sqrt {a+c}} \]

[Out]

arctan((a+c)^(1/2)*tan(x)/(a+b)^(1/2))/(a+b)^(1/2)/(a+c)^(1/2)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.062, Rules used = {211} \[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\frac {\arctan \left (\frac {\sqrt {a+c} \tan (x)}{\sqrt {a+b}}\right )}{\sqrt {a+b} \sqrt {a+c}} \]

[In]

Int[(a + b*Cos[x]^2 + c*Sin[x]^2)^(-1),x]

[Out]

ArcTan[(Sqrt[a + c]*Tan[x])/Sqrt[a + b]]/(Sqrt[a + b]*Sqrt[a + c])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1}{a+b+(a+c) x^2} \, dx,x,\tan (x)\right ) \\ & = \frac {\arctan \left (\frac {\sqrt {a+c} \tan (x)}{\sqrt {a+b}}\right )}{\sqrt {a+b} \sqrt {a+c}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00 \[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\frac {\arctan \left (\frac {\sqrt {a+c} \tan (x)}{\sqrt {a+b}}\right )}{\sqrt {a+b} \sqrt {a+c}} \]

[In]

Integrate[(a + b*Cos[x]^2 + c*Sin[x]^2)^(-1),x]

[Out]

ArcTan[(Sqrt[a + c]*Tan[x])/Sqrt[a + b]]/(Sqrt[a + b]*Sqrt[a + c])

Maple [A] (verified)

Time = 0.60 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.82

method result size
default \(\frac {\arctan \left (\frac {\left (a +c \right ) \tan \left (x \right )}{\sqrt {\left (a +b \right ) \left (a +c \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a +c \right )}}\) \(27\)
risch \(-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b +2 i a c +2 i c b +2 a \sqrt {-a^{2}-a b -a c -c b}+b \sqrt {-a^{2}-a b -a c -c b}+c \sqrt {-a^{2}-a b -a c -c b}}{\sqrt {-a^{2}-a b -a c -c b}\, \left (b -c \right )}\right )}{2 \sqrt {-a^{2}-a b -a c -c b}}+\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {2 i a^{2}+2 i a b +2 i a c +2 i c b -2 a \sqrt {-a^{2}-a b -a c -c b}-b \sqrt {-a^{2}-a b -a c -c b}-c \sqrt {-a^{2}-a b -a c -c b}}{\sqrt {-a^{2}-a b -a c -c b}\, \left (b -c \right )}\right )}{2 \sqrt {-a^{2}-a b -a c -c b}}\) \(297\)

[In]

int(1/(a+b*cos(x)^2+c*sin(x)^2),x,method=_RETURNVERBOSE)

[Out]

1/((a+b)*(a+c))^(1/2)*arctan((a+c)*tan(x)/((a+b)*(a+c))^(1/2))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 59 vs. \(2 (25) = 50\).

Time = 0.28 (sec) , antiderivative size = 259, normalized size of antiderivative = 7.85 \[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\left [-\frac {\sqrt {-a^{2} - a b - {\left (a + b\right )} c} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2} + 2 \, {\left (4 \, a + 3 \, b\right )} c + c^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 3 \, a b + {\left (5 \, a + 3 \, b\right )} c + c^{2}\right )} \cos \left (x\right )^{2} + 4 \, {\left ({\left (2 \, a + b + c\right )} \cos \left (x\right )^{3} - {\left (a + c\right )} \cos \left (x\right )\right )} \sqrt {-a^{2} - a b - {\left (a + b\right )} c} \sin \left (x\right ) + a^{2} + 2 \, a c + c^{2}}{{\left (b^{2} - 2 \, b c + c^{2}\right )} \cos \left (x\right )^{4} + 2 \, {\left (a b - {\left (a - b\right )} c - c^{2}\right )} \cos \left (x\right )^{2} + a^{2} + 2 \, a c + c^{2}}\right )}{4 \, {\left (a^{2} + a b + {\left (a + b\right )} c\right )}}, -\frac {\arctan \left (\frac {{\left (2 \, a + b + c\right )} \cos \left (x\right )^{2} - a - c}{2 \, \sqrt {a^{2} + a b + {\left (a + b\right )} c} \cos \left (x\right ) \sin \left (x\right )}\right )}{2 \, \sqrt {a^{2} + a b + {\left (a + b\right )} c}}\right ] \]

[In]

integrate(1/(a+b*cos(x)^2+c*sin(x)^2),x, algorithm="fricas")

[Out]

[-1/4*sqrt(-a^2 - a*b - (a + b)*c)*log(((8*a^2 + 8*a*b + b^2 + 2*(4*a + 3*b)*c + c^2)*cos(x)^4 - 2*(4*a^2 + 3*
a*b + (5*a + 3*b)*c + c^2)*cos(x)^2 + 4*((2*a + b + c)*cos(x)^3 - (a + c)*cos(x))*sqrt(-a^2 - a*b - (a + b)*c)
*sin(x) + a^2 + 2*a*c + c^2)/((b^2 - 2*b*c + c^2)*cos(x)^4 + 2*(a*b - (a - b)*c - c^2)*cos(x)^2 + a^2 + 2*a*c
+ c^2))/(a^2 + a*b + (a + b)*c), -1/2*arctan(1/2*((2*a + b + c)*cos(x)^2 - a - c)/(sqrt(a^2 + a*b + (a + b)*c)
*cos(x)*sin(x)))/sqrt(a^2 + a*b + (a + b)*c)]

Sympy [F]

\[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\int \frac {1}{a + b \cos ^{2}{\left (x \right )} + c \sin ^{2}{\left (x \right )}}\, dx \]

[In]

integrate(1/(a+b*cos(x)**2+c*sin(x)**2),x)

[Out]

Integral(1/(a + b*cos(x)**2 + c*sin(x)**2), x)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.79 \[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\frac {\arctan \left (\frac {{\left (a + c\right )} \tan \left (x\right )}{\sqrt {{\left (a + b\right )} {\left (a + c\right )}}}\right )}{\sqrt {{\left (a + b\right )} {\left (a + c\right )}}} \]

[In]

integrate(1/(a+b*cos(x)^2+c*sin(x)^2),x, algorithm="maxima")

[Out]

arctan((a + c)*tan(x)/sqrt((a + b)*(a + c)))/sqrt((a + b)*(a + c))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 61 vs. \(2 (25) = 50\).

Time = 0.26 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.85 \[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\frac {\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a + 2 \, c\right ) + \arctan \left (\frac {a \tan \left (x\right ) + c \tan \left (x\right )}{\sqrt {a^{2} + a b + a c + b c}}\right )}{\sqrt {a^{2} + a b + a c + b c}} \]

[In]

integrate(1/(a+b*cos(x)^2+c*sin(x)^2),x, algorithm="giac")

[Out]

(pi*floor(x/pi + 1/2)*sgn(2*a + 2*c) + arctan((a*tan(x) + c*tan(x))/sqrt(a^2 + a*b + a*c + b*c)))/sqrt(a^2 + a
*b + a*c + b*c)

Mupad [B] (verification not implemented)

Time = 27.19 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.30 \[ \int \frac {1}{a+b \cos ^2(x)+c \sin ^2(x)} \, dx=\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (x\right )\,\left (2\,a+2\,c\right )}{2\,\sqrt {a\,b+a\,c+b\,c+a^2}}\right )}{\sqrt {a\,b+a\,c+b\,c+a^2}} \]

[In]

int(1/(a + c*sin(x)^2 + b*cos(x)^2),x)

[Out]

atan((tan(x)*(2*a + 2*c))/(2*(a*b + a*c + b*c + a^2)^(1/2)))/(a*b + a*c + b*c + a^2)^(1/2)