\(\int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx\) [30]

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

Optimal result

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

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(994\) vs. \(2(165)=330\).

Time = 6.68 (sec) , antiderivative size = 994, normalized size of antiderivative = 6.02 \[ \int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx =\text {Too large to display} \] Input:

Integrate[Csc[c + d*x]^5*(a + b*Tan[c + d*x])^2,x]
 

Output:

(b^2*Cos[c + d*x]^2*(a + b*Tan[c + d*x])^2)/(d*(a*Cos[c + d*x] + b*Sin[c + 
 d*x])^2) - (7*a*b*Cos[c + d*x]^2*Cot[(c + d*x)/2]*(a + b*Tan[c + d*x])^2) 
/(6*d*(a*Cos[c + d*x] + b*Sin[c + d*x])^2) + ((-3*a^2 - 4*b^2)*Cos[c + d*x 
]^2*Csc[(c + d*x)/2]^2*(a + b*Tan[c + d*x])^2)/(32*d*(a*Cos[c + d*x] + b*S 
in[c + d*x])^2) - (a*b*Cos[c + d*x]^2*Cot[(c + d*x)/2]*Csc[(c + d*x)/2]^2* 
(a + b*Tan[c + d*x])^2)/(12*d*(a*Cos[c + d*x] + b*Sin[c + d*x])^2) - (a^2* 
Cos[c + d*x]^2*Csc[(c + d*x)/2]^4*(a + b*Tan[c + d*x])^2)/(64*d*(a*Cos[c + 
 d*x] + b*Sin[c + d*x])^2) - (3*(a^2 + 4*b^2)*Cos[c + d*x]^2*Log[Cos[(c + 
d*x)/2]]*(a + b*Tan[c + d*x])^2)/(8*d*(a*Cos[c + d*x] + b*Sin[c + d*x])^2) 
 - (2*a*b*Cos[c + d*x]^2*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]]*(a + b*T 
an[c + d*x])^2)/(d*(a*Cos[c + d*x] + b*Sin[c + d*x])^2) + (3*(a^2 + 4*b^2) 
*Cos[c + d*x]^2*Log[Sin[(c + d*x)/2]]*(a + b*Tan[c + d*x])^2)/(8*d*(a*Cos[ 
c + d*x] + b*Sin[c + d*x])^2) + (2*a*b*Cos[c + d*x]^2*Log[Cos[(c + d*x)/2] 
 + Sin[(c + d*x)/2]]*(a + b*Tan[c + d*x])^2)/(d*(a*Cos[c + d*x] + b*Sin[c 
+ d*x])^2) + ((3*a^2 + 4*b^2)*Cos[c + d*x]^2*Sec[(c + d*x)/2]^2*(a + b*Tan 
[c + d*x])^2)/(32*d*(a*Cos[c + d*x] + b*Sin[c + d*x])^2) + (a^2*Cos[c + d* 
x]^2*Sec[(c + d*x)/2]^4*(a + b*Tan[c + d*x])^2)/(64*d*(a*Cos[c + d*x] + b* 
Sin[c + d*x])^2) + (b^2*Cos[c + d*x]^2*Sin[(c + d*x)/2]*(a + b*Tan[c + d*x 
])^2)/(d*(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])*(a*Cos[c + d*x] + b*Sin[c + 
 d*x])^2) - (b^2*Cos[c + d*x]^2*Sin[(c + d*x)/2]*(a + b*Tan[c + d*x])^2...
 

Rubi [A] (verified)

Time = 0.40 (sec) , antiderivative size = 165, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3042, 4000, 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 \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4000

\(\displaystyle \int \left (a^2 \csc ^5(c+d x)+2 a b \csc ^4(c+d x) \sec (c+d x)+b^2 \csc ^3(c+d x) \sec ^2(c+d x)\right )dx\)

\(\Big \downarrow \) 2009

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

Input:

Int[Csc[c + d*x]^5*(a + b*Tan[c + d*x])^2,x]
 

Output:

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

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 4000
Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n 
_.), x_Symbol] :> Int[Expand[Sin[e + f*x]^m*(a + b*Tan[e + f*x])^n, x], x] 
/; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] && IGtQ[n, 0]
 
