Integrand size = 13, antiderivative size = 61 \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=-\frac {a x}{b^2}+\frac {2 a^2 \arctan \left (\frac {b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2}}-\frac {\cos (x)}{b} \] Output:
-a*x/b^2+2*a^2*arctan((b+a*tan(1/2*x))/(a^2-b^2)^(1/2))/b^2/(a^2-b^2)^(1/2 )-cos(x)/b
Time = 0.20 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.92 \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=-\frac {a x-\frac {2 a^2 \arctan \left (\frac {b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+b \cos (x)}{b^2} \] Input:
Integrate[Sin[x]^2/(a + b*Sin[x]),x]
Output:
-((a*x - (2*a^2*ArcTan[(b + a*Tan[x/2])/Sqrt[a^2 - b^2]])/Sqrt[a^2 - b^2] + b*Cos[x])/b^2)
Time = 0.37 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.15, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.769, Rules used = {3042, 3225, 25, 27, 3042, 3214, 3042, 3139, 1083, 217}
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+b \sin (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sin (x)^2}{a+b \sin (x)}dx\) |
\(\Big \downarrow \) 3225 |
\(\displaystyle \frac {\int -\frac {a \sin (x)}{a+b \sin (x)}dx}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\frac {\int \frac {a \sin (x)}{a+b \sin (x)}dx}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle -\frac {a \int \frac {\sin (x)}{a+b \sin (x)}dx}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {a \int \frac {\sin (x)}{a+b \sin (x)}dx}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 3214 |
\(\displaystyle -\frac {a \left (\frac {x}{b}-\frac {a \int \frac {1}{a+b \sin (x)}dx}{b}\right )}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {a \left (\frac {x}{b}-\frac {a \int \frac {1}{a+b \sin (x)}dx}{b}\right )}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 3139 |
\(\displaystyle -\frac {a \left (\frac {x}{b}-\frac {2 a \int \frac {1}{a \tan ^2\left (\frac {x}{2}\right )+2 b \tan \left (\frac {x}{2}\right )+a}d\tan \left (\frac {x}{2}\right )}{b}\right )}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 1083 |
\(\displaystyle -\frac {a \left (\frac {4 a \int \frac {1}{-\left (2 b+2 a \tan \left (\frac {x}{2}\right )\right )^2-4 \left (a^2-b^2\right )}d\left (2 b+2 a \tan \left (\frac {x}{2}\right )\right )}{b}+\frac {x}{b}\right )}{b}-\frac {\cos (x)}{b}\) |
\(\Big \downarrow \) 217 |
\(\displaystyle -\frac {a \left (\frac {x}{b}-\frac {2 a \arctan \left (\frac {2 a \tan \left (\frac {x}{2}\right )+2 b}{2 \sqrt {a^2-b^2}}\right )}{b \sqrt {a^2-b^2}}\right )}{b}-\frac {\cos (x)}{b}\) |
Input:
Int[Sin[x]^2/(a + b*Sin[x]),x]
Output:
-((a*(x/b - (2*a*ArcTan[(2*b + 2*a*Tan[x/2])/(2*Sqrt[a^2 - b^2])])/(b*Sqrt [a^2 - b^2])))/b) - Cos[x]/b
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^( -1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] & & (LtQ[a, 0] || LtQ[b, 0])
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2 Subst[I nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x]
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = Fre eFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d) Subst[Int[1/(a + 2*b*e*x + a *e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ [a^2 - b^2, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d Int[1/(c + d *Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2/((c_.) + (d_.)*sin[(e_.) + (f _.)*(x_)]), x_Symbol] :> Simp[(-b^2)*(Cos[e + f*x]/(d*f)), x] + Simp[1/d Int[Simp[a^2*d - b*(b*c - 2*a*d)*Sin[e + f*x], x]/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Time = 0.28 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.16
method | result | size |
default | \(-\frac {2 \left (\frac {b}{\tan \left (\frac {x}{2}\right )^{2}+1}+a \arctan \left (\tan \left (\frac {x}{2}\right )\right )\right )}{b^{2}}+\frac {2 a^{2} \arctan \left (\frac {2 a \tan \left (\frac {x}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{b^{2} \sqrt {a^{2}-b^{2}}}\) | \(71\) |
risch | \(-\frac {a x}{b^{2}}-\frac {{\mathrm e}^{i x}}{2 b}-\frac {{\mathrm e}^{-i x}}{2 b}+\frac {a^{2} \ln \left ({\mathrm e}^{i x}+\frac {i a \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right )}{\sqrt {-a^{2}+b^{2}}\, b^{2}}-\frac {a^{2} \ln \left ({\mathrm e}^{i x}+\frac {i a \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right )}{\sqrt {-a^{2}+b^{2}}\, b^{2}}\) | \(158\) |
Input:
int(sin(x)^2/(a+b*sin(x)),x,method=_RETURNVERBOSE)
Output:
-2/b^2*(b/(tan(1/2*x)^2+1)+a*arctan(tan(1/2*x)))+2*a^2/b^2/(a^2-b^2)^(1/2) *arctan(1/2*(2*a*tan(1/2*x)+2*b)/(a^2-b^2)^(1/2))
Time = 0.10 (sec) , antiderivative size = 231, normalized size of antiderivative = 3.79 \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=\left [-\frac {\sqrt {-a^{2} + b^{2}} a^{2} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a b \sin \left (x\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (x\right ) \sin \left (x\right ) + b \cos \left (x\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (x\right )^{2} - 2 \, a b \sin \left (x\right ) - a^{2} - b^{2}}\right ) + 2 \, {\left (a^{3} - a b^{2}\right )} x + 2 \, {\left (a^{2} b - b^{3}\right )} \cos \left (x\right )}{2 \, {\left (a^{2} b^{2} - b^{4}\right )}}, -\frac {\sqrt {a^{2} - b^{2}} a^{2} \arctan \left (-\frac {a \sin \left (x\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (x\right )}\right ) + {\left (a^{3} - a b^{2}\right )} x + {\left (a^{2} b - b^{3}\right )} \cos \left (x\right )}{a^{2} b^{2} - b^{4}}\right ] \] Input:
integrate(sin(x)^2/(a+b*sin(x)),x, algorithm="fricas")
Output:
[-1/2*(sqrt(-a^2 + b^2)*a^2*log(((2*a^2 - b^2)*cos(x)^2 - 2*a*b*sin(x) - a ^2 - b^2 + 2*(a*cos(x)*sin(x) + b*cos(x))*sqrt(-a^2 + b^2))/(b^2*cos(x)^2 - 2*a*b*sin(x) - a^2 - b^2)) + 2*(a^3 - a*b^2)*x + 2*(a^2*b - b^3)*cos(x)) /(a^2*b^2 - b^4), -(sqrt(a^2 - b^2)*a^2*arctan(-(a*sin(x) + b)/(sqrt(a^2 - b^2)*cos(x))) + (a^3 - a*b^2)*x + (a^2*b - b^3)*cos(x))/(a^2*b^2 - b^4)]
Leaf count of result is larger than twice the leaf count of optimal. 1192 vs. \(2 (49) = 98\).
Time = 100.48 (sec) , antiderivative size = 1192, normalized size of antiderivative = 19.54 \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=\text {Too large to display} \] Input:
integrate(sin(x)**2/(a+b*sin(x)),x)
Output:
Piecewise((zoo*cos(x), Eq(a, 0) & Eq(b, 0)), (-cos(x)/b, Eq(a, 0)), (-b*x* tan(x/2)**2/(b**2*tan(x/2)**3 + b**2*tan(x/2) - b*sqrt(b**2)*tan(x/2)**2 - b*sqrt(b**2)) - b*x/(b**2*tan(x/2)**3 + b**2*tan(x/2) - b*sqrt(b**2)*tan( x/2)**2 - b*sqrt(b**2)) - 2*b*tan(x/2)/(b**2*tan(x/2)**3 + b**2*tan(x/2) - b*sqrt(b**2)*tan(x/2)**2 - b*sqrt(b**2)) + x*sqrt(b**2)*tan(x/2)**3/(b**2 *tan(x/2)**3 + b**2*tan(x/2) - b*sqrt(b**2)*tan(x/2)**2 - b*sqrt(b**2)) + x*sqrt(b**2)*tan(x/2)/(b**2*tan(x/2)**3 + b**2*tan(x/2) - b*sqrt(b**2)*tan (x/2)**2 - b*sqrt(b**2)) + 2*sqrt(b**2)*tan(x/2)**2/(b**2*tan(x/2)**3 + b* *2*tan(x/2) - b*sqrt(b**2)*tan(x/2)**2 - b*sqrt(b**2)) + 4*sqrt(b**2)/(b** 2*tan(x/2)**3 + b**2*tan(x/2) - b*sqrt(b**2)*tan(x/2)**2 - b*sqrt(b**2)), Eq(a, -sqrt(b**2))), (-b*x*tan(x/2)**2/(b**2*tan(x/2)**3 + b**2*tan(x/2) + b*sqrt(b**2)*tan(x/2)**2 + b*sqrt(b**2)) - b*x/(b**2*tan(x/2)**3 + b**2*t an(x/2) + b*sqrt(b**2)*tan(x/2)**2 + b*sqrt(b**2)) - 2*b*tan(x/2)/(b**2*ta n(x/2)**3 + b**2*tan(x/2) + b*sqrt(b**2)*tan(x/2)**2 + b*sqrt(b**2)) - x*s qrt(b**2)*tan(x/2)**3/(b**2*tan(x/2)**3 + b**2*tan(x/2) + b*sqrt(b**2)*tan (x/2)**2 + b*sqrt(b**2)) - x*sqrt(b**2)*tan(x/2)/(b**2*tan(x/2)**3 + b**2* tan(x/2) + b*sqrt(b**2)*tan(x/2)**2 + b*sqrt(b**2)) - 2*sqrt(b**2)*tan(x/2 )**2/(b**2*tan(x/2)**3 + b**2*tan(x/2) + b*sqrt(b**2)*tan(x/2)**2 + b*sqrt (b**2)) - 4*sqrt(b**2)/(b**2*tan(x/2)**3 + b**2*tan(x/2) + b*sqrt(b**2)*ta n(x/2)**2 + b*sqrt(b**2)), Eq(a, sqrt(b**2))), ((x*sin(x)**2/2 + x*cos(...
Exception generated. \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate(sin(x)^2/(a+b*sin(x)),x, algorithm="maxima")
Output:
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?` f or more de
Time = 0.12 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.26 \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=\frac {2 \, {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, x\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )} a^{2}}{\sqrt {a^{2} - b^{2}} b^{2}} - \frac {a x}{b^{2}} - \frac {2}{{\left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )} b} \] Input:
integrate(sin(x)^2/(a+b*sin(x)),x, algorithm="giac")
Output:
2*(pi*floor(1/2*x/pi + 1/2)*sgn(a) + arctan((a*tan(1/2*x) + b)/sqrt(a^2 - b^2)))*a^2/(sqrt(a^2 - b^2)*b^2) - a*x/b^2 - 2/((tan(1/2*x)^2 + 1)*b)
Time = 17.23 (sec) , antiderivative size = 623, normalized size of antiderivative = 10.21 \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=-\frac {2}{b\,\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )}-\frac {a\,x}{b^2}-\frac {a^2\,\mathrm {atan}\left (\frac {\frac {a^2\,\left (\frac {32\,a^4}{b}-\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (2\,a^5\,b-2\,a^3\,b^3\right )}{b^3}+\frac {a^2\,\left (32\,a^2\,b^2+64\,a^3\,b\,\mathrm {tan}\left (\frac {x}{2}\right )+\frac {a^2\,\left (32\,a^2\,b^3+\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a\,b^7-2\,a^3\,b^5\right )}{b^3}\right )}{b^2\,\sqrt {b^2-a^2}}\right )}{b^2\,\sqrt {b^2-a^2}}\right )\,1{}\mathrm {i}}{b^2\,\sqrt {b^2-a^2}}-\frac {a^2\,\left (\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (2\,a^5\,b-2\,a^3\,b^3\right )}{b^3}-\frac {32\,a^4}{b}+\frac {a^2\,\left (32\,a^2\,b^2+64\,a^3\,b\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {a^2\,\left (32\,a^2\,b^3+\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a\,b^7-2\,a^3\,b^5\right )}{b^3}\right )}{b^2\,\sqrt {b^2-a^2}}\right )}{b^2\,\sqrt {b^2-a^2}}\right )\,1{}\mathrm {i}}{b^2\,\sqrt {b^2-a^2}}}{\frac {128\,a^5\,\mathrm {tan}\left (\frac {x}{2}\right )}{b^3}+\frac {a^2\,\left (\frac {32\,a^4}{b}-\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (2\,a^5\,b-2\,a^3\,b^3\right )}{b^3}+\frac {a^2\,\left (32\,a^2\,b^2+64\,a^3\,b\,\mathrm {tan}\left (\frac {x}{2}\right )+\frac {a^2\,\left (32\,a^2\,b^3+\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a\,b^7-2\,a^3\,b^5\right )}{b^3}\right )}{b^2\,\sqrt {b^2-a^2}}\right )}{b^2\,\sqrt {b^2-a^2}}\right )}{b^2\,\sqrt {b^2-a^2}}+\frac {a^2\,\left (\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (2\,a^5\,b-2\,a^3\,b^3\right )}{b^3}-\frac {32\,a^4}{b}+\frac {a^2\,\left (32\,a^2\,b^2+64\,a^3\,b\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {a^2\,\left (32\,a^2\,b^3+\frac {32\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (3\,a\,b^7-2\,a^3\,b^5\right )}{b^3}\right )}{b^2\,\sqrt {b^2-a^2}}\right )}{b^2\,\sqrt {b^2-a^2}}\right )}{b^2\,\sqrt {b^2-a^2}}}\right )\,2{}\mathrm {i}}{b^2\,\sqrt {b^2-a^2}} \] Input:
int(sin(x)^2/(a + b*sin(x)),x)
Output:
- 2/(b*(tan(x/2)^2 + 1)) - (a*x)/b^2 - (a^2*atan(((a^2*((32*a^4)/b - (32*t an(x/2)*(2*a^5*b - 2*a^3*b^3))/b^3 + (a^2*(32*a^2*b^2 + 64*a^3*b*tan(x/2) + (a^2*(32*a^2*b^3 + (32*tan(x/2)*(3*a*b^7 - 2*a^3*b^5))/b^3))/(b^2*(b^2 - a^2)^(1/2))))/(b^2*(b^2 - a^2)^(1/2)))*1i)/(b^2*(b^2 - a^2)^(1/2)) - (a^2 *((32*tan(x/2)*(2*a^5*b - 2*a^3*b^3))/b^3 - (32*a^4)/b + (a^2*(32*a^2*b^2 + 64*a^3*b*tan(x/2) - (a^2*(32*a^2*b^3 + (32*tan(x/2)*(3*a*b^7 - 2*a^3*b^5 ))/b^3))/(b^2*(b^2 - a^2)^(1/2))))/(b^2*(b^2 - a^2)^(1/2)))*1i)/(b^2*(b^2 - a^2)^(1/2)))/((128*a^5*tan(x/2))/b^3 + (a^2*((32*a^4)/b - (32*tan(x/2)*( 2*a^5*b - 2*a^3*b^3))/b^3 + (a^2*(32*a^2*b^2 + 64*a^3*b*tan(x/2) + (a^2*(3 2*a^2*b^3 + (32*tan(x/2)*(3*a*b^7 - 2*a^3*b^5))/b^3))/(b^2*(b^2 - a^2)^(1/ 2))))/(b^2*(b^2 - a^2)^(1/2))))/(b^2*(b^2 - a^2)^(1/2)) + (a^2*((32*tan(x/ 2)*(2*a^5*b - 2*a^3*b^3))/b^3 - (32*a^4)/b + (a^2*(32*a^2*b^2 + 64*a^3*b*t an(x/2) - (a^2*(32*a^2*b^3 + (32*tan(x/2)*(3*a*b^7 - 2*a^3*b^5))/b^3))/(b^ 2*(b^2 - a^2)^(1/2))))/(b^2*(b^2 - a^2)^(1/2))))/(b^2*(b^2 - a^2)^(1/2)))) *2i)/(b^2*(b^2 - a^2)^(1/2))
Time = 0.18 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.30 \[ \int \frac {\sin ^2(x)}{a+b \sin (x)} \, dx=\frac {2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) a +b}{\sqrt {a^{2}-b^{2}}}\right ) a^{2}-\cos \left (x \right ) a^{2} b +\cos \left (x \right ) b^{3}-a^{3} x +a \,b^{2} x}{b^{2} \left (a^{2}-b^{2}\right )} \] Input:
int(sin(x)^2/(a+b*sin(x)),x)
Output:
(2*sqrt(a**2 - b**2)*atan((tan(x/2)*a + b)/sqrt(a**2 - b**2))*a**2 - cos(x )*a**2*b + cos(x)*b**3 - a**3*x + a*b**2*x)/(b**2*(a**2 - b**2))