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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.149867, antiderivative size = 49, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.158, Rules used = {522, 203, 205} \[ \frac{(a d+b (c+d)) \tan ^{-1}\left (\frac{\sqrt{c} \tan (x)}{\sqrt{c+d}}\right )}{\sqrt{c} d \sqrt{c+d}}-\frac{b x}{d} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 203

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

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 \sin ^2(x)}{c+d \cos ^2(x)} \, dx &=\operatorname{Subst}\left (\int \frac{a+(a+b) x^2}{\left (1+x^2\right ) \left (c+d+c x^2\right )} \, dx,x,\tan (x)\right )\\ &=-\frac{b \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (x)\right )}{d}+\frac{(a d+b (c+d)) \operatorname{Subst}\left (\int \frac{1}{c+d+c x^2} \, dx,x,\tan (x)\right )}{d}\\ &=-\frac{b x}{d}+\frac{(a d+b (c+d)) \tan ^{-1}\left (\frac{\sqrt{c} \tan (x)}{\sqrt{c+d}}\right )}{\sqrt{c} d \sqrt{c+d}}\\ \end{align*}

Mathematica [A]  time = 0.159684, size = 47, normalized size = 0.96 \[ \frac{\frac{(a d+b (c+d)) \tan ^{-1}\left (\frac{\sqrt{c} \tan (x)}{\sqrt{c+d}}\right )}{\sqrt{c} \sqrt{c+d}}-b x}{d} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.038, size = 78, normalized size = 1.6 \begin{align*}{a\arctan \left ({\tan \left ( x \right ) c{\frac{1}{\sqrt{ \left ( c+d \right ) c}}}} \right ){\frac{1}{\sqrt{ \left ( c+d \right ) c}}}}+{\frac{cb}{d}\arctan \left ({\tan \left ( x \right ) c{\frac{1}{\sqrt{ \left ( c+d \right ) c}}}} \right ){\frac{1}{\sqrt{ \left ( c+d \right ) c}}}}+{b\arctan \left ({\tan \left ( x \right ) c{\frac{1}{\sqrt{ \left ( c+d \right ) c}}}} \right ){\frac{1}{\sqrt{ \left ( c+d \right ) c}}}}-{\frac{b\arctan \left ( \tan \left ( x \right ) \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.87929, size = 547, normalized size = 11.16 \begin{align*} \left [-\frac{{\left (b c +{\left (a + b\right )} d\right )} \sqrt{-c^{2} - c d} \log \left (\frac{{\left (8 \, c^{2} + 8 \, c d + d^{2}\right )} \cos \left (x\right )^{4} - 2 \,{\left (4 \, c^{2} + 3 \, c d\right )} \cos \left (x\right )^{2} + 4 \,{\left ({\left (2 \, c + d\right )} \cos \left (x\right )^{3} - c \cos \left (x\right )\right )} \sqrt{-c^{2} - c d} \sin \left (x\right ) + c^{2}}{d^{2} \cos \left (x\right )^{4} + 2 \, c d \cos \left (x\right )^{2} + c^{2}}\right ) + 4 \,{\left (b c^{2} + b c d\right )} x}{4 \,{\left (c^{2} d + c d^{2}\right )}}, -\frac{{\left (b c +{\left (a + b\right )} d\right )} \sqrt{c^{2} + c d} \arctan \left (\frac{{\left (2 \, c + d\right )} \cos \left (x\right )^{2} - c}{2 \, \sqrt{c^{2} + c d} \cos \left (x\right ) \sin \left (x\right )}\right ) + 2 \,{\left (b c^{2} + b c d\right )} x}{2 \,{\left (c^{2} d + c d^{2}\right )}}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.14524, size = 78, normalized size = 1.59 \begin{align*} -\frac{b x}{d} + \frac{{\left (\pi \left \lfloor \frac{x}{\pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (c\right ) + \arctan \left (\frac{c \tan \left (x\right )}{\sqrt{c^{2} + c d}}\right )\right )}{\left (b c + a d + b d\right )}}{\sqrt{c^{2} + c d} d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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