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(c^(1/2)*tan(x)/(c+d)^(1/2))/d/c^(1/2)/(c+d)^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.15, antiderivative size = 49, normalized size of antiderivative = 1.00, 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 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]

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]

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.16, 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

________________________________________________________________________________________

fricas [A]  time = 0.79, size = 228, normalized size = 4.65 \[ \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 \relax (x)^{4} - 2 \, {\left (4 \, c^{2} + 3 \, c d\right )} \cos \relax (x)^{2} + 4 \, {\left ({\left (2 \, c + d\right )} \cos \relax (x)^{3} - c \cos \relax (x)\right )} \sqrt {-c^{2} - c d} \sin \relax (x) + c^{2}}{d^{2} \cos \relax (x)^{4} + 2 \, c d \cos \relax (x)^{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 \relax (x)^{2} - c}{2 \, \sqrt {c^{2} + c d} \cos \relax (x) \sin \relax (x)}\right ) + 2 \, {\left (b c^{2} + b c d\right )} x}{2 \, {\left (c^{2} d + c d^{2}\right )}}\right ] \]

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)]

________________________________________________________________________________________

giac [A]  time = 0.15, size = 58, normalized size = 1.18 \[ -\frac {b x}{d} + \frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (c) + \arctan \left (\frac {c \tan \relax (x)}{\sqrt {c^{2} + c d}}\right )\right )} {\left (b c + a d + b d\right )}}{\sqrt {c^{2} + c d} d} \]

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
)

________________________________________________________________________________________

maple [A]  time = 0.12, size = 78, normalized size = 1.59 \[ \frac {\arctan \left (\frac {c \tan \relax (x )}{\sqrt {\left (c +d \right ) c}}\right ) a}{\sqrt {\left (c +d \right ) c}}+\frac {\arctan \left (\frac {c \tan \relax (x )}{\sqrt {\left (c +d \right ) c}}\right ) c b}{d \sqrt {\left (c +d \right ) c}}+\frac {\arctan \left (\frac {c \tan \relax (x )}{\sqrt {\left (c +d \right ) c}}\right ) b}{\sqrt {\left (c +d \right ) c}}-\frac {b \arctan \left (\tan \relax (x )\right )}{d} \]

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(c*tan(x)/((c+d)*c)^(1/2))*a+1/d/((c+d)*c)^(1/2)*arctan(c*tan(x)/((c+d)*c)^(1/2))*c*b+
1/((c+d)*c)^(1/2)*arctan(c*tan(x)/((c+d)*c)^(1/2))*b-b/d*arctan(tan(x))

________________________________________________________________________________________

maxima [A]  time = 1.34, size = 40, normalized size = 0.82 \[ -\frac {b x}{d} + \frac {{\left (b c + {\left (a + b\right )} d\right )} \arctan \left (\frac {c \tan \relax (x)}{\sqrt {{\left (c + d\right )} c}}\right )}{\sqrt {{\left (c + d\right )} c} d} \]

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]

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

________________________________________________________________________________________

mupad [B]  time = 2.85, size = 1987, normalized size = 40.55 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

