\(\int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx\) [18]

Optimal result
Mathematica [B] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [B] (verification not implemented)
Giac [A] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 45 \[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=\frac {2 \text {arctanh}(\cos (x))}{a^2}-\frac {10 \cot (x)}{3 a^2}+\frac {2 \cot (x)}{a^2 (1+\sin (x))}+\frac {\cot (x)}{3 (a+a \sin (x))^2} \] Output:

2*arctanh(cos(x))/a^2-10/3*cot(x)/a^2+2*cot(x)/a^2/(1+sin(x))+1/3*cot(x)/( 
a+a*sin(x))^2
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(166\) vs. \(2(45)=90\).

Time = 1.00 (sec) , antiderivative size = 166, normalized size of antiderivative = 3.69 \[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=\frac {\left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right ) \left (4 \sin \left (\frac {x}{2}\right )-2 \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )+28 \sin \left (\frac {x}{2}\right ) \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )^2-3 \cot \left (\frac {x}{2}\right ) \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )^3+12 \log \left (\cos \left (\frac {x}{2}\right )\right ) \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )^3-12 \log \left (\sin \left (\frac {x}{2}\right )\right ) \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )^3+3 \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )^3 \tan \left (\frac {x}{2}\right )\right )}{6 (a+a \sin (x))^2} \] Input:

Integrate[Csc[x]^2/(a + a*Sin[x])^2,x]
 

Output:

((Cos[x/2] + Sin[x/2])*(4*Sin[x/2] - 2*(Cos[x/2] + Sin[x/2]) + 28*Sin[x/2] 
*(Cos[x/2] + Sin[x/2])^2 - 3*Cot[x/2]*(Cos[x/2] + Sin[x/2])^3 + 12*Log[Cos 
[x/2]]*(Cos[x/2] + Sin[x/2])^3 - 12*Log[Sin[x/2]]*(Cos[x/2] + Sin[x/2])^3 
+ 3*(Cos[x/2] + Sin[x/2])^3*Tan[x/2]))/(6*(a + a*Sin[x])^2)
 

Rubi [A] (verified)

Time = 0.53 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.18, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.846, Rules used = {3042, 3245, 27, 3042, 3457, 3042, 3227, 3042, 4254, 24, 4257}

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 {\csc ^2(x)}{(a \sin (x)+a)^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\sin (x)^2 (a \sin (x)+a)^2}dx\)

\(\Big \downarrow \) 3245

