\(\int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx\) [24]

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

Optimal result

Integrand size = 21, antiderivative size = 98 \[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=-\frac {a^2 x}{2}+\frac {3 a^2 \text {arctanh}(\cos (c+d x))}{d}-\frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {a^2 \cot (c+d x) \csc (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d} \] Output:

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

Mathematica [A] (verified)

Time = 11.01 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.95 \[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {a^2 (1+\sin (c+d x))^2 \left (-12 (c+d x)-48 \cos (c+d x)+4 \cot \left (\frac {1}{2} (c+d x)\right )-6 \csc ^2\left (\frac {1}{2} (c+d x)\right )+72 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-72 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+6 \sec ^2\left (\frac {1}{2} (c+d x)\right )+8 \csc ^3(c+d x) \sin ^4\left (\frac {1}{2} (c+d x)\right )-\frac {1}{2} \csc ^4\left (\frac {1}{2} (c+d x)\right ) \sin (c+d x)-6 \sin (2 (c+d x))-4 \tan \left (\frac {1}{2} (c+d x)\right )\right )}{24 d \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^4} \] Input:

Integrate[Cot[c + d*x]^4*(a + a*Sin[c + d*x])^2,x]
 

Output:

(a^2*(1 + Sin[c + d*x])^2*(-12*(c + d*x) - 48*Cos[c + d*x] + 4*Cot[(c + d* 
x)/2] - 6*Csc[(c + d*x)/2]^2 + 72*Log[Cos[(c + d*x)/2]] - 72*Log[Sin[(c + 
d*x)/2]] + 6*Sec[(c + d*x)/2]^2 + 8*Csc[c + d*x]^3*Sin[(c + d*x)/2]^4 - (C 
sc[(c + d*x)/2]^4*Sin[c + d*x])/2 - 6*Sin[2*(c + d*x)] - 4*Tan[(c + d*x)/2 
]))/(24*d*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^4)
 

Rubi [A] (verified)

Time = 0.37 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.04, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3042, 3188, 2009}

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 \cot ^4(c+d x) (a \sin (c+d x)+a)^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a \sin (c+d x)+a)^2}{\tan (c+d x)^4}dx\)

\(\Big \downarrow \) 3188

\(\displaystyle \frac {\int \left (\csc ^4(c+d x) a^6+2 \csc ^3(c+d x) a^6-\csc ^2(c+d x) a^6+\sin ^2(c+d x) a^6-4 \csc (c+d x) a^6+2 \sin (c+d x) a^6-a^6\right )dx}{a^4}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {\frac {3 a^6 \text {arctanh}(\cos (c+d x))}{d}-\frac {2 a^6 \cos (c+d x)}{d}-\frac {a^6 \cot ^3(c+d x)}{3 d}-\frac {a^6 \sin (c+d x) \cos (c+d x)}{2 d}-\frac {a^6 \cot (c+d x) \csc (c+d x)}{d}-\frac {a^6 x}{2}}{a^4}\)

Input:

Int[Cot[c + d*x]^4*(a + a*Sin[c + d*x])^2,x]
 

Output:

(-1/2*(a^6*x) + (3*a^6*ArcTanh[Cos[c + d*x]])/d - (2*a^6*Cos[c + d*x])/d - 
 (a^6*Cot[c + d*x]^3)/(3*d) - (a^6*Cot[c + d*x]*Csc[c + d*x])/d - (a^6*Cos 
[c + d*x]*Sin[c + d*x])/(2*d))/a^4
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 3188
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*tan[(e_.) + (f_.)*(x_)]^(p_ 
), x_Symbol] :> Simp[a^p   Int[ExpandIntegrand[Sin[e + f*x]^p*((a + b*Sin[e 
 + f*x])^(m - p/2)/(a - b*Sin[e + f*x])^(p/2)), x], x], x] /; FreeQ[{a, b, 
e, f}, x] && EqQ[a^2 - b^2, 0] && IntegersQ[m, p/2] && (LtQ[p, 0] || GtQ[m 
- p/2, 0])
 
Maple [A] (verified)

