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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.13, antiderivative size = 57, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {12, 1166, 203} \[ \frac {x (a+2 b)}{\sqrt {2} c}-\frac {(a+2 b) \tan ^{-1}\left (\frac {\sin (x) \cos (x)}{\cos ^2(x)+\sqrt {2}+1}\right )}{\sqrt {2} c}-\frac {b x}{c} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sin[x]^2)/(c + c*Cos[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] + Cos[x]^2)])/(Sqrt[2]
*c)

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, 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 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]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.08, size = 34, normalized size = 0.60 \[ -\frac {(-a-2 b) \tan ^{-1}\left (\frac {\tan (x)}{\sqrt {2}}\right )}{\sqrt {2} c}-\frac {b x}{c} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 1.33, size = 45, normalized size = 0.79 \[ -\frac {\sqrt {2} {\left (a + 2 \, b\right )} \arctan \left (\frac {3 \, \sqrt {2} \cos \relax (x)^{2} - \sqrt {2}}{4 \, \cos \relax (x) \sin \relax (x)}\right ) + 4 \, b x}{4 \, c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.14, size = 62, normalized size = 1.09 \[ \frac {\sqrt {2} {\left (a + 2 \, b\right )} {\left (x + \arctan \left (-\frac {\sqrt {2} \sin \left (2 \, x\right ) - \sin \left (2 \, x\right )}{\sqrt {2} \cos \left (2 \, x\right ) + \sqrt {2} - \cos \left (2 \, x\right ) + 1}\right )\right )}}{2 \, c} - \frac {b x}{c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.13, size = 44, normalized size = 0.77 \[ \frac {\sqrt {2}\, \arctan \left (\frac {\sqrt {2}\, \tan \relax (x )}{2}\right ) a}{2 c}+\frac {\sqrt {2}\, \arctan \left (\frac {\sqrt {2}\, \tan \relax (x )}{2}\right ) b}{c}-\frac {b \arctan \left (\tan \relax (x )\right )}{c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.42, size = 29, normalized size = 0.51 \[ \frac {\sqrt {2} {\left (a + 2 \, b\right )} \arctan \left (\frac {1}{2} \, \sqrt {2} \tan \relax (x)\right )}{2 \, c} - \frac {b x}{c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 2.43, size = 242, normalized size = 4.25 \[ \frac {\sqrt {2}\,\mathrm {atan}\left (\frac {\sqrt {2}\,a^3\,\mathrm {tan}\relax (x)}{2\,\left (a^3+6\,a^2\,b+10\,a\,b^2+4\,b^3\right )}+\frac {2\,\sqrt {2}\,b^3\,\mathrm {tan}\relax (x)}{a^3+6\,a^2\,b+10\,a\,b^2+4\,b^3}+\frac {5\,\sqrt {2}\,a\,b^2\,\mathrm {tan}\relax (x)}{a^3+6\,a^2\,b+10\,a\,b^2+4\,b^3}+\frac {3\,\sqrt {2}\,a^2\,b\,\mathrm {tan}\relax (x)}{a^3+6\,a^2\,b+10\,a\,b^2+4\,b^3}\right )\,\left (a+2\,b\right )}{2\,c}-\frac {b\,\mathrm {atan}\left (\frac {4\,b^3\,\mathrm {tan}\relax (x)}{2\,a^2\,b+8\,a\,b^2+4\,b^3}+\frac {8\,a\,b^2\,\mathrm {tan}\relax (x)}{2\,a^2\,b+8\,a\,b^2+4\,b^3}+\frac {2\,a^2\,b\,\mathrm {tan}\relax (x)}{2\,a^2\,b+8\,a\,b^2+4\,b^3}\right )}{c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(2^(1/2)*atan((2^(1/2)*a^3*tan(x))/(2*(10*a*b^2 + 6*a^2*b + a^3 + 4*b^3)) + (2*2^(1/2)*b^3*tan(x))/(10*a*b^2 +
 6*a^2*b + a^3 + 4*b^3) + (5*2^(1/2)*a*b^2*tan(x))/(10*a*b^2 + 6*a^2*b + a^3 + 4*b^3) + (3*2^(1/2)*a^2*b*tan(x
))/(10*a*b^2 + 6*a^2*b + a^3 + 4*b^3))*(a + 2*b))/(2*c) - (b*atan((4*b^3*tan(x))/(8*a*b^2 + 2*a^2*b + 4*b^3) +
 (8*a*b^2*tan(x))/(8*a*b^2 + 2*a^2*b + 4*b^3) + (2*a^2*b*tan(x))/(8*a*b^2 + 2*a^2*b + 4*b^3)))/c

________________________________________________________________________________________

sympy [B]  time = 10.67, size = 143, normalized size = 2.51 \[ \frac {\sqrt {2} a \left (\operatorname {atan}{\left (\sqrt {2} \tan {\left (\frac {x}{2} \right )} - 1 \right )} + \pi \left \lfloor {\frac {\frac {x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{2 c} + \frac {\sqrt {2} a \left (\operatorname {atan}{\left (\sqrt {2} \tan {\left (\frac {x}{2} \right )} + 1 \right )} + \pi \left \lfloor {\frac {\frac {x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{2 c} - \frac {b x}{c} + \frac {\sqrt {2} b \left (\operatorname {atan}{\left (\sqrt {2} \tan {\left (\frac {x}{2} \right )} - 1 \right )} + \pi \left \lfloor {\frac {\frac {x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{c} + \frac {\sqrt {2} b \left (\operatorname {atan}{\left (\sqrt {2} \tan {\left (\frac {x}{2} \right )} + 1 \right )} + \pi \left \lfloor {\frac {\frac {x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

sqrt(2)*a*(atan(sqrt(2)*tan(x/2) - 1) + pi*floor((x/2 - pi/2)/pi))/(2*c) + sqrt(2)*a*(atan(sqrt(2)*tan(x/2) +
1) + pi*floor((x/2 - pi/2)/pi))/(2*c) - b*x/c + sqrt(2)*b*(atan(sqrt(2)*tan(x/2) - 1) + pi*floor((x/2 - pi/2)/
pi))/c + sqrt(2)*b*(atan(sqrt(2)*tan(x/2) + 1) + pi*floor((x/2 - pi/2)/pi))/c

________________________________________________________________________________________