\(\displaystyle \frac {\int \frac {2 \csc ^2(x) (2 a-a \sin (x))}{\sin (x) a+a}dx}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {2 \int \frac {\csc ^2(x) (2 a-a \sin (x))}{\sin (x) a+a}dx}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {2 \int \frac {2 a-a \sin (x)}{\sin (x)^2 (\sin (x) a+a)}dx}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 3457

\(\displaystyle \frac {2 \left (\frac {\int \csc ^2(x) \left (5 a^2-3 a^2 \sin (x)\right )dx}{a^2}+\frac {3 \cot (x)}{\sin (x)+1}\right )}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {2 \left (\frac {\int \frac {5 a^2-3 a^2 \sin (x)}{\sin (x)^2}dx}{a^2}+\frac {3 \cot (x)}{\sin (x)+1}\right )}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 3227

\(\displaystyle \frac {2 \left (\frac {5 a^2 \int \csc ^2(x)dx-3 a^2 \int \csc (x)dx}{a^2}+\frac {3 \cot (x)}{\sin (x)+1}\right )}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {2 \left (\frac {5 a^2 \int \csc (x)^2dx-3 a^2 \int \csc (x)dx}{a^2}+\frac {3 \cot (x)}{\sin (x)+1}\right )}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 4254

\(\displaystyle \frac {2 \left (\frac {-5 a^2 \int 1d\cot (x)-3 a^2 \int \csc (x)dx}{a^2}+\frac {3 \cot (x)}{\sin (x)+1}\right )}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 24

\(\displaystyle \frac {2 \left (\frac {-3 a^2 \int \csc (x)dx-5 a^2 \cot (x)}{a^2}+\frac {3 \cot (x)}{\sin (x)+1}\right )}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {2 \left (\frac {3 a^2 \text {arctanh}(\cos (x))-5 a^2 \cot (x)}{a^2}+\frac {3 \cot (x)}{\sin (x)+1}\right )}{3 a^2}+\frac {\cot (x)}{3 (a \sin (x)+a)^2}\)

Input:

Int[Csc[x]^2/(a + a*Sin[x])^2,x]
 

Output:

Cot[x]/(3*(a + a*Sin[x])^2) + (2*((3*a^2*ArcTanh[Cos[x]] - 5*a^2*Cot[x])/a 
^2 + (3*Cot[x])/(1 + Sin[x])))/(3*a^2)
 

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 

rule 3245
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + 
(f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*Cos[e + f*x]*(a + b*Sin[e + f*x])^ 
m*((c + d*Sin[e + f*x])^(n + 1)/(a*f*(2*m + 1)*(b*c - a*d))), x] + Simp[1/( 
a*(2*m + 1)*(b*c - a*d))   Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + 
f*x])^n*Simp[b*c*(m + 1) - a*d*(2*m + n + 2) + b*d*(m + n + 2)*Sin[e + f*x] 
, x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && EqQ 
[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[m, -1] &&  !GtQ[n, 0] && (Intege 
rsQ[2*m, 2*n] || (IntegerQ[m] && EqQ[c, 0]))
 

rule 3457
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*sin[(e_.) + 
(f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim 
p[b*(A*b - a*B)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x])^( 
n + 1)/(a*f*(2*m + 1)*(b*c - a*d))), x] + Simp[1/(a*(2*m + 1)*(b*c - a*d)) 
  Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[B*(a*c*m + b 
*d*(n + 1)) + A*(b*c*(m + 1) - a*d*(2*m + n + 2)) + d*(A*b - a*B)*(m + n + 
2)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ 
[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[m, -2^(-1)] 
 &&  !GtQ[n, 0] && IntegerQ[2*m] && (IntegerQ[2*n] || EqQ[c, 0])
 

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 
Maple [A] (verified)

Time = 0.34 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.24

method result size
default \(\frac {\tan \left (\frac {x}{2}\right )-\frac {8}{3 \left (\tan \left (\frac {x}{2}\right )+1\right )^{3}}+\frac {4}{\left (\tan \left (\frac {x}{2}\right )+1\right )^{2}}-\frac {12}{\tan \left (\frac {x}{2}\right )+1}-\frac {1}{\tan \left (\frac {x}{2}\right )}-4 \ln \left (\tan \left (\frac {x}{2}\right )\right )}{2 a^{2}}\) \(56\)
parallelrisch \(\frac {-12 \left (\tan \left (\frac {x}{2}\right )+1\right )^{3} \ln \left (\tan \left (\frac {x}{2}\right )\right )+3 \tan \left (\frac {x}{2}\right )^{4}-57 \tan \left (\frac {x}{2}\right )^{2}-3 \cot \left (\frac {x}{2}\right )-93 \tan \left (\frac {x}{2}\right )-50}{6 a^{2} \left (\tan \left (\frac {x}{2}\right )+1\right )^{3}}\) \(59\)
norman \(\frac {-\frac {1}{2 a}+\frac {\tan \left (\frac {x}{2}\right )^{5}}{2 a}-\frac {25 \tan \left (\frac {x}{2}\right )}{3 a}-\frac {31 \tan \left (\frac {x}{2}\right )^{2}}{2 a}-\frac {19 \tan \left (\frac {x}{2}\right )^{3}}{2 a}}{a \tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )+1\right )^{3}}-\frac {2 \ln \left (\tan \left (\frac {x}{2}\right )\right )}{a^{2}}\) \(78\)
risch \(-\frac {4 \left (-11 \,{\mathrm e}^{2 i x}+9 i {\mathrm e}^{3 i x}+5-12 i {\mathrm e}^{i x}+3 \,{\mathrm e}^{4 i x}\right )}{3 \left ({\mathrm e}^{2 i x}-1\right ) \left ({\mathrm e}^{i x}+i\right )^{3} a^{2}}+\frac {2 \ln \left ({\mathrm e}^{i x}+1\right )}{a^{2}}-\frac {2 \ln \left ({\mathrm e}^{i x}-1\right )}{a^{2}}\) \(84\)

Input:

int(csc(x)^2/(a+a*sin(x))^2,x,method=_RETURNVERBOSE)
 

Output:

1/2/a^2*(tan(1/2*x)-8/3/(tan(1/2*x)+1)^3+4/(tan(1/2*x)+1)^2-12/(tan(1/2*x) 
+1)-1/tan(1/2*x)-4*ln(tan(1/2*x)))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 168 vs. \(2 (41) = 82\).

Time = 0.13 (sec) , antiderivative size = 168, normalized size of antiderivative = 3.73 \[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=-\frac {10 \, \cos \left (x\right )^{3} - 4 \, \cos \left (x\right )^{2} - 3 \, {\left (\cos \left (x\right )^{3} + 2 \, \cos \left (x\right )^{2} + {\left (\cos \left (x\right )^{2} - \cos \left (x\right ) - 2\right )} \sin \left (x\right ) - \cos \left (x\right ) - 2\right )} \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) + 3 \, {\left (\cos \left (x\right )^{3} + 2 \, \cos \left (x\right )^{2} + {\left (\cos \left (x\right )^{2} - \cos \left (x\right ) - 2\right )} \sin \left (x\right ) - \cos \left (x\right ) - 2\right )} \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) - {\left (10 \, \cos \left (x\right )^{2} + 14 \, \cos \left (x\right ) + 1\right )} \sin \left (x\right ) - 13 \, \cos \left (x\right ) + 1}{3 \, {\left (a^{2} \cos \left (x\right )^{3} + 2 \, a^{2} \cos \left (x\right )^{2} - a^{2} \cos \left (x\right ) - 2 \, a^{2} + {\left (a^{2} \cos \left (x\right )^{2} - a^{2} \cos \left (x\right ) - 2 \, a^{2}\right )} \sin \left (x\right )\right )}} \] Input:

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

Output:

-1/3*(10*cos(x)^3 - 4*cos(x)^2 - 3*(cos(x)^3 + 2*cos(x)^2 + (cos(x)^2 - co 
s(x) - 2)*sin(x) - cos(x) - 2)*log(1/2*cos(x) + 1/2) + 3*(cos(x)^3 + 2*cos 
(x)^2 + (cos(x)^2 - cos(x) - 2)*sin(x) - cos(x) - 2)*log(-1/2*cos(x) + 1/2 
) - (10*cos(x)^2 + 14*cos(x) + 1)*sin(x) - 13*cos(x) + 1)/(a^2*cos(x)^3 + 
2*a^2*cos(x)^2 - a^2*cos(x) - 2*a^2 + (a^2*cos(x)^2 - a^2*cos(x) - 2*a^2)* 
sin(x))
 

Sympy [F]

\[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=\frac {\int \frac {\csc ^{2}{\left (x \right )}}{\sin ^{2}{\left (x \right )} + 2 \sin {\left (x \right )} + 1}\, dx}{a^{2}} \] Input:

integrate(csc(x)**2/(a+a*sin(x))**2,x)
 

Output:

Integral(csc(x)**2/(sin(x)**2 + 2*sin(x) + 1), x)/a**2
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 126 vs. \(2 (41) = 82\).

Time = 0.04 (sec) , antiderivative size = 126, normalized size of antiderivative = 2.80 \[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=-\frac {\frac {41 \, \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {69 \, \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + \frac {39 \, \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}} + 3}{6 \, {\left (\frac {a^{2} \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {3 \, a^{2} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + \frac {3 \, a^{2} \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}} + \frac {a^{2} \sin \left (x\right )^{4}}{{\left (\cos \left (x\right ) + 1\right )}^{4}}\right )}} - \frac {2 \, \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{a^{2}} + \frac {\sin \left (x\right )}{2 \, a^{2} {\left (\cos \left (x\right ) + 1\right )}} \] Input:

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

Output:

-1/6*(41*sin(x)/(cos(x) + 1) + 69*sin(x)^2/(cos(x) + 1)^2 + 39*sin(x)^3/(c 
os(x) + 1)^3 + 3)/(a^2*sin(x)/(cos(x) + 1) + 3*a^2*sin(x)^2/(cos(x) + 1)^2 
 + 3*a^2*sin(x)^3/(cos(x) + 1)^3 + a^2*sin(x)^4/(cos(x) + 1)^4) - 2*log(si 
n(x)/(cos(x) + 1))/a^2 + 1/2*sin(x)/(a^2*(cos(x) + 1))
 

Giac [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.53 \[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=-\frac {2 \, \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right )}{a^{2}} + \frac {\tan \left (\frac {1}{2} \, x\right )}{2 \, a^{2}} + \frac {4 \, \tan \left (\frac {1}{2} \, x\right ) - 1}{2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )} - \frac {2 \, {\left (9 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 15 \, \tan \left (\frac {1}{2} \, x\right ) + 8\right )}}{3 \, a^{2} {\left (\tan \left (\frac {1}{2} \, x\right ) + 1\right )}^{3}} \] Input:

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

Output:

-2*log(abs(tan(1/2*x)))/a^2 + 1/2*tan(1/2*x)/a^2 + 1/2*(4*tan(1/2*x) - 1)/ 
(a^2*tan(1/2*x)) - 2/3*(9*tan(1/2*x)^2 + 15*tan(1/2*x) + 8)/(a^2*(tan(1/2* 
x) + 1)^3)
 

Mupad [B] (verification not implemented)

Time = 17.32 (sec) , antiderivative size = 91, normalized size of antiderivative = 2.02 \[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=\frac {\mathrm {tan}\left (\frac {x}{2}\right )}{2\,a^2}-\frac {13\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3+23\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+\frac {41\,\mathrm {tan}\left (\frac {x}{2}\right )}{3}+1}{2\,a^2\,{\mathrm {tan}\left (\frac {x}{2}\right )}^4+6\,a^2\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3+6\,a^2\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,a^2\,\mathrm {tan}\left (\frac {x}{2}\right )}-\frac {2\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )}{a^2} \] Input:

int(1/(sin(x)^2*(a + a*sin(x))^2),x)
 

Output:

tan(x/2)/(2*a^2) - ((41*tan(x/2))/3 + 23*tan(x/2)^2 + 13*tan(x/2)^3 + 1)/( 
2*a^2*tan(x/2) + 6*a^2*tan(x/2)^2 + 6*a^2*tan(x/2)^3 + 2*a^2*tan(x/2)^4) - 
 (2*log(tan(x/2)))/a^2
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 117, normalized size of antiderivative = 2.60 \[ \int \frac {\csc ^2(x)}{(a+a \sin (x))^2} \, dx=\frac {-12 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )\right ) \tan \left (\frac {x}{2}\right )^{4}-36 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )\right ) \tan \left (\frac {x}{2}\right )^{3}-36 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )\right ) \tan \left (\frac {x}{2}\right )^{2}-12 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )\right ) \tan \left (\frac {x}{2}\right )+3 \tan \left (\frac {x}{2}\right )^{5}+19 \tan \left (\frac {x}{2}\right )^{4}-36 \tan \left (\frac {x}{2}\right )^{2}-31 \tan \left (\frac {x}{2}\right )-3}{6 \tan \left (\frac {x}{2}\right ) a^{2} \left (\tan \left (\frac {x}{2}\right )^{3}+3 \tan \left (\frac {x}{2}\right )^{2}+3 \tan \left (\frac {x}{2}\right )+1\right )} \] Input:

int(csc(x)^2/(a+a*sin(x))^2,x)
 

Output:

( - 12*log(tan(x/2))*tan(x/2)**4 - 36*log(tan(x/2))*tan(x/2)**3 - 36*log(t 
an(x/2))*tan(x/2)**2 - 12*log(tan(x/2))*tan(x/2) + 3*tan(x/2)**5 + 19*tan( 
x/2)**4 - 36*tan(x/2)**2 - 31*tan(x/2) - 3)/(6*tan(x/2)*a**2*(tan(x/2)**3 
+ 3*tan(x/2)**2 + 3*tan(x/2) + 1))