\(\int \cot (c+d x) (a+b \tan (c+d x))^3 (B \tan (c+d x)+C \tan ^2(c+d x)) \, dx\) [18]

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

Optimal result

Integrand size = 38, antiderivative size = 140 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\left (a^3 B-3 a b^2 B-3 a^2 b C+b^3 C\right ) x-\frac {\left (3 a^2 b B-b^3 B+a^3 C-3 a b^2 C\right ) \log (\cos (c+d x))}{d}+\frac {b \left (2 a b B+a^2 C-b^2 C\right ) \tan (c+d x)}{d}+\frac {(b B+a C) (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 d} \] Output:

(B*a^3-3*B*a*b^2-3*C*a^2*b+C*b^3)*x-(3*B*a^2*b-B*b^3+C*a^3-3*C*a*b^2)*ln(c 
os(d*x+c))/d+b*(2*B*a*b+C*a^2-C*b^2)*tan(d*x+c)/d+1/2*(B*b+C*a)*(a+b*tan(d 
*x+c))^2/d+1/3*C*(a+b*tan(d*x+c))^3/d
                                                                                    
                                                                                    
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.73 (sec) , antiderivative size = 130, normalized size of antiderivative = 0.93 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {3 (a+i b)^3 (-i B+C) \log (i-\tan (c+d x))+3 (a-i b)^3 (i B+C) \log (i+\tan (c+d x))+6 b \left (3 a b B+3 a^2 C-b^2 C\right ) \tan (c+d x)+3 b^2 (b B+3 a C) \tan ^2(c+d x)+2 b^3 C \tan ^3(c+d x)}{6 d} \] Input:

Integrate[Cot[c + d*x]*(a + b*Tan[c + d*x])^3*(B*Tan[c + d*x] + C*Tan[c + 
d*x]^2),x]
 

Output:

(3*(a + I*b)^3*((-I)*B + C)*Log[I - Tan[c + d*x]] + 3*(a - I*b)^3*(I*B + C 
)*Log[I + Tan[c + d*x]] + 6*b*(3*a*b*B + 3*a^2*C - b^2*C)*Tan[c + d*x] + 3 
*b^2*(b*B + 3*a*C)*Tan[c + d*x]^2 + 2*b^3*C*Tan[c + d*x]^3)/(6*d)
 

Rubi [A] (verified)

Time = 1.24 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {3042, 4115, 3042, 4011, 3042, 4011, 3042, 4008, 3042, 3956}

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 (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan (c+d x)^2\right )}{\tan (c+d x)}dx\)

\(\Big \downarrow \) 4115