Time = 1.33 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.49

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {\cos \left (d x +c \right )^{5}}{\sin \left (d x +c \right )}-\left (\cos \left (d x +c \right )^{3}+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+2 a^{2} \left (-\frac {\cos \left (d x +c \right )^{5}}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )^{3}}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\cot \left (d x +c \right )^{3}}{3}+\cot \left (d x +c \right )+d x +c \right )}{d}\) \(146\)
default \(\frac {a^{2} \left (-\frac {\cos \left (d x +c \right )^{5}}{\sin \left (d x +c \right )}-\left (\cos \left (d x +c \right )^{3}+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+2 a^{2} \left (-\frac {\cos \left (d x +c \right )^{5}}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )^{3}}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\cot \left (d x +c \right )^{3}}{3}+\cot \left (d x +c \right )+d x +c \right )}{d}\) \(146\)
risch \(-\frac {a^{2} x}{2}+\frac {i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}-\frac {a^{2} {\mathrm e}^{i \left (d x +c \right )}}{d}-\frac {a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{d}-\frac {i a^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 a^{2} \left (3 i {\mathrm e}^{4 i \left (d x +c \right )}+3 \,{\mathrm e}^{5 i \left (d x +c \right )}+i-3 \,{\mathrm e}^{i \left (d x +c \right )}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}\) \(176\)

Input:

int(cot(d*x+c)^4*(a+a*sin(d*x+c))^2,x,method=_RETURNVERBOSE)
 

Output:

1/d*(a^2*(-1/sin(d*x+c)*cos(d*x+c)^5-(cos(d*x+c)^3+3/2*cos(d*x+c))*sin(d*x 
+c)-3/2*d*x-3/2*c)+2*a^2*(-1/2/sin(d*x+c)^2*cos(d*x+c)^5-1/2*cos(d*x+c)^3- 
3/2*cos(d*x+c)-3/2*ln(csc(d*x+c)-cot(d*x+c)))+a^2*(-1/3*cot(d*x+c)^3+cot(d 
*x+c)+d*x+c))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 192 vs. \(2 (92) = 184\).

Time = 0.11 (sec) , antiderivative size = 192, normalized size of antiderivative = 1.96 \[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {3 \, a^{2} \cos \left (d x + c\right )^{5} - 4 \, a^{2} \cos \left (d x + c\right )^{3} + 3 \, a^{2} \cos \left (d x + c\right ) + 9 \, {\left (a^{2} \cos \left (d x + c\right )^{2} - a^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 9 \, {\left (a^{2} \cos \left (d x + c\right )^{2} - a^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 3 \, {\left (a^{2} d x \cos \left (d x + c\right )^{2} + 4 \, a^{2} \cos \left (d x + c\right )^{3} - a^{2} d x - 6 \, a^{2} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right )} \] Input:

integrate(cot(d*x+c)^4*(a+a*sin(d*x+c))^2,x, algorithm="fricas")
 

Output:

1/6*(3*a^2*cos(d*x + c)^5 - 4*a^2*cos(d*x + c)^3 + 3*a^2*cos(d*x + c) + 9* 
(a^2*cos(d*x + c)^2 - a^2)*log(1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - 9*(a 
^2*cos(d*x + c)^2 - a^2)*log(-1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - 3*(a^ 
2*d*x*cos(d*x + c)^2 + 4*a^2*cos(d*x + c)^3 - a^2*d*x - 6*a^2*cos(d*x + c) 
)*sin(d*x + c))/((d*cos(d*x + c)^2 - d)*sin(d*x + c))
 

Sympy [F]

\[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=a^{2} \left (\int 2 \sin {\left (c + d x \right )} \cot ^{4}{\left (c + d x \right )}\, dx + \int \sin ^{2}{\left (c + d x \right )} \cot ^{4}{\left (c + d x \right )}\, dx + \int \cot ^{4}{\left (c + d x \right )}\, dx\right ) \] Input:

integrate(cot(d*x+c)**4*(a+a*sin(d*x+c))**2,x)
 

Output:

a**2*(Integral(2*sin(c + d*x)*cot(c + d*x)**4, x) + Integral(sin(c + d*x)* 
*2*cot(c + d*x)**4, x) + Integral(cot(c + d*x)**4, x))
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 139, normalized size of antiderivative = 1.42 \[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=-\frac {3 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} + 2}{\tan \left (d x + c\right )^{3} + \tan \left (d x + c\right )}\right )} a^{2} - 2 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} - 1}{\tan \left (d x + c\right )^{3}}\right )} a^{2} - 3 \, a^{2} {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} - 4 \, \cos \left (d x + c\right ) + 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) - 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{6 \, d} \] Input:

integrate(cot(d*x+c)^4*(a+a*sin(d*x+c))^2,x, algorithm="maxima")
 

Output:

-1/6*(3*(3*d*x + 3*c + (3*tan(d*x + c)^2 + 2)/(tan(d*x + c)^3 + tan(d*x + 
c)))*a^2 - 2*(3*d*x + 3*c + (3*tan(d*x + c)^2 - 1)/tan(d*x + c)^3)*a^2 - 3 
*a^2*(2*cos(d*x + c)/(cos(d*x + c)^2 - 1) - 4*cos(d*x + c) + 3*log(cos(d*x 
 + c) + 1) - 3*log(cos(d*x + c) - 1)))/d
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 209 vs. \(2 (92) = 184\).

Time = 0.17 (sec) , antiderivative size = 209, normalized size of antiderivative = 2.13 \[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, {\left (d x + c\right )} a^{2} - 72 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {24 \, {\left (a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, a^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}} + \frac {132 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 6 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \] Input:

integrate(cot(d*x+c)^4*(a+a*sin(d*x+c))^2,x, algorithm="giac")
 

Output:

1/24*(a^2*tan(1/2*d*x + 1/2*c)^3 + 6*a^2*tan(1/2*d*x + 1/2*c)^2 - 12*(d*x 
+ c)*a^2 - 72*a^2*log(abs(tan(1/2*d*x + 1/2*c))) - 3*a^2*tan(1/2*d*x + 1/2 
*c) + 24*(a^2*tan(1/2*d*x + 1/2*c)^3 - 4*a^2*tan(1/2*d*x + 1/2*c)^2 - a^2* 
tan(1/2*d*x + 1/2*c) - 4*a^2)/(tan(1/2*d*x + 1/2*c)^2 + 1)^2 + (132*a^2*ta 
n(1/2*d*x + 1/2*c)^3 + 3*a^2*tan(1/2*d*x + 1/2*c)^2 - 6*a^2*tan(1/2*d*x + 
1/2*c) - a^2)/tan(1/2*d*x + 1/2*c)^3)/d
 

Mupad [B] (verification not implemented)

Time = 17.72 (sec) , antiderivative size = 293, normalized size of antiderivative = 2.99 \[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{4\,d}+\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{24\,d}-\frac {3\,a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {a^2\,\mathrm {atan}\left (\frac {a^4}{6\,a^4-a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {6\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{6\,a^4-a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {-9\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+34\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\frac {19\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{3}+36\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{3}+2\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\frac {a^2}{3}}{d\,\left (8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+16\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )}-\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{8\,d} \] Input:

int(cot(c + d*x)^4*(a + a*sin(c + d*x))^2,x)
 

Output:

(a^2*tan(c/2 + (d*x)/2)^2)/(4*d) + (a^2*tan(c/2 + (d*x)/2)^3)/(24*d) - (3* 
a^2*log(tan(c/2 + (d*x)/2)))/d - (a^2*atan(a^4/(6*a^4 - a^4*tan(c/2 + (d*x 
)/2)) + (6*a^4*tan(c/2 + (d*x)/2))/(6*a^4 - a^4*tan(c/2 + (d*x)/2))))/d - 
(36*a^2*tan(c/2 + (d*x)/2)^3 - (a^2*tan(c/2 + (d*x)/2)^2)/3 + (19*a^2*tan( 
c/2 + (d*x)/2)^4)/3 + 34*a^2*tan(c/2 + (d*x)/2)^5 - 9*a^2*tan(c/2 + (d*x)/ 
2)^6 + a^2/3 + 2*a^2*tan(c/2 + (d*x)/2))/(d*(8*tan(c/2 + (d*x)/2)^3 + 16*t 
an(c/2 + (d*x)/2)^5 + 8*tan(c/2 + (d*x)/2)^7)) - (a^2*tan(c/2 + (d*x)/2))/ 
(8*d)
 

Reduce [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.32 \[ \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {a^{2} \left (-3 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4}-12 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{3}+2 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2}-6 \cos \left (d x +c \right ) \sin \left (d x +c \right )-2 \cos \left (d x +c \right )-18 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{3}-3 \sin \left (d x +c \right )^{3} d x +15 \sin \left (d x +c \right )^{3}\right )}{6 \sin \left (d x +c \right )^{3} d} \] Input:

int(cot(d*x+c)^4*(a+a*sin(d*x+c))^2,x)
 

Output:

(a**2*( - 3*cos(c + d*x)*sin(c + d*x)**4 - 12*cos(c + d*x)*sin(c + d*x)**3 
 + 2*cos(c + d*x)*sin(c + d*x)**2 - 6*cos(c + d*x)*sin(c + d*x) - 2*cos(c 
+ d*x) - 18*log(tan((c + d*x)/2))*sin(c + d*x)**3 - 3*sin(c + d*x)**3*d*x 
+ 15*sin(c + d*x)**3))/(6*sin(c + d*x)**3*d)