- (b*c^2*x)/(c*d^2 + c^2*d) - (a*d*atan((a^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + b^2*c^3*tan(x)*(- c*d - c^2)^
(3/2)*2i + b^2*c^5*tan(x)*(- c*d - c^2)^(1/2)*2i + b^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + a^2*c*d^2*tan(x)*(-
 c*d - c^2)^(3/2)*2i + a^2*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*4i + b^2
*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c^2*d*tan(x)*(- c*d - c^2)^(3/2)*5i + b^2*c^4*d*tan(x)*(- c*d - c^2
)^(1/2)*6i + a^2*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*2i + a^2*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c^2*d
^3*tan(x)*(- c*d - c^2)^(1/2)*4i + b^2*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*7i + a*b*d^3*tan(x)*(- c*d - c^2)^(3
/2)*2i + a*b*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*6i + a*b*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*2i + a*b*c^2*d*tan(x)*
(- c*d - c^2)^(3/2)*4i + a*b*c^4*d*tan(x)*(- c*d - c^2)^(1/2)*2i + a*b*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*6i +
 a*b*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*6i)/(b^2*c^5*d + a^2*c^2*d^4 + 2*a^2*c^3*d^3 + a^2*c^4*d^2 + b^2*c^2*d
^4 + 3*b^2*c^3*d^3 + 3*b^2*c^4*d^2 + 2*a*b*c^5*d + 2*a*b*c^2*d^4 + 6*a*b*c^3*d^3 + 6*a*b*c^4*d^2))*(- c*d - c^
2)^(1/2)*1i)/(c*d^2 + c^2*d) - (b*c*atan((a^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + b^2*c^3*tan(x)*(- c*d - c^2)
^(3/2)*2i + b^2*c^5*tan(x)*(- c*d - c^2)^(1/2)*2i + b^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + a^2*c*d^2*tan(x)*(
- c*d - c^2)^(3/2)*2i + a^2*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*4i + b^
2*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c^2*d*tan(x)*(- c*d - c^2)^(3/2)*5i + b^2*c^4*d*tan(x)*(- c*d - c^
2)^(1/2)*6i + a^2*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*2i + a^2*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c^2*
d^3*tan(x)*(- c*d - c^2)^(1/2)*4i + b^2*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*7i + a*b*d^3*tan(x)*(- c*d - c^2)^(
3/2)*2i + a*b*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*6i + a*b*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*2i + a*b*c^2*d*tan(x)
*(- c*d - c^2)^(3/2)*4i + a*b*c^4*d*tan(x)*(- c*d - c^2)^(1/2)*2i + a*b*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*6i
+ a*b*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*6i)/(b^2*c^5*d + a^2*c^2*d^4 + 2*a^2*c^3*d^3 + a^2*c^4*d^2 + b^2*c^2*
d^4 + 3*b^2*c^3*d^3 + 3*b^2*c^4*d^2 + 2*a*b*c^5*d + 2*a*b*c^2*d^4 + 6*a*b*c^3*d^3 + 6*a*b*c^4*d^2))*(- c*d - c
^2)^(1/2)*1i)/(c*d^2 + c^2*d) - (b*d*atan((a^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + b^2*c^3*tan(x)*(- c*d - c^2
)^(3/2)*2i + b^2*c^5*tan(x)*(- c*d - c^2)^(1/2)*2i + b^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + a^2*c*d^2*tan(x)*
(- c*d - c^2)^(3/2)*2i + a^2*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*4i + b
^2*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c^2*d*tan(x)*(- c*d - c^2)^(3/2)*5i + b^2*c^4*d*tan(x)*(- c*d - c
^2)^(1/2)*6i + a^2*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*2i + a^2*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*1i + b^2*c^2
*d^3*tan(x)*(- c*d - c^2)^(1/2)*4i + b^2*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*7i + a*b*d^3*tan(x)*(- c*d - c^2)^
(3/2)*2i + a*b*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*6i + a*b*c*d^4*tan(x)*(- c*d - c^2)^(1/2)*2i + a*b*c^2*d*tan(x
)*(- c*d - c^2)^(3/2)*4i + a*b*c^4*d*tan(x)*(- c*d - c^2)^(1/2)*2i + a*b*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*6i
 + a*b*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*6i)/(b^2*c^5*d + a^2*c^2*d^4 + 2*a^2*c^3*d^3 + a^2*c^4*d^2 + b^2*c^2
*d^4 + 3*b^2*c^3*d^3 + 3*b^2*c^4*d^2 + 2*a*b*c^5*d + 2*a*b*c^2*d^4 + 6*a*b*c^3*d^3 + 6*a*b*c^4*d^2))*(- c*d -
c^2)^(1/2)*1i)/(c*d^2 + c^2*d) - (b*c*d*x)/(c*d^2 + c^2*d)

________________________________________________________________________________________

sympy [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

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

________________________________________________________________________________________