\(\displaystyle \int (a+b \tan (c+d x))^3 (B+C \tan (c+d x))dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x))^3 (B+C \tan (c+d x))dx\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (c+d x))^2 (a B-b C+(b B+a C) \tan (c+d x))dx+\frac {C (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x))^2 (a B-b C+(b B+a C) \tan (c+d x))dx+\frac {C (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (c+d x)) \left (B a^2-2 b C a-b^2 B+\left (C a^2+2 b B a-b^2 C\right ) \tan (c+d x)\right )dx+\frac {(a C+b B) (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x)) \left (B a^2-2 b C a-b^2 B+\left (C a^2+2 b B a-b^2 C\right ) \tan (c+d x)\right )dx+\frac {(a C+b B) (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 4008

\(\displaystyle \left (a^3 C+3 a^2 b B-3 a b^2 C-b^3 B\right ) \int \tan (c+d x)dx+\frac {b \left (a^2 C+2 a b B-b^2 C\right ) \tan (c+d x)}{d}+x \left (a^3 B-3 a^2 b C-3 a b^2 B+b^3 C\right )+\frac {(a C+b B) (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \left (a^3 C+3 a^2 b B-3 a b^2 C-b^3 B\right ) \int \tan (c+d x)dx+\frac {b \left (a^2 C+2 a b B-b^2 C\right ) \tan (c+d x)}{d}+x \left (a^3 B-3 a^2 b C-3 a b^2 B+b^3 C\right )+\frac {(a C+b B) (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {b \left (a^2 C+2 a b B-b^2 C\right ) \tan (c+d x)}{d}-\frac {\left (a^3 C+3 a^2 b B-3 a b^2 C-b^3 B\right ) \log (\cos (c+d x))}{d}+x \left (a^3 B-3 a^2 b C-3 a b^2 B+b^3 C\right )+\frac {(a C+b B) (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 d}\)

Input:

Int[Cot[c + d*x]*(a + b*Tan[c + d*x])^3*(B*Tan[c + d*x] + C*Tan[c + d*x]^2 
),x]
 

Output:

(a^3*B - 3*a*b^2*B - 3*a^2*b*C + b^3*C)*x - ((3*a^2*b*B - b^3*B + a^3*C - 
3*a*b^2*C)*Log[Cos[c + d*x]])/d + (b*(2*a*b*B + a^2*C - b^2*C)*Tan[c + d*x 
])/d + ((b*B + a*C)*(a + b*Tan[c + d*x])^2)/(2*d) + (C*(a + b*Tan[c + d*x] 
)^3)/(3*d)
 

Defintions of rubi rules used

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

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[m, 0]
 

rule 4115
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) 
+ (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_ 
.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[1/b^2   Int[(a + b*Tan[e + f*x])^(m 
+ 1)*(c + d*Tan[e + f*x])^n*(b*B - a*C + b*C*Tan[e + f*x]), x], x] /; FreeQ 
[{a, b, c, d, e, f, A, B, C, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - 
a*b*B + a^2*C, 0]
 
Maple [A] (verified)

Time = 0.19 (sec) , antiderivative size = 139, normalized size of antiderivative = 0.99

method result size
parallelrisch \(\frac {3 \left (3 B \,a^{2} b -B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (\sec \left (d x +c \right )^{2}\right )+2 C \,b^{3} \tan \left (d x +c \right )^{3}+3 \left (B \,b^{3}+3 C a \,b^{2}\right ) \tan \left (d x +c \right )^{2}+6 \left (3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) \tan \left (d x +c \right )+6 d x \left (B \,a^{3}-3 B a \,b^{2}-3 C \,a^{2} b +C \,b^{3}\right )}{6 d}\) \(139\)
norman \(\left (B \,a^{3}-3 B a \,b^{2}-3 C \,a^{2} b +C \,b^{3}\right ) x +\frac {b \left (3 B a b +3 C \,a^{2}-C \,b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {C \,b^{3} \tan \left (d x +c \right )^{3}}{3 d}+\frac {b^{2} \left (B b +3 C a \right ) \tan \left (d x +c \right )^{2}}{2 d}+\frac {\left (3 B \,a^{2} b -B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}\) \(141\)
derivativedivides \(\frac {\frac {C \,b^{3} \tan \left (d x +c \right )^{3}}{3}+\frac {B \,b^{3} \tan \left (d x +c \right )^{2}}{2}+\frac {3 C a \,b^{2} \tan \left (d x +c \right )^{2}}{2}+3 B a \,b^{2} \tan \left (d x +c \right )+3 C \,a^{2} b \tan \left (d x +c \right )-C \,b^{3} \tan \left (d x +c \right )+\frac {\left (3 B \,a^{2} b -B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (B \,a^{3}-3 B a \,b^{2}-3 C \,a^{2} b +C \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(159\)
default \(\frac {\frac {C \,b^{3} \tan \left (d x +c \right )^{3}}{3}+\frac {B \,b^{3} \tan \left (d x +c \right )^{2}}{2}+\frac {3 C a \,b^{2} \tan \left (d x +c \right )^{2}}{2}+3 B a \,b^{2} \tan \left (d x +c \right )+3 C \,a^{2} b \tan \left (d x +c \right )-C \,b^{3} \tan \left (d x +c \right )+\frac {\left (3 B \,a^{2} b -B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (B \,a^{3}-3 B a \,b^{2}-3 C \,a^{2} b +C \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(159\)
risch \(B \,a^{3} x -3 B a \,b^{2} x -3 C \,a^{2} b x +C \,b^{3} x +3 i B \,a^{2} b x +i C \,a^{3} x -\frac {2 i B \,b^{3} c}{d}+\frac {6 i B \,a^{2} b c}{d}-3 i C a \,b^{2} x -\frac {6 i C a \,b^{2} c}{d}+\frac {2 i C \,a^{3} c}{d}-i B \,b^{3} x +\frac {2 i b \left (-3 i B \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-9 i C a b \,{\mathrm e}^{4 i \left (d x +c \right )}+9 B a b \,{\mathrm e}^{4 i \left (d x +c \right )}+9 C \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-3 i B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-9 i C a b \,{\mathrm e}^{2 i \left (d x +c \right )}+18 B a b \,{\mathrm e}^{2 i \left (d x +c \right )}+18 C \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+9 B a b +9 C \,a^{2}-4 C \,b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,a^{2} b}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,b^{3}}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C \,a^{3}}{d}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C a \,b^{2}}{d}\) \(383\)

Input:

int(cot(d*x+c)*(a+b*tan(d*x+c))^3*(B*tan(d*x+c)+C*tan(d*x+c)^2),x,method=_ 
RETURNVERBOSE)
 

Output:

1/6*(3*(3*B*a^2*b-B*b^3+C*a^3-3*C*a*b^2)*ln(sec(d*x+c)^2)+2*C*b^3*tan(d*x+ 
c)^3+3*(B*b^3+3*C*a*b^2)*tan(d*x+c)^2+6*(3*B*a*b^2+3*C*a^2*b-C*b^3)*tan(d* 
x+c)+6*d*x*(B*a^3-3*B*a*b^2-3*C*a^2*b+C*b^3))/d
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.01 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {2 \, C b^{3} \tan \left (d x + c\right )^{3} + 6 \, {\left (B a^{3} - 3 \, C a^{2} b - 3 \, B a b^{2} + C b^{3}\right )} d x + 3 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \tan \left (d x + c\right )^{2} - 3 \, {\left (C a^{3} + 3 \, B a^{2} b - 3 \, C a b^{2} - B b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (3 \, C a^{2} b + 3 \, B a b^{2} - C b^{3}\right )} \tan \left (d x + c\right )}{6 \, d} \] Input:

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^3*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, a 
lgorithm="fricas")
 

Output:

1/6*(2*C*b^3*tan(d*x + c)^3 + 6*(B*a^3 - 3*C*a^2*b - 3*B*a*b^2 + C*b^3)*d* 
x + 3*(3*C*a*b^2 + B*b^3)*tan(d*x + c)^2 - 3*(C*a^3 + 3*B*a^2*b - 3*C*a*b^ 
2 - B*b^3)*log(1/(tan(d*x + c)^2 + 1)) + 6*(3*C*a^2*b + 3*B*a*b^2 - C*b^3) 
*tan(d*x + c))/d
 

Sympy [A] (verification not implemented)

Time = 0.71 (sec) , antiderivative size = 248, normalized size of antiderivative = 1.77 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\begin {cases} B a^{3} x + \frac {3 B a^{2} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 3 B a b^{2} x + \frac {3 B a b^{2} \tan {\left (c + d x \right )}}{d} - \frac {B b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b^{3} \tan ^{2}{\left (c + d x \right )}}{2 d} + \frac {C a^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 3 C a^{2} b x + \frac {3 C a^{2} b \tan {\left (c + d x \right )}}{d} - \frac {3 C a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {3 C a b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} + C b^{3} x + \frac {C b^{3} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {C b^{3} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{3} \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \cot {\left (c \right )} & \text {otherwise} \end {cases} \] Input:

integrate(cot(d*x+c)*(a+b*tan(d*x+c))**3*(B*tan(d*x+c)+C*tan(d*x+c)**2),x)
 

Output:

Piecewise((B*a**3*x + 3*B*a**2*b*log(tan(c + d*x)**2 + 1)/(2*d) - 3*B*a*b* 
*2*x + 3*B*a*b**2*tan(c + d*x)/d - B*b**3*log(tan(c + d*x)**2 + 1)/(2*d) + 
 B*b**3*tan(c + d*x)**2/(2*d) + C*a**3*log(tan(c + d*x)**2 + 1)/(2*d) - 3* 
C*a**2*b*x + 3*C*a**2*b*tan(c + d*x)/d - 3*C*a*b**2*log(tan(c + d*x)**2 + 
1)/(2*d) + 3*C*a*b**2*tan(c + d*x)**2/(2*d) + C*b**3*x + C*b**3*tan(c + d* 
x)**3/(3*d) - C*b**3*tan(c + d*x)/d, Ne(d, 0)), (x*(a + b*tan(c))**3*(B*ta 
n(c) + C*tan(c)**2)*cot(c), True))
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.02 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {2 \, C b^{3} \tan \left (d x + c\right )^{3} + 3 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \tan \left (d x + c\right )^{2} + 6 \, {\left (B a^{3} - 3 \, C a^{2} b - 3 \, B a b^{2} + C b^{3}\right )} {\left (d x + c\right )} + 3 \, {\left (C a^{3} + 3 \, B a^{2} b - 3 \, C a b^{2} - B b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (3 \, C a^{2} b + 3 \, B a b^{2} - C b^{3}\right )} \tan \left (d x + c\right )}{6 \, d} \] Input:

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^3*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, a 
lgorithm="maxima")
 

Output:

1/6*(2*C*b^3*tan(d*x + c)^3 + 3*(3*C*a*b^2 + B*b^3)*tan(d*x + c)^2 + 6*(B* 
a^3 - 3*C*a^2*b - 3*B*a*b^2 + C*b^3)*(d*x + c) + 3*(C*a^3 + 3*B*a^2*b - 3* 
C*a*b^2 - B*b^3)*log(tan(d*x + c)^2 + 1) + 6*(3*C*a^2*b + 3*B*a*b^2 - C*b^ 
3)*tan(d*x + c))/d
 

Giac [A] (verification not implemented)

Time = 0.76 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.30 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {{\left (B a^{3} - 3 \, C a^{2} b - 3 \, B a b^{2} + C b^{3}\right )} {\left (d x + c\right )}}{d} + \frac {{\left (C a^{3} + 3 \, B a^{2} b - 3 \, C a b^{2} - B b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} + \frac {2 \, C b^{3} d^{2} \tan \left (d x + c\right )^{3} + 9 \, C a b^{2} d^{2} \tan \left (d x + c\right )^{2} + 3 \, B b^{3} d^{2} \tan \left (d x + c\right )^{2} + 18 \, C a^{2} b d^{2} \tan \left (d x + c\right ) + 18 \, B a b^{2} d^{2} \tan \left (d x + c\right ) - 6 \, C b^{3} d^{2} \tan \left (d x + c\right )}{6 \, d^{3}} \] Input:

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^3*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, a 
lgorithm="giac")
 

Output:

(B*a^3 - 3*C*a^2*b - 3*B*a*b^2 + C*b^3)*(d*x + c)/d + 1/2*(C*a^3 + 3*B*a^2 
*b - 3*C*a*b^2 - B*b^3)*log(tan(d*x + c)^2 + 1)/d + 1/6*(2*C*b^3*d^2*tan(d 
*x + c)^3 + 9*C*a*b^2*d^2*tan(d*x + c)^2 + 3*B*b^3*d^2*tan(d*x + c)^2 + 18 
*C*a^2*b*d^2*tan(d*x + c) + 18*B*a*b^2*d^2*tan(d*x + c) - 6*C*b^3*d^2*tan( 
d*x + c))/d^3
 

Mupad [B] (verification not implemented)

Time = 5.34 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.01 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=x\,\left (B\,a^3-3\,C\,a^2\,b-3\,B\,a\,b^2+C\,b^3\right )-\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (-\frac {C\,a^3}{2}-\frac {3\,B\,a^2\,b}{2}+\frac {3\,C\,a\,b^2}{2}+\frac {B\,b^3}{2}\right )}{d}+\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,b^3}{2}+\frac {3\,C\,a\,b^2}{2}\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (C\,b^3-3\,a\,b\,\left (B\,b+C\,a\right )\right )}{d}+\frac {C\,b^3\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \] Input:

int(cot(c + d*x)*(B*tan(c + d*x) + C*tan(c + d*x)^2)*(a + b*tan(c + d*x))^ 
3,x)
 

Output:

x*(B*a^3 + C*b^3 - 3*B*a*b^2 - 3*C*a^2*b) - (log(tan(c + d*x)^2 + 1)*((B*b 
^3)/2 - (C*a^3)/2 - (3*B*a^2*b)/2 + (3*C*a*b^2)/2))/d + (tan(c + d*x)^2*(( 
B*b^3)/2 + (3*C*a*b^2)/2))/d - (tan(c + d*x)*(C*b^3 - 3*a*b*(B*b + C*a)))/ 
d + (C*b^3*tan(c + d*x)^3)/(3*d)
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 992, normalized size of antiderivative = 7.09 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx =\text {Too large to display} \] Input:

int(cot(d*x+c)*(a+b*tan(d*x+c))^3*(B*tan(d*x+c)+C*tan(d*x+c)^2),x)
 

Output:

(6*cos(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**2*a**3*c + 18*c 
os(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**2*a**2*b**2 - 18*co 
s(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**2*a*b**2*c - 6*cos(c 
 + d*x)*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**2*b**4 - 6*cos(c + d*x) 
*log(tan((c + d*x)/2)**2 + 1)*a**3*c - 18*cos(c + d*x)*log(tan((c + d*x)/2 
)**2 + 1)*a**2*b**2 + 18*cos(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*a*b**2* 
c + 6*cos(c + d*x)*log(tan((c + d*x)/2)**2 + 1)*b**4 - 6*cos(c + d*x)*log( 
tan((c + d*x)/2) - 1)*sin(c + d*x)**2*a**3*c - 18*cos(c + d*x)*log(tan((c 
+ d*x)/2) - 1)*sin(c + d*x)**2*a**2*b**2 + 18*cos(c + d*x)*log(tan((c + d* 
x)/2) - 1)*sin(c + d*x)**2*a*b**2*c + 6*cos(c + d*x)*log(tan((c + d*x)/2) 
- 1)*sin(c + d*x)**2*b**4 + 6*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*a**3* 
c + 18*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*a**2*b**2 - 18*cos(c + d*x)* 
log(tan((c + d*x)/2) - 1)*a*b**2*c - 6*cos(c + d*x)*log(tan((c + d*x)/2) - 
 1)*b**4 - 6*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a**3*c 
 - 18*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a**2*b**2 + 1 
8*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a*b**2*c + 6*cos( 
c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*b**4 + 6*cos(c + d*x)*l 
og(tan((c + d*x)/2) + 1)*a**3*c + 18*cos(c + d*x)*log(tan((c + d*x)/2) + 1 
)*a**2*b**2 - 18*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*a*b**2*c - 6*cos(c 
 + d*x)*log(tan((c + d*x)/2) + 1)*b**4 + 6*cos(c + d*x)*sin(c + d*x)**2...