Maple [A] (verified)

Time = 9.39 (sec) , antiderivative size = 145, normalized size of antiderivative = 0.88

method result size
derivativedivides \(\frac {b^{2} \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+2 a b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a^{2} \left (\left (-\frac {\csc \left (d x +c \right )^{3}}{4}-\frac {3 \csc \left (d x +c \right )}{8}\right ) \cot \left (d x +c \right )+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{8}\right )}{d}\) \(145\)
default \(\frac {b^{2} \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+2 a b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a^{2} \left (\left (-\frac {\csc \left (d x +c \right )^{3}}{4}-\frac {3 \csc \left (d x +c \right )}{8}\right ) \cot \left (d x +c \right )+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{8}\right )}{d}\) \(145\)
risch \(\frac {{\mathrm e}^{i \left (d x +c \right )} \left (9 a^{2} {\mathrm e}^{8 i \left (d x +c \right )}+36 b^{2} {\mathrm e}^{8 i \left (d x +c \right )}-48 i a b \,{\mathrm e}^{8 i \left (d x +c \right )}-24 a^{2} {\mathrm e}^{6 i \left (d x +c \right )}-96 b^{2} {\mathrm e}^{6 i \left (d x +c \right )}+160 i a b \,{\mathrm e}^{6 i \left (d x +c \right )}-66 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}+120 b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-24 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-96 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-160 i a b \,{\mathrm e}^{2 i \left (d x +c \right )}+9 a^{2}+36 b^{2}+48 i a b \right )}{12 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{4} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{8 d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b^{2}}{2 d}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{8 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b^{2}}{2 d}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}\) \(358\)

Input:

int(csc(d*x+c)^5*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)
 

Output:

1/d*(b^2*(-1/2/sin(d*x+c)^2/cos(d*x+c)+3/2/cos(d*x+c)+3/2*ln(csc(d*x+c)-co 
t(d*x+c)))+2*a*b*(-1/3/sin(d*x+c)^3-1/sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)) 
)+a^2*((-1/4*csc(d*x+c)^3-3/8*csc(d*x+c))*cot(d*x+c)+3/8*ln(csc(d*x+c)-cot 
(d*x+c))))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 333 vs. \(2 (151) = 302\).

