3.212 \(\int \frac{a+b \cos ^2(x)}{c+c \sin ^2(x)} \, dx\)

Optimal. Leaf size=56 \[ \frac{x (a+2 b)}{\sqrt{2} c}+\frac{(a+2 b) \tan ^{-1}\left (\frac{\sin (x) \cos (x)}{\sin ^2(x)+\sqrt{2}+1}\right )}{\sqrt{2} c}-\frac{b x}{c} \]

[Out]

-((b*x)/c) + ((a + 2*b)*x)/(Sqrt[2]*c) + ((a + 2*b)*ArcTan[(Cos[x]*Sin[x])/(1 + Sqrt[2] + Sin[x]^2)])/(Sqrt[2]
*c)

________________________________________________________________________________________

Rubi [A]  time = 0.196645, antiderivative size = 56, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 2, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.105, Rules used = {1166, 205} \[ \frac{x (a+2 b)}{\sqrt{2} c}+\frac{(a+2 b) \tan ^{-1}\left (\frac{\sin (x) \cos (x)}{\sin ^2(x)+\sqrt{2}+1}\right )}{\sqrt{2} c}-\frac{b x}{c} \]

Antiderivative was successfully verified.

[In]

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

[Out]

-((b*x)/c) + ((a + 2*b)*x)/(Sqrt[2]*c) + ((a + 2*b)*ArcTan[(Cos[x]*Sin[x])/(1 + Sqrt[2] + Sin[x]^2)])/(Sqrt[2]
*c)

