\(\int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 (A+B \tan (e+f x)+C \tan ^2(e+f x)) \, dx\) [65]

Optimal result
Mathematica [C] (verified)
Rubi [A] (verified)
Maple [A] (warning: unable to verify)
Fricas [A] (verification not implemented)
Sympy [B] (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 = 43, antiderivative size = 389 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\left (a \left (A c^3-c^3 C-3 B c^2 d-3 A c d^2+3 c C d^2+B d^3\right )-b \left ((A-C) d \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right ) x-\frac {\left (A \left (b c^3+3 a c^2 d-3 b c d^2-a d^3\right )-b \left (c^3 C+3 B c^2 d-3 c C d^2-B d^3\right )+a \left (B c^3-3 c^2 C d-3 B c d^2+C d^3\right )\right ) \log (\cos (e+f x))}{f}+\frac {d \left (a \left (B c^2-2 c C d-B d^2\right )-b \left (c^2 C+2 B c d-C d^2\right )+A \left (2 a c d+b \left (c^2-d^2\right )\right )\right ) \tan (e+f x)}{f}+\frac {(A b c+a B c-b c C+a A d-b B d-a C d) (c+d \tan (e+f x))^2}{2 f}+\frac {(A b+a B-b C) (c+d \tan (e+f x))^3}{3 f}-\frac {(b c C-5 b B d-5 a C d) (c+d \tan (e+f x))^4}{20 d^2 f}+\frac {b C \tan (e+f x) (c+d \tan (e+f x))^4}{5 d f} \] Output:

(a*(A*c^3-3*A*c*d^2-3*B*c^2*d+B*d^3-C*c^3+3*C*c*d^2)-b*((A-C)*d*(3*c^2-d^2 
)+B*(c^3-3*c*d^2)))*x-(A*(3*a*c^2*d-a*d^3+b*c^3-3*b*c*d^2)-b*(3*B*c^2*d-B* 
d^3+C*c^3-3*C*c*d^2)+a*(B*c^3-3*B*c*d^2-3*C*c^2*d+C*d^3))*ln(cos(f*x+e))/f 
+d*(a*(B*c^2-B*d^2-2*C*c*d)-b*(2*B*c*d+C*c^2-C*d^2)+A*(2*a*c*d+b*(c^2-d^2) 
))*tan(f*x+e)/f+1/2*(A*a*d+A*b*c+B*a*c-B*b*d-C*a*d-C*b*c)*(c+d*tan(f*x+e)) 
^2/f+1/3*(A*b+B*a-C*b)*(c+d*tan(f*x+e))^3/f-1/20*(-5*B*b*d-5*C*a*d+C*b*c)* 
(c+d*tan(f*x+e))^4/d^2/f+1/5*b*C*tan(f*x+e)*(c+d*tan(f*x+e))^4/d/f
                                                                                    
                                                                                    
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 6.25 (sec) , antiderivative size = 297, normalized size of antiderivative = 0.76 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {b C \tan (e+f x) (c+d \tan (e+f x))^4}{5 d f}-\frac {\frac {(b c C-5 b B d-5 a C d) (c+d \tan (e+f x))^4}{4 d f}+\frac {5 \left (3 (A b c+a B c-b c C-a A d+b B d+a C d) \left ((i c-d)^3 \log (i-\tan (e+f x))-(i c+d)^3 \log (i+\tan (e+f x))+6 c d^2 \tan (e+f x)+d^3 \tan ^2(e+f x)\right )+(A b+a B-b C) \left (3 i (c+i d)^4 \log (i-\tan (e+f x))-3 i (c-i d)^4 \log (i+\tan (e+f x))-6 d^2 \left (6 c^2-d^2\right ) \tan (e+f x)-12 c d^3 \tan ^2(e+f x)-2 d^4 \tan ^3(e+f x)\right )\right )}{6 f}}{5 d} \] Input:

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

Output:

(b*C*Tan[e + f*x]*(c + d*Tan[e + f*x])^4)/(5*d*f) - (((b*c*C - 5*b*B*d - 5 
*a*C*d)*(c + d*Tan[e + f*x])^4)/(4*d*f) + (5*(3*(A*b*c + a*B*c - b*c*C - a 
*A*d + b*B*d + a*C*d)*((I*c - d)^3*Log[I - Tan[e + f*x]] - (I*c + d)^3*Log 
[I + Tan[e + f*x]] + 6*c*d^2*Tan[e + f*x] + d^3*Tan[e + f*x]^2) + (A*b + a 
*B - b*C)*((3*I)*(c + I*d)^4*Log[I - Tan[e + f*x]] - (3*I)*(c - I*d)^4*Log 
[I + Tan[e + f*x]] - 6*d^2*(6*c^2 - d^2)*Tan[e + f*x] - 12*c*d^3*Tan[e + f 
*x]^2 - 2*d^4*Tan[e + f*x]^3)))/(6*f))/(5*d)
 

Rubi [A] (verified)

Time = 2.68 (sec) , antiderivative size = 403, normalized size of antiderivative = 1.04, number of steps used = 12, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.279, Rules used = {3042, 4120, 3042, 4113, 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 (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan (e+f x)^2\right )dx\)