Time = 0.12 (sec) , antiderivative size = 333, normalized size of antiderivative = 2.02 \[ \int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {18 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 30 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 48 \, b^{2} - 9 \, {\left ({\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{5} - 2 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{3} + {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 9 \, {\left ({\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{5} - 2 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{3} + {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 48 \, {\left (a b \cos \left (d x + c\right )^{5} - 2 \, a b \cos \left (d x + c\right )^{3} + a b \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 48 \, {\left (a b \cos \left (d x + c\right )^{5} - 2 \, a b \cos \left (d x + c\right )^{3} + a b \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 32 \, {\left (3 \, a b \cos \left (d x + c\right )^{3} - 4 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{48 \, {\left (d \cos \left (d x + c\right )^{5} - 2 \, d \cos \left (d x + c\right )^{3} + d \cos \left (d x + c\right )\right )}} \] Input:

integrate(csc(d*x+c)^5*(a+b*tan(d*x+c))^2,x, algorithm="fricas")
 

Output:

1/48*(18*(a^2 + 4*b^2)*cos(d*x + c)^4 - 30*(a^2 + 4*b^2)*cos(d*x + c)^2 + 
48*b^2 - 9*((a^2 + 4*b^2)*cos(d*x + c)^5 - 2*(a^2 + 4*b^2)*cos(d*x + c)^3 
+ (a^2 + 4*b^2)*cos(d*x + c))*log(1/2*cos(d*x + c) + 1/2) + 9*((a^2 + 4*b^ 
2)*cos(d*x + c)^5 - 2*(a^2 + 4*b^2)*cos(d*x + c)^3 + (a^2 + 4*b^2)*cos(d*x 
 + c))*log(-1/2*cos(d*x + c) + 1/2) + 48*(a*b*cos(d*x + c)^5 - 2*a*b*cos(d 
*x + c)^3 + a*b*cos(d*x + c))*log(sin(d*x + c) + 1) - 48*(a*b*cos(d*x + c) 
^5 - 2*a*b*cos(d*x + c)^3 + a*b*cos(d*x + c))*log(-sin(d*x + c) + 1) + 32* 
(3*a*b*cos(d*x + c)^3 - 4*a*b*cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c)^ 
5 - 2*d*cos(d*x + c)^3 + d*cos(d*x + c))
 

Sympy [F]

\[ \int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \csc ^{5}{\left (c + d x \right )}\, dx \] Input:

integrate(csc(d*x+c)**5*(a+b*tan(d*x+c))**2,x)
 

Output:

Integral((a + b*tan(c + d*x))**2*csc(c + d*x)**5, x)
 

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 187, normalized size of antiderivative = 1.13 \[ \int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {3 \, a^{2} {\left (\frac {2 \, {\left (3 \, \cos \left (d x + c\right )^{3} - 5 \, \cos \left (d x + c\right )\right )}}{\cos \left (d x + c\right )^{4} - 2 \, \cos \left (d x + c\right )^{2} + 1} - 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + 12 \, b^{2} {\left (\frac {2 \, {\left (3 \, \cos \left (d x + c\right )^{2} - 2\right )}}{\cos \left (d x + c\right )^{3} - \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 )} - 16 \, a b {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{2} + 1\right )}}{\sin \left (d x + c\right )^{3}} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )}}{48 \, d} \] Input:

integrate(csc(d*x+c)^5*(a+b*tan(d*x+c))^2,x, algorithm="maxima")
 

Output:

1/48*(3*a^2*(2*(3*cos(d*x + c)^3 - 5*cos(d*x + c))/(cos(d*x + c)^4 - 2*cos 
(d*x + c)^2 + 1) - 3*log(cos(d*x + c) + 1) + 3*log(cos(d*x + c) - 1)) + 12 
*b^2*(2*(3*cos(d*x + c)^2 - 2)/(cos(d*x + c)^3 - cos(d*x + c)) - 3*log(cos 
(d*x + c) + 1) + 3*log(cos(d*x + c) - 1)) - 16*a*b*(2*(3*sin(d*x + c)^2 + 
1)/sin(d*x + c)^3 - 3*log(sin(d*x + c) + 1) + 3*log(sin(d*x + c) - 1)))/d
 

Giac [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 269, normalized size of antiderivative = 1.63 \[ \int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 16 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 24 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 384 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 384 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - 240 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 72 \, {\left (a^{2} + 4 \, b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - \frac {384 \, b^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} - \frac {150 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 600 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 240 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 24 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 16 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4}}}{192 \, d} \] Input:

integrate(csc(d*x+c)^5*(a+b*tan(d*x+c))^2,x, algorithm="giac")
 

Output:

1/192*(3*a^2*tan(1/2*d*x + 1/2*c)^4 - 16*a*b*tan(1/2*d*x + 1/2*c)^3 + 24*a 
^2*tan(1/2*d*x + 1/2*c)^2 + 24*b^2*tan(1/2*d*x + 1/2*c)^2 + 384*a*b*log(ab 
s(tan(1/2*d*x + 1/2*c) + 1)) - 384*a*b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) 
- 240*a*b*tan(1/2*d*x + 1/2*c) + 72*(a^2 + 4*b^2)*log(abs(tan(1/2*d*x + 1/ 
2*c))) - 384*b^2/(tan(1/2*d*x + 1/2*c)^2 - 1) - (150*a^2*tan(1/2*d*x + 1/2 
*c)^4 + 600*b^2*tan(1/2*d*x + 1/2*c)^4 + 240*a*b*tan(1/2*d*x + 1/2*c)^3 + 
24*a^2*tan(1/2*d*x + 1/2*c)^2 + 24*b^2*tan(1/2*d*x + 1/2*c)^2 + 16*a*b*tan 
(1/2*d*x + 1/2*c) + 3*a^2)/tan(1/2*d*x + 1/2*c)^4)/d
 

Mupad [B] (verification not implemented)

Time = 0.93 (sec) , antiderivative size = 378, normalized size of antiderivative = 2.29 \[ \int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (\frac {3\,a^2}{8}+\frac {3\,b^2}{2}\right )}{d}+\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{64\,d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {7\,a^2}{4}+2\,b^2\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (2\,a^2+34\,b^2\right )+\frac {a^2}{4}+\frac {56\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{3}-20\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\frac {4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{3}}{d\,\left (16\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-16\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6\right )}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {a^2}{8}+\frac {b^2}{8}\right )}{d}-\frac {a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{12\,d}+\frac {4\,a\,b\,\mathrm {atanh}\left (\frac {12\,a\,b^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{3\,a^3\,b-16\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^2+12\,a\,b^3}-\frac {16\,a^2\,b^2}{3\,a^3\,b-16\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^2+12\,a\,b^3}+\frac {3\,a^3\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{3\,a^3\,b-16\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^2+12\,a\,b^3}\right )}{d}-\frac {5\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,d} \] Input:

int((a + b*tan(c + d*x))^2/sin(c + d*x)^5,x)
 

Output:

(log(tan(c/2 + (d*x)/2))*((3*a^2)/8 + (3*b^2)/2))/d + (a^2*tan(c/2 + (d*x) 
/2)^4)/(64*d) - (tan(c/2 + (d*x)/2)^2*((7*a^2)/4 + 2*b^2) - tan(c/2 + (d*x 
)/2)^4*(2*a^2 + 34*b^2) + a^2/4 + (56*a*b*tan(c/2 + (d*x)/2)^3)/3 - 20*a*b 
*tan(c/2 + (d*x)/2)^5 + (4*a*b*tan(c/2 + (d*x)/2))/3)/(d*(16*tan(c/2 + (d* 
x)/2)^4 - 16*tan(c/2 + (d*x)/2)^6)) + (tan(c/2 + (d*x)/2)^2*(a^2/8 + b^2/8 
))/d - (a*b*tan(c/2 + (d*x)/2)^3)/(12*d) + (4*a*b*atanh((12*a*b^3*tan(c/2 
+ (d*x)/2))/(12*a*b^3 + 3*a^3*b - 16*a^2*b^2*tan(c/2 + (d*x)/2)) - (16*a^2 
*b^2)/(12*a*b^3 + 3*a^3*b - 16*a^2*b^2*tan(c/2 + (d*x)/2)) + (3*a^3*b*tan( 
c/2 + (d*x)/2))/(12*a*b^3 + 3*a^3*b - 16*a^2*b^2*tan(c/2 + (d*x)/2))))/d - 
 (5*a*b*tan(c/2 + (d*x)/2))/(4*d)
 

Reduce [B] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 269, normalized size of antiderivative = 1.63 \[ \int \csc ^5(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {-48 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \sin \left (d x +c \right )^{4} a b +48 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \sin \left (d x +c \right )^{4} a b +9 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{4} a^{2}+36 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{4} b^{2}-3 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4} a^{2}-27 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4} b^{2}-48 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{3} a b -16 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a b +9 \sin \left (d x +c \right )^{4} a^{2}+36 \sin \left (d x +c \right )^{4} b^{2}-3 \sin \left (d x +c \right )^{2} a^{2}-12 \sin \left (d x +c \right )^{2} b^{2}-6 a^{2}}{24 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4} d} \] Input:

int(csc(d*x+c)^5*(a+b*tan(d*x+c))^2,x)
 

Output:

( - 48*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**4*a*b + 48*cos 
(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**4*a*b + 9*cos(c + d*x)*l 
og(tan((c + d*x)/2))*sin(c + d*x)**4*a**2 + 36*cos(c + d*x)*log(tan((c + d 
*x)/2))*sin(c + d*x)**4*b**2 - 3*cos(c + d*x)*sin(c + d*x)**4*a**2 - 27*co 
s(c + d*x)*sin(c + d*x)**4*b**2 - 48*cos(c + d*x)*sin(c + d*x)**3*a*b - 16 
*cos(c + d*x)*sin(c + d*x)*a*b + 9*sin(c + d*x)**4*a**2 + 36*sin(c + d*x)* 
*4*b**2 - 3*sin(c + d*x)**2*a**2 - 12*sin(c + d*x)**2*b**2 - 6*a**2)/(24*c 
os(c + d*x)*sin(c + d*x)**4*d)