Integrand size = 20, antiderivative size = 43 \[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=-\frac {x}{a-b}+\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tan (x)}{\sqrt {a}}\right )}{(a-b) \sqrt {b}} \] Output:
-x/(a-b)+a^(1/2)*arctan(b^(1/2)*tan(x)/a^(1/2))/(a-b)/b^(1/2)
Time = 0.18 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.84 \[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=\frac {x-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tan (x)}{\sqrt {a}}\right )}{\sqrt {b}}}{-a+b} \] Input:
Integrate[Sin[x]^2/(a*Cos[x]^2 + b*Sin[x]^2),x]
Output:
(x - (Sqrt[a]*ArcTan[(Sqrt[b]*Tan[x])/Sqrt[a]])/Sqrt[b])/(-a + b)
Time = 0.31 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.05, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3042, 4889, 383, 216, 218}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sin (x)^2}{a \cos (x)^2+b \sin (x)^2}dx\) |
\(\Big \downarrow \) 4889 |
\(\displaystyle \int \frac {\tan ^2(x)}{\left (\tan ^2(x)+1\right ) \left (a+b \tan ^2(x)\right )}d\tan (x)\) |
\(\Big \downarrow \) 383 |
\(\displaystyle \frac {a \int \frac {1}{b \tan ^2(x)+a}d\tan (x)}{a-b}-\frac {\int \frac {1}{\tan ^2(x)+1}d\tan (x)}{a-b}\) |
\(\Big \downarrow \) 216 |
\(\displaystyle \frac {a \int \frac {1}{b \tan ^2(x)+a}d\tan (x)}{a-b}-\frac {\arctan (\tan (x))}{a-b}\) |
\(\Big \downarrow \) 218 |
\(\displaystyle \frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tan (x)}{\sqrt {a}}\right )}{\sqrt {b} (a-b)}-\frac {\arctan (\tan (x))}{a-b}\) |
Input:
Int[Sin[x]^2/(a*Cos[x]^2 + b*Sin[x]^2),x]
Output:
-(ArcTan[Tan[x]]/(a - b)) + (Sqrt[a]*ArcTan[(Sqrt[b]*Tan[x])/Sqrt[a]])/((a - b)*Sqrt[b])
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a , 0] || GtQ[b, 0])
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
Int[((e_.)*(x_))^(m_.)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_Sym bol] :> Simp[(-a)*(e^2/(b*c - a*d)) Int[(e*x)^(m - 2)/(a + b*x^2), x], x] + Simp[c*(e^2/(b*c - a*d)) Int[(e*x)^(m - 2)/(c + d*x^2), x], x] /; Free Q[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && LeQ[2, m, 3]
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, With[{d = FreeFactors [Tan[v], x]}, Simp[d/Coefficient[v, x, 1] Subst[Int[SubstFor[1/(1 + d^2*x ^2), Tan[v]/d, u, x], x], x, Tan[v]/d], x]] /; !FalseQ[v] && FunctionOfQ[N onfreeFactors[Tan[v], x], u, x]] /; InverseFunctionFreeQ[u, x] && !MatchQ[ u, (v_.)*((c_.)*tan[w_]^(n_.)*tan[z_]^(n_.))^(p_.) /; FreeQ[{c, p}, x] && I ntegerQ[n] && LinearQ[w, x] && EqQ[z, 2*w]]
Time = 0.38 (sec) , antiderivative size = 38, normalized size of antiderivative = 0.88
method | result | size |
default | \(\frac {a \arctan \left (\frac {b \tan \left (x \right )}{\sqrt {b a}}\right )}{\left (a -b \right ) \sqrt {b a}}-\frac {\arctan \left (\tan \left (x \right )\right )}{a -b}\) | \(38\) |
risch | \(-\frac {x}{a -b}-\frac {\sqrt {-b a}\, \ln \left ({\mathrm e}^{2 i x}+\frac {2 i \sqrt {-b a}+a +b}{a -b}\right )}{2 b \left (a -b \right )}+\frac {\sqrt {-b a}\, \ln \left ({\mathrm e}^{2 i x}-\frac {2 i \sqrt {-b a}-a -b}{a -b}\right )}{2 b \left (a -b \right )}\) | \(107\) |
Input:
int(sin(x)^2/(a*cos(x)^2+b*sin(x)^2),x,method=_RETURNVERBOSE)
Output:
a/(a-b)/(b*a)^(1/2)*arctan(b*tan(x)/(b*a)^(1/2))-1/(a-b)*arctan(tan(x))
Time = 0.10 (sec) , antiderivative size = 182, normalized size of antiderivative = 4.23 \[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=\left [-\frac {\sqrt {-\frac {a}{b}} \log \left (\frac {{\left (a^{2} + 6 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (3 \, a b + b^{2}\right )} \cos \left (x\right )^{2} + 4 \, {\left ({\left (a b + b^{2}\right )} \cos \left (x\right )^{3} - b^{2} \cos \left (x\right )\right )} \sqrt {-\frac {a}{b}} \sin \left (x\right ) + b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (x\right )^{4} + 2 \, {\left (a b - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}}\right ) + 4 \, x}{4 \, {\left (a - b\right )}}, -\frac {\sqrt {\frac {a}{b}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cos \left (x\right )^{2} - b\right )} \sqrt {\frac {a}{b}}}{2 \, a \cos \left (x\right ) \sin \left (x\right )}\right ) + 2 \, x}{2 \, {\left (a - b\right )}}\right ] \] Input:
integrate(sin(x)^2/(a*cos(x)^2+b*sin(x)^2),x, algorithm="fricas")
Output:
[-1/4*(sqrt(-a/b)*log(((a^2 + 6*a*b + b^2)*cos(x)^4 - 2*(3*a*b + b^2)*cos( x)^2 + 4*((a*b + b^2)*cos(x)^3 - b^2*cos(x))*sqrt(-a/b)*sin(x) + b^2)/((a^ 2 - 2*a*b + b^2)*cos(x)^4 + 2*(a*b - b^2)*cos(x)^2 + b^2)) + 4*x)/(a - b), -1/2*(sqrt(a/b)*arctan(1/2*((a + b)*cos(x)^2 - b)*sqrt(a/b)/(a*cos(x)*sin (x))) + 2*x)/(a - b)]
Leaf count of result is larger than twice the leaf count of optimal. 201 vs. \(2 (32) = 64\).
Time = 0.64 (sec) , antiderivative size = 201, normalized size of antiderivative = 4.67 \[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=\begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge b = 0 \\\frac {x}{b} & \text {for}\: a = 0 \\\frac {x \sin ^{2}{\left (x \right )}}{2 b \sin ^{2}{\left (x \right )} + 2 b \cos ^{2}{\left (x \right )}} + \frac {x \cos ^{2}{\left (x \right )}}{2 b \sin ^{2}{\left (x \right )} + 2 b \cos ^{2}{\left (x \right )}} - \frac {\sin {\left (x \right )} \cos {\left (x \right )}}{2 b \sin ^{2}{\left (x \right )} + 2 b \cos ^{2}{\left (x \right )}} & \text {for}\: a = b \\\frac {- x + \frac {\sin {\left (x \right )}}{\cos {\left (x \right )}}}{a} & \text {for}\: b = 0 \\- \frac {2 x \sqrt {- \frac {b}{a}}}{2 a \sqrt {- \frac {b}{a}} - 2 b \sqrt {- \frac {b}{a}}} - \frac {\log {\left (- \sqrt {- \frac {b}{a}} \sin {\left (x \right )} + \cos {\left (x \right )} \right )}}{2 a \sqrt {- \frac {b}{a}} - 2 b \sqrt {- \frac {b}{a}}} + \frac {\log {\left (\sqrt {- \frac {b}{a}} \sin {\left (x \right )} + \cos {\left (x \right )} \right )}}{2 a \sqrt {- \frac {b}{a}} - 2 b \sqrt {- \frac {b}{a}}} & \text {otherwise} \end {cases} \] Input:
integrate(sin(x)**2/(a*cos(x)**2+b*sin(x)**2),x)
Output:
Piecewise((zoo*x, Eq(a, 0) & Eq(b, 0)), (x/b, Eq(a, 0)), (x*sin(x)**2/(2*b *sin(x)**2 + 2*b*cos(x)**2) + x*cos(x)**2/(2*b*sin(x)**2 + 2*b*cos(x)**2) - sin(x)*cos(x)/(2*b*sin(x)**2 + 2*b*cos(x)**2), Eq(a, b)), ((-x + sin(x)/ cos(x))/a, Eq(b, 0)), (-2*x*sqrt(-b/a)/(2*a*sqrt(-b/a) - 2*b*sqrt(-b/a)) - log(-sqrt(-b/a)*sin(x) + cos(x))/(2*a*sqrt(-b/a) - 2*b*sqrt(-b/a)) + log( sqrt(-b/a)*sin(x) + cos(x))/(2*a*sqrt(-b/a) - 2*b*sqrt(-b/a)), True))
Time = 0.12 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.81 \[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=\frac {a \arctan \left (\frac {b \tan \left (x\right )}{\sqrt {a b}}\right )}{\sqrt {a b} {\left (a - b\right )}} - \frac {x}{a - b} \] Input:
integrate(sin(x)^2/(a*cos(x)^2+b*sin(x)^2),x, algorithm="maxima")
Output:
a*arctan(b*tan(x)/sqrt(a*b))/(sqrt(a*b)*(a - b)) - x/(a - b)
Time = 0.28 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.12 \[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=\frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (x\right )}{\sqrt {a b}}\right )\right )} a}{\sqrt {a b} {\left (a - b\right )}} - \frac {x}{a - b} \] Input:
integrate(sin(x)^2/(a*cos(x)^2+b*sin(x)^2),x, algorithm="giac")
Output:
(pi*floor(x/pi + 1/2)*sgn(b) + arctan(b*tan(x)/sqrt(a*b)))*a/(sqrt(a*b)*(a - b)) - x/(a - b)
Time = 15.98 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.19 \[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=\left \{\begin {array}{cl} \frac {2\,x-\sin \left (2\,x\right )}{4\,b} & \text {\ if\ \ }a=b\\ -\frac {x-\frac {\sqrt {a}\,\mathrm {atan}\left (\frac {\sqrt {b}\,\mathrm {tan}\left (x\right )}{\sqrt {a}}\right )}{\sqrt {b}}}{a-b} & \text {\ if\ \ }a\neq b \end {array}\right . \] Input:
int(sin(x)^2/(b*sin(x)^2 + a*cos(x)^2),x)
Output:
piecewise(a == b, (2*x - sin(2*x))/(4*b), a ~= b, -(x - (a^(1/2)*atan((b^( 1/2)*tan(x))/a^(1/2)))/b^(1/2))/(a - b))
\[ \int \frac {\sin ^2(x)}{a \cos ^2(x)+b \sin ^2(x)} \, dx=\int \frac {\sin \left (x \right )^{2}}{\cos \left (x \right )^{2} a +\sin \left (x \right )^{2} b}d x \] Input:
int(sin(x)^2/(a*cos(x)^2+b*sin(x)^2),x)
Output:
int(sin(x)**2/(cos(x)**2*a + sin(x)**2*b),x)