Rule 1166

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Di
st[e/2 + (2*c*d - b*e)/(2*q), Int[1/(b/2 - q/2 + c*x^2), x], x] + Dist[e/2 - (2*c*d - b*e)/(2*q), Int[1/(b/2 +
 q/2 + c*x^2), x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - a*e^2, 0] && PosQ[b^
2 - 4*a*c]

Rule 205

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

Rubi steps

\begin{align*} \int \frac{a+b \cos ^2(x)}{c+c \sin ^2(x)} \, dx &=\operatorname{Subst}\left (\int \frac{a+b+a x^2}{c+3 c x^2+2 c x^4} \, dx,x,\tan (x)\right )\\ &=-\left ((2 b) \operatorname{Subst}\left (\int \frac{1}{2 c+2 c x^2} \, dx,x,\tan (x)\right )\right )+(a+2 b) \operatorname{Subst}\left (\int \frac{1}{c+2 c x^2} \, dx,x,\tan (x)\right )\\ &=-\frac{b x}{c}+\frac{(a+2 b) x}{\sqrt{2} c}+\frac{(a+2 b) \tan ^{-1}\left (\frac{\cos (x) \sin (x)}{1+\sqrt{2}+\sin ^2(x)}\right )}{\sqrt{2} c}\\ \end{align*}

Mathematica [A]  time = 0.0830549, size = 31, normalized size = 0.55 \[ \frac{(a+2 b) \tan ^{-1}\left (\sqrt{2} \tan (x)\right )}{\sqrt{2} c}-\frac{b x}{c} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.038, size = 42, normalized size = 0.8 \begin{align*}{\frac{\sqrt{2}\arctan \left ( \tan \left ( x \right ) \sqrt{2} \right ) a}{2\,c}}+{\frac{\sqrt{2}\arctan \left ( \tan \left ( x \right ) \sqrt{2} \right ) b}{c}}-{\frac{b\arctan \left ( \tan \left ( x \right ) \right ) }{c}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.49939, size = 38, normalized size = 0.68 \begin{align*} \frac{\sqrt{2}{\left (a + 2 \, b\right )} \arctan \left (\sqrt{2} \tan \left (x\right )\right )}{2 \, c} - \frac{b x}{c} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.5734, size = 131, normalized size = 2.34 \begin{align*} -\frac{\sqrt{2}{\left (a + 2 \, b\right )} \arctan \left (\frac{3 \, \sqrt{2} \cos \left (x\right )^{2} - 2 \, \sqrt{2}}{4 \, \cos \left (x\right ) \sin \left (x\right )}\right ) + 4 \, b x}{4 \, c} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/4*(sqrt(2)*(a + 2*b)*arctan(1/4*(3*sqrt(2)*cos(x)^2 - 2*sqrt(2))/(cos(x)*sin(x))) + 4*b*x)/c

________________________________________________________________________________________

Sympy [B]  time = 98.6209, size = 782, normalized size = 13.96 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

12*sqrt(2)*a*(atan(tan(x/2)/sqrt(3 - 2*sqrt(2))) + pi*floor((x/2 - pi/2)/pi))/(41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)
) + 58*c*sqrt(3 - 2*sqrt(2))) + 17*a*(atan(tan(x/2)/sqrt(3 - 2*sqrt(2))) + pi*floor((x/2 - pi/2)/pi))/(41*sqrt
(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(3 - 2*sqrt(2))) + 12*sqrt(2)*a*sqrt(3 - 2*sqrt(2))*sqrt(2*sqrt(2) + 3)*(
atan(tan(x/2)/sqrt(2*sqrt(2) + 3)) + pi*floor((x/2 - pi/2)/pi))/(41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(
3 - 2*sqrt(2))) + 17*a*sqrt(3 - 2*sqrt(2))*sqrt(2*sqrt(2) + 3)*(atan(tan(x/2)/sqrt(2*sqrt(2) + 3)) + pi*floor(
(x/2 - pi/2)/pi))/(41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(3 - 2*sqrt(2))) - 58*b*x*sqrt(3 - 2*sqrt(2))/(
41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(3 - 2*sqrt(2))) - 41*sqrt(2)*b*x*sqrt(3 - 2*sqrt(2))/(41*sqrt(2)*
c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(3 - 2*sqrt(2))) + 24*sqrt(2)*b*(atan(tan(x/2)/sqrt(3 - 2*sqrt(2))) + pi*floo
r((x/2 - pi/2)/pi))/(41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(3 - 2*sqrt(2))) + 34*b*(atan(tan(x/2)/sqrt(3
 - 2*sqrt(2))) + pi*floor((x/2 - pi/2)/pi))/(41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(3 - 2*sqrt(2))) + 24
*sqrt(2)*b*sqrt(3 - 2*sqrt(2))*sqrt(2*sqrt(2) + 3)*(atan(tan(x/2)/sqrt(2*sqrt(2) + 3)) + pi*floor((x/2 - pi/2)
/pi))/(41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c*sqrt(3 - 2*sqrt(2))) + 34*b*sqrt(3 - 2*sqrt(2))*sqrt(2*sqrt(2)
+ 3)*(atan(tan(x/2)/sqrt(2*sqrt(2) + 3)) + pi*floor((x/2 - pi/2)/pi))/(41*sqrt(2)*c*sqrt(3 - 2*sqrt(2)) + 58*c
*sqrt(3 - 2*sqrt(2)))

________________________________________________________________________________________

Giac [A]  time = 1.15276, size = 84, normalized size = 1.5 \begin{align*} \frac{\sqrt{2}{\left (a + 2 \, b\right )}{\left (x + \arctan \left (-\frac{\sqrt{2} \sin \left (2 \, x\right ) - 2 \, \sin \left (2 \, x\right )}{\sqrt{2} \cos \left (2 \, x\right ) + \sqrt{2} - 2 \, \cos \left (2 \, x\right ) + 2}\right )\right )}}{2 \, c} - \frac{b x}{c} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*sqrt(2)*(a + 2*b)*(x + arctan(-(sqrt(2)*sin(2*x) - 2*sin(2*x))/(sqrt(2)*cos(2*x) + sqrt(2) - 2*cos(2*x) +
2)))/c - b*x/c