\(\Big \downarrow \) 4120

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4113

\(\displaystyle \frac {b C \tan (e+f x) (c+d \tan (e+f x))^4}{5 d f}-\frac {\int (c+d \tan (e+f x))^3 (5 (b B-a (A-C)) d-5 (A b-C b+a B) d \tan (e+f x))dx+\frac {(-5 a C d-5 b B d+b c C) (c+d \tan (e+f x))^4}{4 d f}}{5 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {b C \tan (e+f x) (c+d \tan (e+f x))^4}{5 d f}-\frac {\int (c+d \tan (e+f x))^3 (5 (b B-a (A-C)) d-5 (A b-C b+a B) d \tan (e+f x))dx+\frac {(-5 a C d-5 b B d+b c C) (c+d \tan (e+f x))^4}{4 d f}}{5 d}\)

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

Input:

Int[(a + b*Tan[e + f*x])*(c + d*Tan[e + f*x])^3*(A + B*Tan[e + f*x] + C*Ta 
n[e + f*x]^2),x]
 

Output:

(b*C*Tan[e + f*x]*(c + d*Tan[e + f*x])^4)/(5*d*f) - (5*d*(a*(c^3*C + 3*B*c 
^2*d - 3*c*C*d^2 - B*d^3 - A*(c^3 - 3*c*d^2)) + b*((A - C)*d*(3*c^2 - d^2) 
 + B*(c^3 - 3*c*d^2)))*x + (5*d*(A*(b*c^3 + 3*a*c^2*d - 3*b*c*d^2 - a*d^3) 
 - b*(c^3*C + 3*B*c^2*d - 3*c*C*d^2 - B*d^3) + a*(B*c^3 - 3*c^2*C*d - 3*B* 
c*d^2 + C*d^3))*Log[Cos[e + f*x]])/f - (5*d^2*(2*a*A*c*d - 2*a*c*C*d + A*b 
*(c^2 - d^2) + a*B*(c^2 - d^2) - b*(c^2*C + 2*B*c*d - C*d^2))*Tan[e + f*x] 
)/f - (5*d*(A*b*c + a*B*c - b*c*C + a*A*d - b*B*d - a*C*d)*(c + d*Tan[e + 
f*x])^2)/(2*f) - (5*(A*b + a*B - b*C)*d*(c + d*Tan[e + f*x])^3)/(3*f) + (( 
b*c*C - 5*b*B*d - 5*a*C*d)*(c + d*Tan[e + f*x])^4)/(4*d*f))/(5*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 4113
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*((a + 
 b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Si 
mp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && 
NeQ[A*b^2 - a*b*B + a^2*C, 0] &&  !LeQ[m, -1]
 

rule 4120
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f 
_.)*(x_)]^2), x_Symbol] :> Simp[b*C*Tan[e + f*x]*((c + d*Tan[e + f*x])^(n + 
 1)/(d*f*(n + 2))), x] - Simp[1/(d*(n + 2))   Int[(c + d*Tan[e + f*x])^n*Si 
mp[b*c*C - a*A*d*(n + 2) - (A*b + a*B - b*C)*d*(n + 2)*Tan[e + f*x] - (a*C* 
d*(n + 2) - b*(c*C - B*d*(n + 2)))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, 
b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && 
  !LtQ[n, -1]
 
Maple [A] (warning: unable to verify)

Time = 0.26 (sec) , antiderivative size = 347, normalized size of antiderivative = 0.89

method result size
parts \(\frac {\left (3 A a \,c^{2} d +A b \,c^{3}+B a \,c^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (B b \,d^{3}+C a \,d^{3}+3 C b c \,d^{2}\right ) \left (\frac {\tan \left (f x +e \right )^{4}}{4}-\frac {\tan \left (f x +e \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+\frac {\left (A b \,d^{3}+B a \,d^{3}+3 B b c \,d^{2}+3 C a c \,d^{2}+3 C b \,c^{2} d \right ) \left (\frac {\tan \left (f x +e \right )^{3}}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (3 A a c \,d^{2}+3 A b \,c^{2} d +3 B a \,c^{2} d +B b \,c^{3}+C a \,c^{3}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (A a \,d^{3}+3 A b c \,d^{2}+3 B a c \,d^{2}+3 B b \,c^{2} d +3 C a \,c^{2} d +C b \,c^{3}\right ) \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+A a \,c^{3} x +\frac {C b \,d^{3} \left (\frac {\tan \left (f x +e \right )^{5}}{5}-\frac {\tan \left (f x +e \right )^{3}}{3}+\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(347\)
norman \(\left (A a \,c^{3}-3 A a c \,d^{2}-3 A b \,c^{2} d +A b \,d^{3}-3 B a \,c^{2} d +B a \,d^{3}-B b \,c^{3}+3 B b c \,d^{2}-C a \,c^{3}+3 C a c \,d^{2}+3 C b \,c^{2} d -C b \,d^{3}\right ) x +\frac {\left (3 A a c \,d^{2}+3 A b \,c^{2} d -A b \,d^{3}+3 B a \,c^{2} d -B a \,d^{3}+B b \,c^{3}-3 B b c \,d^{2}+C a \,c^{3}-3 C a c \,d^{2}-3 C b \,c^{2} d +C b \,d^{3}\right ) \tan \left (f x +e \right )}{f}+\frac {\left (A a \,d^{3}+3 A b c \,d^{2}+3 B a c \,d^{2}+3 B b \,c^{2} d -B b \,d^{3}+3 C a \,c^{2} d -C a \,d^{3}+C b \,c^{3}-3 C b c \,d^{2}\right ) \tan \left (f x +e \right )^{2}}{2 f}+\frac {d \left (A b \,d^{2}+B a \,d^{2}+3 B b c d +3 C a c d +3 C b \,c^{2}-C b \,d^{2}\right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {d^{2} \left (B b d +C a d +3 C b c \right ) \tan \left (f x +e \right )^{4}}{4 f}+\frac {C b \,d^{3} \tan \left (f x +e \right )^{5}}{5 f}+\frac {\left (3 A a \,c^{2} d -A a \,d^{3}+A b \,c^{3}-3 A b c \,d^{2}+B a \,c^{3}-3 B a c \,d^{2}-3 B b \,c^{2} d +B b \,d^{3}-3 C a \,c^{2} d +C a \,d^{3}-C b \,c^{3}+3 C b c \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) \(467\)
derivativedivides \(\frac {\frac {\left (3 A a \,c^{2} d -A a \,d^{3}+A b \,c^{3}-3 A b c \,d^{2}+B a \,c^{3}-3 B a c \,d^{2}-3 B b \,c^{2} d +B b \,d^{3}-3 C a \,c^{2} d +C a \,d^{3}-C b \,c^{3}+3 C b c \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A a \,c^{3}-3 A a c \,d^{2}-3 A b \,c^{2} d +A b \,d^{3}-3 B a \,c^{2} d +B a \,d^{3}-B b \,c^{3}+3 B b c \,d^{2}-C a \,c^{3}+3 C a c \,d^{2}+3 C b \,c^{2} d -C b \,d^{3}\right ) \arctan \left (\tan \left (f x +e \right )\right )-\frac {C b \,d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {A a \,d^{3} \tan \left (f x +e \right )^{2}}{2}-\frac {B b \,d^{3} \tan \left (f x +e \right )^{2}}{2}-\frac {C a \,d^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {C b \,c^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {B a \,d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {B b \,d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {C a \,d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {A b \,d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {C b \,d^{3} \tan \left (f x +e \right )^{5}}{5}+\tan \left (f x +e \right ) C b \,d^{3}-\tan \left (f x +e \right ) A b \,d^{3}-\tan \left (f x +e \right ) B a \,d^{3}+\tan \left (f x +e \right ) B b \,c^{3}+\tan \left (f x +e \right ) C a \,c^{3}+\frac {3 C b c \,d^{2} \tan \left (f x +e \right )^{4}}{4}+\frac {3 B b \,c^{2} d \tan \left (f x +e \right )^{2}}{2}+\frac {3 C a \,c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {3 C b c \,d^{2} \tan \left (f x +e \right )^{2}}{2}-3 \tan \left (f x +e \right ) C b \,c^{2} d +3 \tan \left (f x +e \right ) A a c \,d^{2}+3 \tan \left (f x +e \right ) A b \,c^{2} d +3 \tan \left (f x +e \right ) B a \,c^{2} d -3 \tan \left (f x +e \right ) B b c \,d^{2}-3 \tan \left (f x +e \right ) C a c \,d^{2}+C b \,c^{2} d \tan \left (f x +e \right )^{3}+C a c \,d^{2} \tan \left (f x +e \right )^{3}+B b c \,d^{2} \tan \left (f x +e \right )^{3}+\frac {3 B a c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\frac {3 A b c \,d^{2} \tan \left (f x +e \right )^{2}}{2}}{f}\) \(639\)
default \(\frac {\frac {\left (3 A a \,c^{2} d -A a \,d^{3}+A b \,c^{3}-3 A b c \,d^{2}+B a \,c^{3}-3 B a c \,d^{2}-3 B b \,c^{2} d +B b \,d^{3}-3 C a \,c^{2} d +C a \,d^{3}-C b \,c^{3}+3 C b c \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A a \,c^{3}-3 A a c \,d^{2}-3 A b \,c^{2} d +A b \,d^{3}-3 B a \,c^{2} d +B a \,d^{3}-B b \,c^{3}+3 B b c \,d^{2}-C a \,c^{3}+3 C a c \,d^{2}+3 C b \,c^{2} d -C b \,d^{3}\right ) \arctan \left (\tan \left (f x +e \right )\right )-\frac {C b \,d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {A a \,d^{3} \tan \left (f x +e \right )^{2}}{2}-\frac {B b \,d^{3} \tan \left (f x +e \right )^{2}}{2}-\frac {C a \,d^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {C b \,c^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {B a \,d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {B b \,d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {C a \,d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {A b \,d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {C b \,d^{3} \tan \left (f x +e \right )^{5}}{5}+\tan \left (f x +e \right ) C b \,d^{3}-\tan \left (f x +e \right ) A b \,d^{3}-\tan \left (f x +e \right ) B a \,d^{3}+\tan \left (f x +e \right ) B b \,c^{3}+\tan \left (f x +e \right ) C a \,c^{3}+\frac {3 C b c \,d^{2} \tan \left (f x +e \right )^{4}}{4}+\frac {3 B b \,c^{2} d \tan \left (f x +e \right )^{2}}{2}+\frac {3 C a \,c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {3 C b c \,d^{2} \tan \left (f x +e \right )^{2}}{2}-3 \tan \left (f x +e \right ) C b \,c^{2} d +3 \tan \left (f x +e \right ) A a c \,d^{2}+3 \tan \left (f x +e \right ) A b \,c^{2} d +3 \tan \left (f x +e \right ) B a \,c^{2} d -3 \tan \left (f x +e \right ) B b c \,d^{2}-3 \tan \left (f x +e \right ) C a c \,d^{2}+C b \,c^{2} d \tan \left (f x +e \right )^{3}+C a c \,d^{2} \tan \left (f x +e \right )^{3}+B b c \,d^{2} \tan \left (f x +e \right )^{3}+\frac {3 B a c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\frac {3 A b c \,d^{2} \tan \left (f x +e \right )^{2}}{2}}{f}\) \(639\)
parallelrisch \(\frac {180 C b \,c^{2} d f x -180 A a c \,d^{2} f x -180 A b \,c^{2} d f x -180 B a \,c^{2} d f x +180 B b c \,d^{2} f x +180 C a c \,d^{2} f x -20 C b \,d^{3} \tan \left (f x +e \right )^{3}+30 A a \,d^{3} \tan \left (f x +e \right )^{2}-30 B b \,d^{3} \tan \left (f x +e \right )^{2}-30 C a \,d^{3} \tan \left (f x +e \right )^{2}+30 C b \,c^{3} \tan \left (f x +e \right )^{2}+20 B a \,d^{3} \tan \left (f x +e \right )^{3}+15 B b \,d^{3} \tan \left (f x +e \right )^{4}+15 C a \,d^{3} \tan \left (f x +e \right )^{4}+20 A b \,d^{3} \tan \left (f x +e \right )^{3}+12 C b \,d^{3} \tan \left (f x +e \right )^{5}+60 \tan \left (f x +e \right ) C b \,d^{3}-60 \tan \left (f x +e \right ) A b \,d^{3}-60 \tan \left (f x +e \right ) B a \,d^{3}+60 \tan \left (f x +e \right ) B b \,c^{3}+60 \tan \left (f x +e \right ) C a \,c^{3}-90 B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a c \,d^{2}-90 B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b \,c^{2} d -90 C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,c^{2} d +90 C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b c \,d^{2}+45 C b c \,d^{2} \tan \left (f x +e \right )^{4}+90 B b \,c^{2} d \tan \left (f x +e \right )^{2}+90 C a \,c^{2} d \tan \left (f x +e \right )^{2}-90 C b c \,d^{2} \tan \left (f x +e \right )^{2}-180 \tan \left (f x +e \right ) C b \,c^{2} d +180 \tan \left (f x +e \right ) A a c \,d^{2}+180 \tan \left (f x +e \right ) A b \,c^{2} d +180 \tan \left (f x +e \right ) B a \,c^{2} d -180 \tan \left (f x +e \right ) B b c \,d^{2}-180 \tan \left (f x +e \right ) C a c \,d^{2}+60 C b \,c^{2} d \tan \left (f x +e \right )^{3}+60 C a c \,d^{2} \tan \left (f x +e \right )^{3}+60 B b c \,d^{2} \tan \left (f x +e \right )^{3}+90 B a c \,d^{2} \tan \left (f x +e \right )^{2}+90 A b c \,d^{2} \tan \left (f x +e \right )^{2}+90 A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,c^{2} d -90 A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b c \,d^{2}+60 A a \,c^{3} f x -30 A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,d^{3}+30 A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b \,c^{3}+30 B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,c^{3}+30 B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b \,d^{3}+30 C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,d^{3}-30 C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b \,c^{3}+60 A b \,d^{3} f x +60 B a \,d^{3} f x -60 B b \,c^{3} f x -60 C a \,c^{3} f x -60 C b \,d^{3} f x}{60 f}\) \(786\)
risch \(\text {Expression too large to display}\) \(2096\)

Input:

int((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, 
method=_RETURNVERBOSE)
 

Output:

1/2*(3*A*a*c^2*d+A*b*c^3+B*a*c^3)/f*ln(1+tan(f*x+e)^2)+(B*b*d^3+C*a*d^3+3* 
C*b*c*d^2)/f*(1/4*tan(f*x+e)^4-1/2*tan(f*x+e)^2+1/2*ln(1+tan(f*x+e)^2))+(A 
*b*d^3+B*a*d^3+3*B*b*c*d^2+3*C*a*c*d^2+3*C*b*c^2*d)/f*(1/3*tan(f*x+e)^3-ta 
n(f*x+e)+arctan(tan(f*x+e)))+(3*A*a*c*d^2+3*A*b*c^2*d+3*B*a*c^2*d+B*b*c^3+ 
C*a*c^3)/f*(tan(f*x+e)-arctan(tan(f*x+e)))+(A*a*d^3+3*A*b*c*d^2+3*B*a*c*d^ 
2+3*B*b*c^2*d+3*C*a*c^2*d+C*b*c^3)/f*(1/2*tan(f*x+e)^2-1/2*ln(1+tan(f*x+e) 
^2))+A*a*c^3*x+C*b*d^3/f*(1/5*tan(f*x+e)^5-1/3*tan(f*x+e)^3+tan(f*x+e)-arc 
tan(tan(f*x+e)))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 386, normalized size of antiderivative = 0.99 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {12 \, C b d^{3} \tan \left (f x + e\right )^{5} + 15 \, {\left (3 \, C b c d^{2} + {\left (C a + B b\right )} d^{3}\right )} \tan \left (f x + e\right )^{4} + 20 \, {\left (3 \, C b c^{2} d + 3 \, {\left (C a + B b\right )} c d^{2} + {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} \tan \left (f x + e\right )^{3} + 60 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{3} - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{2} + {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} f x + 30 \, {\left (C b c^{3} + 3 \, {\left (C a + B b\right )} c^{2} d + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{2} + {\left ({\left (A - C\right )} a - B b\right )} d^{3}\right )} \tan \left (f x + e\right )^{2} - 30 \, {\left ({\left (B a + {\left (A - C\right )} b\right )} c^{3} + 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{2} - {\left ({\left (A - C\right )} a - B b\right )} d^{3}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 60 \, {\left ({\left (C a + B b\right )} c^{3} + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d + 3 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{2} - {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} \tan \left (f x + e\right )}{60 \, f} \] Input:

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e) 
^2),x, algorithm="fricas")
 

Output:

1/60*(12*C*b*d^3*tan(f*x + e)^5 + 15*(3*C*b*c*d^2 + (C*a + B*b)*d^3)*tan(f 
*x + e)^4 + 20*(3*C*b*c^2*d + 3*(C*a + B*b)*c*d^2 + (B*a + (A - C)*b)*d^3) 
*tan(f*x + e)^3 + 60*(((A - C)*a - B*b)*c^3 - 3*(B*a + (A - C)*b)*c^2*d - 
3*((A - C)*a - B*b)*c*d^2 + (B*a + (A - C)*b)*d^3)*f*x + 30*(C*b*c^3 + 3*( 
C*a + B*b)*c^2*d + 3*(B*a + (A - C)*b)*c*d^2 + ((A - C)*a - B*b)*d^3)*tan( 
f*x + e)^2 - 30*((B*a + (A - C)*b)*c^3 + 3*((A - C)*a - B*b)*c^2*d - 3*(B* 
a + (A - C)*b)*c*d^2 - ((A - C)*a - B*b)*d^3)*log(1/(tan(f*x + e)^2 + 1)) 
+ 60*((C*a + B*b)*c^3 + 3*(B*a + (A - C)*b)*c^2*d + 3*((A - C)*a - B*b)*c* 
d^2 - (B*a + (A - C)*b)*d^3)*tan(f*x + e))/f
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1001 vs. \(2 (379) = 758\).

Time = 0.29 (sec) , antiderivative size = 1001, normalized size of antiderivative = 2.57 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\text {Too large to display} \] Input:

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

Output:

Piecewise((A*a*c**3*x + 3*A*a*c**2*d*log(tan(e + f*x)**2 + 1)/(2*f) - 3*A* 
a*c*d**2*x + 3*A*a*c*d**2*tan(e + f*x)/f - A*a*d**3*log(tan(e + f*x)**2 + 
1)/(2*f) + A*a*d**3*tan(e + f*x)**2/(2*f) + A*b*c**3*log(tan(e + f*x)**2 + 
 1)/(2*f) - 3*A*b*c**2*d*x + 3*A*b*c**2*d*tan(e + f*x)/f - 3*A*b*c*d**2*lo 
g(tan(e + f*x)**2 + 1)/(2*f) + 3*A*b*c*d**2*tan(e + f*x)**2/(2*f) + A*b*d* 
*3*x + A*b*d**3*tan(e + f*x)**3/(3*f) - A*b*d**3*tan(e + f*x)/f + B*a*c**3 
*log(tan(e + f*x)**2 + 1)/(2*f) - 3*B*a*c**2*d*x + 3*B*a*c**2*d*tan(e + f* 
x)/f - 3*B*a*c*d**2*log(tan(e + f*x)**2 + 1)/(2*f) + 3*B*a*c*d**2*tan(e + 
f*x)**2/(2*f) + B*a*d**3*x + B*a*d**3*tan(e + f*x)**3/(3*f) - B*a*d**3*tan 
(e + f*x)/f - B*b*c**3*x + B*b*c**3*tan(e + f*x)/f - 3*B*b*c**2*d*log(tan( 
e + f*x)**2 + 1)/(2*f) + 3*B*b*c**2*d*tan(e + f*x)**2/(2*f) + 3*B*b*c*d**2 
*x + B*b*c*d**2*tan(e + f*x)**3/f - 3*B*b*c*d**2*tan(e + f*x)/f + B*b*d**3 
*log(tan(e + f*x)**2 + 1)/(2*f) + B*b*d**3*tan(e + f*x)**4/(4*f) - B*b*d** 
3*tan(e + f*x)**2/(2*f) - C*a*c**3*x + C*a*c**3*tan(e + f*x)/f - 3*C*a*c** 
2*d*log(tan(e + f*x)**2 + 1)/(2*f) + 3*C*a*c**2*d*tan(e + f*x)**2/(2*f) + 
3*C*a*c*d**2*x + C*a*c*d**2*tan(e + f*x)**3/f - 3*C*a*c*d**2*tan(e + f*x)/ 
f + C*a*d**3*log(tan(e + f*x)**2 + 1)/(2*f) + C*a*d**3*tan(e + f*x)**4/(4* 
f) - C*a*d**3*tan(e + f*x)**2/(2*f) - C*b*c**3*log(tan(e + f*x)**2 + 1)/(2 
*f) + C*b*c**3*tan(e + f*x)**2/(2*f) + 3*C*b*c**2*d*x + C*b*c**2*d*tan(e + 
 f*x)**3/f - 3*C*b*c**2*d*tan(e + f*x)/f + 3*C*b*c*d**2*log(tan(e + f*x...
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 387, normalized size of antiderivative = 0.99 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {12 \, C b d^{3} \tan \left (f x + e\right )^{5} + 15 \, {\left (3 \, C b c d^{2} + {\left (C a + B b\right )} d^{3}\right )} \tan \left (f x + e\right )^{4} + 20 \, {\left (3 \, C b c^{2} d + 3 \, {\left (C a + B b\right )} c d^{2} + {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} \tan \left (f x + e\right )^{3} + 30 \, {\left (C b c^{3} + 3 \, {\left (C a + B b\right )} c^{2} d + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{2} + {\left ({\left (A - C\right )} a - B b\right )} d^{3}\right )} \tan \left (f x + e\right )^{2} + 60 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{3} - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{2} + {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} {\left (f x + e\right )} + 30 \, {\left ({\left (B a + {\left (A - C\right )} b\right )} c^{3} + 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{2} - {\left ({\left (A - C\right )} a - B b\right )} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 60 \, {\left ({\left (C a + B b\right )} c^{3} + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d + 3 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{2} - {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} \tan \left (f x + e\right )}{60 \, f} \] Input:

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e) 
^2),x, algorithm="maxima")
 

Output:

1/60*(12*C*b*d^3*tan(f*x + e)^5 + 15*(3*C*b*c*d^2 + (C*a + B*b)*d^3)*tan(f 
*x + e)^4 + 20*(3*C*b*c^2*d + 3*(C*a + B*b)*c*d^2 + (B*a + (A - C)*b)*d^3) 
*tan(f*x + e)^3 + 30*(C*b*c^3 + 3*(C*a + B*b)*c^2*d + 3*(B*a + (A - C)*b)* 
c*d^2 + ((A - C)*a - B*b)*d^3)*tan(f*x + e)^2 + 60*(((A - C)*a - B*b)*c^3 
- 3*(B*a + (A - C)*b)*c^2*d - 3*((A - C)*a - B*b)*c*d^2 + (B*a + (A - C)*b 
)*d^3)*(f*x + e) + 30*((B*a + (A - C)*b)*c^3 + 3*((A - C)*a - B*b)*c^2*d - 
 3*(B*a + (A - C)*b)*c*d^2 - ((A - C)*a - B*b)*d^3)*log(tan(f*x + e)^2 + 1 
) + 60*((C*a + B*b)*c^3 + 3*(B*a + (A - C)*b)*c^2*d + 3*((A - C)*a - B*b)* 
c*d^2 - (B*a + (A - C)*b)*d^3)*tan(f*x + e))/f
 

Giac [A] (verification not implemented)

Time = 1.06 (sec) , antiderivative size = 740, normalized size of antiderivative = 1.90 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx =\text {Too large to display} \] Input:

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e) 
^2),x, algorithm="giac")
 

Output:

(A*a*c^3 - C*a*c^3 - B*b*c^3 - 3*B*a*c^2*d - 3*A*b*c^2*d + 3*C*b*c^2*d - 3 
*A*a*c*d^2 + 3*C*a*c*d^2 + 3*B*b*c*d^2 + B*a*d^3 + A*b*d^3 - C*b*d^3)*(f*x 
 + e)/f + 1/2*(B*a*c^3 + A*b*c^3 - C*b*c^3 + 3*A*a*c^2*d - 3*C*a*c^2*d - 3 
*B*b*c^2*d - 3*B*a*c*d^2 - 3*A*b*c*d^2 + 3*C*b*c*d^2 - A*a*d^3 + C*a*d^3 + 
 B*b*d^3)*log(tan(f*x + e)^2 + 1)/f + 1/60*(12*C*b*d^3*f^4*tan(f*x + e)^5 
+ 45*C*b*c*d^2*f^4*tan(f*x + e)^4 + 15*C*a*d^3*f^4*tan(f*x + e)^4 + 15*B*b 
*d^3*f^4*tan(f*x + e)^4 + 60*C*b*c^2*d*f^4*tan(f*x + e)^3 + 60*C*a*c*d^2*f 
^4*tan(f*x + e)^3 + 60*B*b*c*d^2*f^4*tan(f*x + e)^3 + 20*B*a*d^3*f^4*tan(f 
*x + e)^3 + 20*A*b*d^3*f^4*tan(f*x + e)^3 - 20*C*b*d^3*f^4*tan(f*x + e)^3 
+ 30*C*b*c^3*f^4*tan(f*x + e)^2 + 90*C*a*c^2*d*f^4*tan(f*x + e)^2 + 90*B*b 
*c^2*d*f^4*tan(f*x + e)^2 + 90*B*a*c*d^2*f^4*tan(f*x + e)^2 + 90*A*b*c*d^2 
*f^4*tan(f*x + e)^2 - 90*C*b*c*d^2*f^4*tan(f*x + e)^2 + 30*A*a*d^3*f^4*tan 
(f*x + e)^2 - 30*C*a*d^3*f^4*tan(f*x + e)^2 - 30*B*b*d^3*f^4*tan(f*x + e)^ 
2 + 60*C*a*c^3*f^4*tan(f*x + e) + 60*B*b*c^3*f^4*tan(f*x + e) + 180*B*a*c^ 
2*d*f^4*tan(f*x + e) + 180*A*b*c^2*d*f^4*tan(f*x + e) - 180*C*b*c^2*d*f^4* 
tan(f*x + e) + 180*A*a*c*d^2*f^4*tan(f*x + e) - 180*C*a*c*d^2*f^4*tan(f*x 
+ e) - 180*B*b*c*d^2*f^4*tan(f*x + e) - 60*B*a*d^3*f^4*tan(f*x + e) - 60*A 
*b*d^3*f^4*tan(f*x + e) + 60*C*b*d^3*f^4*tan(f*x + e))/f^5
 

Mupad [B] (verification not implemented)

Time = 5.78 (sec) , antiderivative size = 478, normalized size of antiderivative = 1.23 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=x\,\left (A\,a\,c^3+A\,b\,d^3+B\,a\,d^3-B\,b\,c^3-C\,a\,c^3-C\,b\,d^3-3\,A\,a\,c\,d^2-3\,A\,b\,c^2\,d-3\,B\,a\,c^2\,d+3\,B\,b\,c\,d^2+3\,C\,a\,c\,d^2+3\,C\,b\,c^2\,d\right )+\frac {{\mathrm {tan}\left (e+f\,x\right )}^4\,\left (\frac {B\,b\,d^3}{4}+\frac {C\,a\,d^3}{4}+\frac {3\,C\,b\,c\,d^2}{4}\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {A\,b\,d^3}{3}+\frac {B\,a\,d^3}{3}-\frac {C\,b\,d^3}{3}+B\,b\,c\,d^2+C\,a\,c\,d^2+C\,b\,c^2\,d\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {A\,a\,d^3}{2}-\frac {B\,b\,d^3}{2}-\frac {C\,a\,d^3}{2}+\frac {C\,b\,c^3}{2}+\frac {3\,A\,b\,c\,d^2}{2}+\frac {3\,B\,a\,c\,d^2}{2}+\frac {3\,B\,b\,c^2\,d}{2}+\frac {3\,C\,a\,c^2\,d}{2}-\frac {3\,C\,b\,c\,d^2}{2}\right )}{f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {A\,a\,d^3}{2}-\frac {A\,b\,c^3}{2}-\frac {B\,a\,c^3}{2}-\frac {B\,b\,d^3}{2}-\frac {C\,a\,d^3}{2}+\frac {C\,b\,c^3}{2}-\frac {3\,A\,a\,c^2\,d}{2}+\frac {3\,A\,b\,c\,d^2}{2}+\frac {3\,B\,a\,c\,d^2}{2}+\frac {3\,B\,b\,c^2\,d}{2}+\frac {3\,C\,a\,c^2\,d}{2}-\frac {3\,C\,b\,c\,d^2}{2}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (B\,b\,c^3-B\,a\,d^3-A\,b\,d^3+C\,a\,c^3+C\,b\,d^3+3\,A\,a\,c\,d^2+3\,A\,b\,c^2\,d+3\,B\,a\,c^2\,d-3\,B\,b\,c\,d^2-3\,C\,a\,c\,d^2-3\,C\,b\,c^2\,d\right )}{f}+\frac {C\,b\,d^3\,{\mathrm {tan}\left (e+f\,x\right )}^5}{5\,f} \] Input:

int((a + b*tan(e + f*x))*(c + d*tan(e + f*x))^3*(A + B*tan(e + f*x) + C*ta 
n(e + f*x)^2),x)
 

Output:

x*(A*a*c^3 + A*b*d^3 + B*a*d^3 - B*b*c^3 - C*a*c^3 - C*b*d^3 - 3*A*a*c*d^2 
 - 3*A*b*c^2*d - 3*B*a*c^2*d + 3*B*b*c*d^2 + 3*C*a*c*d^2 + 3*C*b*c^2*d) + 
(tan(e + f*x)^4*((B*b*d^3)/4 + (C*a*d^3)/4 + (3*C*b*c*d^2)/4))/f + (tan(e 
+ f*x)^3*((A*b*d^3)/3 + (B*a*d^3)/3 - (C*b*d^3)/3 + B*b*c*d^2 + C*a*c*d^2 
+ C*b*c^2*d))/f + (tan(e + f*x)^2*((A*a*d^3)/2 - (B*b*d^3)/2 - (C*a*d^3)/2 
 + (C*b*c^3)/2 + (3*A*b*c*d^2)/2 + (3*B*a*c*d^2)/2 + (3*B*b*c^2*d)/2 + (3* 
C*a*c^2*d)/2 - (3*C*b*c*d^2)/2))/f - (log(tan(e + f*x)^2 + 1)*((A*a*d^3)/2 
 - (A*b*c^3)/2 - (B*a*c^3)/2 - (B*b*d^3)/2 - (C*a*d^3)/2 + (C*b*c^3)/2 - ( 
3*A*a*c^2*d)/2 + (3*A*b*c*d^2)/2 + (3*B*a*c*d^2)/2 + (3*B*b*c^2*d)/2 + (3* 
C*a*c^2*d)/2 - (3*C*b*c*d^2)/2))/f + (tan(e + f*x)*(B*b*c^3 - B*a*d^3 - A* 
b*d^3 + C*a*c^3 + C*b*d^3 + 3*A*a*c*d^2 + 3*A*b*c^2*d + 3*B*a*c^2*d - 3*B* 
b*c*d^2 - 3*C*a*c*d^2 - 3*C*b*c^2*d))/f + (C*b*d^3*tan(e + f*x)^5)/(5*f)
 

Reduce [B] (verification not implemented)

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

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

Output:

(90*log(tan(e + f*x)**2 + 1)*a**2*c**2*d - 30*log(tan(e + f*x)**2 + 1)*a** 
2*d**3 + 60*log(tan(e + f*x)**2 + 1)*a*b*c**3 - 180*log(tan(e + f*x)**2 + 
1)*a*b*c*d**2 - 90*log(tan(e + f*x)**2 + 1)*a*c**3*d + 30*log(tan(e + f*x) 
**2 + 1)*a*c*d**3 - 90*log(tan(e + f*x)**2 + 1)*b**2*c**2*d + 30*log(tan(e 
 + f*x)**2 + 1)*b**2*d**3 - 30*log(tan(e + f*x)**2 + 1)*b*c**4 + 90*log(ta 
n(e + f*x)**2 + 1)*b*c**2*d**2 + 12*tan(e + f*x)**5*b*c*d**3 + 15*tan(e + 
f*x)**4*a*c*d**3 + 15*tan(e + f*x)**4*b**2*d**3 + 45*tan(e + f*x)**4*b*c** 
2*d**2 + 40*tan(e + f*x)**3*a*b*d**3 + 60*tan(e + f*x)**3*a*c**2*d**2 + 60 
*tan(e + f*x)**3*b**2*c*d**2 + 60*tan(e + f*x)**3*b*c**3*d - 20*tan(e + f* 
x)**3*b*c*d**3 + 30*tan(e + f*x)**2*a**2*d**3 + 180*tan(e + f*x)**2*a*b*c* 
d**2 + 90*tan(e + f*x)**2*a*c**3*d - 30*tan(e + f*x)**2*a*c*d**3 + 90*tan( 
e + f*x)**2*b**2*c**2*d - 30*tan(e + f*x)**2*b**2*d**3 + 30*tan(e + f*x)** 
2*b*c**4 - 90*tan(e + f*x)**2*b*c**2*d**2 + 180*tan(e + f*x)*a**2*c*d**2 + 
 360*tan(e + f*x)*a*b*c**2*d - 120*tan(e + f*x)*a*b*d**3 + 60*tan(e + f*x) 
*a*c**4 - 180*tan(e + f*x)*a*c**2*d**2 + 60*tan(e + f*x)*b**2*c**3 - 180*t 
an(e + f*x)*b**2*c*d**2 - 180*tan(e + f*x)*b*c**3*d + 60*tan(e + f*x)*b*c* 
d**3 + 60*a**2*c**3*f*x - 180*a**2*c*d**2*f*x - 360*a*b*c**2*d*f*x + 120*a 
*b*d**3*f*x - 60*a*c**4*f*x + 180*a*c**2*d**2*f*x - 60*b**2*c**3*f*x + 180 
*b**2*c*d**2*f*x + 180*b*c**3*d*f*x - 60*b*c*d**3*f*x)/(60*f)