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

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 [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 45, antiderivative size = 603 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\left (a^2 \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^2 \left (c^3 C+3 B c^2 d-3 c C d^2-B d^3-A \left (c^3-3 c d^2\right )\right )-2 a 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 (2 a b \left (c^3 C+3 B c^2 d-3 c C d^2-B d^3-A \left (c^3-3 c d^2\right )\right )-a^2 \left ((A-C) d \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )+b^2 \left ((A-C) d \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right ) \log (\cos (e+f x))}{f}-\frac {d \left (2 a b \left (c^2 C+2 B c d-C d^2-A \left (c^2-d^2\right )\right )-a^2 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right )+b^2 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right )\right ) \tan (e+f x)}{f}+\frac {\left (2 a b (A c-c C-B d)+a^2 (B c+(A-C) d)-b^2 (B c+(A-C) d)\right ) (c+d \tan (e+f x))^2}{2 f}+\frac {\left (a^2 B-b^2 B+2 a b (A-C)\right ) (c+d \tan (e+f x))^3}{3 f}+\frac {\left (5 a^2 C d^2-6 a b d (c C-5 B d)+b^2 \left (c^2 C-3 B c d+15 (A-C) d^2\right )\right ) (c+d \tan (e+f x))^4}{60 d^3 f}-\frac {b (b c C-3 b B d-a C d) \tan (e+f x) (c+d \tan (e+f x))^4}{15 d^2 f}+\frac {C (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^4}{6 d f} \] Output:

(a^2*(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^2*(c^3*C+3*B*c^2* 
d-3*C*c*d^2-B*d^3-A*(c^3-3*c*d^2))-2*a*b*((A-C)*d*(3*c^2-d^2)+B*(c^3-3*c*d 
^2)))*x+(2*a*b*(c^3*C+3*B*c^2*d-3*C*c*d^2-B*d^3-A*(c^3-3*c*d^2))-a^2*((A-C 
)*d*(3*c^2-d^2)+B*(c^3-3*c*d^2))+b^2*((A-C)*d*(3*c^2-d^2)+B*(c^3-3*c*d^2)) 
)*ln(cos(f*x+e))/f-d*(2*a*b*(c^2*C+2*B*c*d-C*d^2-A*(c^2-d^2))-a^2*(2*c*(A- 
C)*d+B*(c^2-d^2))+b^2*(2*c*(A-C)*d+B*(c^2-d^2)))*tan(f*x+e)/f+1/2*(2*a*b*( 
A*c-B*d-C*c)+a^2*(B*c+(A-C)*d)-b^2*(B*c+(A-C)*d))*(c+d*tan(f*x+e))^2/f+1/3 
*(B*a^2-B*b^2+2*a*b*(A-C))*(c+d*tan(f*x+e))^3/f+1/60*(5*a^2*C*d^2-6*a*b*d* 
(-5*B*d+C*c)+b^2*(c^2*C-3*B*c*d+15*(A-C)*d^2))*(c+d*tan(f*x+e))^4/d^3/f-1/ 
15*b*(-3*B*b*d-C*a*d+C*b*c)*tan(f*x+e)*(c+d*tan(f*x+e))^4/d^2/f+1/6*C*(a+b 
*tan(f*x+e))^2*(c+d*tan(f*x+e))^4/d/f
                                                                                    
                                                                                    
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 6.40 (sec) , antiderivative size = 419, normalized size of antiderivative = 0.69 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {C (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^4}{6 d f}+\frac {-\frac {2 b (b c C-3 b B d-a C d) \tan (e+f x) (c+d \tan (e+f x))^4}{5 d f}-\frac {-\frac {\left (5 a^2 C d^2-6 a b d (c C-5 B d)+b^2 \left (c^2 C-3 B c d+15 (A-C) d^2\right )\right ) (c+d \tan (e+f x))^4}{2 d f}+\frac {5 \left (3 d \left (2 a b (A c-c C+B d)+a^2 (B c-(A-C) d)-b^2 (B c-(A-C) d)\right ) \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 )+\left (a^2 B-b^2 B+2 a b (A-C)\right ) d \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 )}{f}}{5 d}}{6 d} \] Input:

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

Output:

(C*(a + b*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^4)/(6*d*f) + ((-2*b*(b*c*C 
- 3*b*B*d - a*C*d)*Tan[e + f*x]*(c + d*Tan[e + f*x])^4)/(5*d*f) - (-1/2*(( 
5*a^2*C*d^2 - 6*a*b*d*(c*C - 5*B*d) + b^2*(c^2*C - 3*B*c*d + 15*(A - C)*d^ 
2))*(c + d*Tan[e + f*x])^4)/(d*f) + (5*(3*d*(2*a*b*(A*c - c*C + B*d) + a^2 
*(B*c - (A - C)*d) - b^2*(B*c - (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^2*B - b^2*B + 2*a*b*(A - C))*d*((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)))/f)/( 
5*d))/(6*d)
 

Rubi [A] (verified)

Time = 4.72 (sec) , antiderivative size = 633, normalized size of antiderivative = 1.05, number of steps used = 16, number of rules used = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.356, Rules used = {3042, 4130, 27, 3042, 4120, 25, 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))^2 (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))^2 (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan (e+f x)^2\right )dx\)

\(\Big \downarrow \) 4130

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4120

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4113

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

\(\displaystyle \frac {C (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^4}{6 d f}-\frac {\frac {15 d^2 \left (-\left (a^2 \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right )+2 a b \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^2 \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right ) \int \tan (e+f x)dx-\frac {(c+d \tan (e+f x))^4 \left (5 a^2 C d^2-6 a b d (c C-5 B d)+b^2 \left (15 d^2 (A-C)-3 B c d+c^2 C\right )\right )}{4 d f}+\frac {15 d^3 \tan (e+f x) \left (-\left (a^2 \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )\right )+2 a b \left (-A \left (c^2-d^2\right )+2 B c d+c^2 C-C d^2\right )+b^2 \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )\right )}{f}-15 d^2 x \left (a^2 \left (A c^3-3 A c d^2-3 B c^2 d+B d^3-c^3 C+3 c C d^2\right )-2 a b \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )+b^2 \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 )\right )-\frac {5 d^2 \left (a^2 B+2 a b (A-C)-b^2 B\right ) (c+d \tan (e+f x))^3}{f}-\frac {15 d^2 (c+d \tan (e+f x))^2 \left (a^2 (d (A-C)+B c)+2 a b (A c-B d-c C)-b^2 (d (A-C)+B c)\right )}{2 f}}{5 d}+\frac {b \tan (e+f x) (-a C d-3 b B d+b c C) (c+d \tan (e+f x))^4}{5 d f}}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {C (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^4}{6 d f}-\frac {\frac {15 d^2 \left (-\left (a^2 \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right )+2 a b \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^2 \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right ) \int \tan (e+f x)dx-\frac {(c+d \tan (e+f x))^4 \left (5 a^2 C d^2-6 a b d (c C-5 B d)+b^2 \left (15 d^2 (A-C)-3 B c d+c^2 C\right )\right )}{4 d f}+\frac {15 d^3 \tan (e+f x) \left (-\left (a^2 \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )\right )+2 a b \left (-A \left (c^2-d^2\right )+2 B c d+c^2 C-C d^2\right )+b^2 \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )\right )}{f}-15 d^2 x \left (a^2 \left (A c^3-3 A c d^2-3 B c^2 d+B d^3-c^3 C+3 c C d^2\right )-2 a b \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )+b^2 \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 )\right )-\frac {5 d^2 \left (a^2 B+2 a b (A-C)-b^2 B\right ) (c+d \tan (e+f x))^3}{f}-\frac {15 d^2 (c+d \tan (e+f x))^2 \left (a^2 (d (A-C)+B c)+2 a b (A c-B d-c C)-b^2 (d (A-C)+B c)\right )}{2 f}}{5 d}+\frac {b \tan (e+f x) (-a C d-3 b B d+b c C) (c+d \tan (e+f x))^4}{5 d f}}{3 d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {C (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^4}{6 d f}-\frac {\frac {-\frac {(c+d \tan (e+f x))^4 \left (5 a^2 C d^2-6 a b d (c C-5 B d)+b^2 \left (15 d^2 (A-C)-3 B c d+c^2 C\right )\right )}{4 d f}+\frac {15 d^3 \tan (e+f x) \left (-\left (a^2 \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )\right )+2 a b \left (-A \left (c^2-d^2\right )+2 B c d+c^2 C-C d^2\right )+b^2 \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )\right )}{f}-\frac {15 d^2 \log (\cos (e+f x)) \left (-\left (a^2 \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right )+2 a b \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^2 \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )\right )}{f}-15 d^2 x \left (a^2 \left (A c^3-3 A c d^2-3 B c^2 d+B d^3-c^3 C+3 c C d^2\right )-2 a b \left (d (A-C) \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right )+b^2 \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 )\right )-\frac {5 d^2 \left (a^2 B+2 a b (A-C)-b^2 B\right ) (c+d \tan (e+f x))^3}{f}-\frac {15 d^2 (c+d \tan (e+f x))^2 \left (a^2 (d (A-C)+B c)+2 a b (A c-B d-c C)-b^2 (d (A-C)+B c)\right )}{2 f}}{5 d}+\frac {b \tan (e+f x) (-a C d-3 b B d+b c C) (c+d \tan (e+f x))^4}{5 d f}}{3 d}\)

Input:

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

Output:

(C*(a + b*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^4)/(6*d*f) - ((b*(b*c*C - 3 
*b*B*d - a*C*d)*Tan[e + f*x]*(c + d*Tan[e + f*x])^4)/(5*d*f) + (-15*d^2*(a 
^2*(A*c^3 - c^3*C - 3*B*c^2*d - 3*A*c*d^2 + 3*c*C*d^2 + B*d^3) + b^2*(c^3* 
C + 3*B*c^2*d - 3*c*C*d^2 - B*d^3 - A*(c^3 - 3*c*d^2)) - 2*a*b*((A - C)*d* 
(3*c^2 - d^2) + B*(c^3 - 3*c*d^2)))*x - (15*d^2*(2*a*b*(c^3*C + 3*B*c^2*d 
- 3*c*C*d^2 - B*d^3 - A*(c^3 - 3*c*d^2)) - a^2*((A - C)*d*(3*c^2 - d^2) + 
B*(c^3 - 3*c*d^2)) + b^2*((A - C)*d*(3*c^2 - d^2) + B*(c^3 - 3*c*d^2)))*Lo 
g[Cos[e + f*x]])/f + (15*d^3*(2*a*b*(c^2*C + 2*B*c*d - C*d^2 - A*(c^2 - d^ 
2)) - a^2*(2*c*(A - C)*d + B*(c^2 - d^2)) + b^2*(2*c*(A - C)*d + B*(c^2 - 
d^2)))*Tan[e + f*x])/f - (15*d^2*(2*a*b*(A*c - c*C - B*d) + a^2*(B*c + (A 
- C)*d) - b^2*(B*c + (A - C)*d))*(c + d*Tan[e + f*x])^2)/(2*f) - (5*(a^2*B 
 - b^2*B + 2*a*b*(A - C))*d^2*(c + d*Tan[e + f*x])^3)/f - ((5*a^2*C*d^2 - 
6*a*b*d*(c*C - 5*B*d) + b^2*(c^2*C - 3*B*c*d + 15*(A - C)*d^2))*(c + d*Tan 
[e + f*x])^4)/(4*d*f))/(5*d))/(3*d)
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], 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 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]
 

rule 4130
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[C*(a + b*Tan[e + f*x])^m*((c + d*Tan[ 
e + f*x])^(n + 1)/(d*f*(m + n + 1))), x] + Simp[1/(d*(m + n + 1))   Int[(a 
+ b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^n*Simp[a*A*d*(m + n + 1) - C 
*(b*c*m + a*d*(n + 1)) + d*(A*b + a*B - b*C)*(m + n + 1)*Tan[e + f*x] - (C* 
m*(b*c - a*d) - b*B*d*(m + n + 1))*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[a^2 + b^2, 0] && 
 NeQ[c^2 + d^2, 0] && GtQ[m, 0] &&  !(IGtQ[n, 0] && ( !IntegerQ[m] || (EqQ[ 
c, 0] && NeQ[a, 0])))
 
Maple [A] (warning: unable to verify)

Time = 0.41 (sec) , antiderivative size = 546, normalized size of antiderivative = 0.91

method result size
parts \(\frac {\left (3 A \,a^{2} c^{2} d +2 A a b \,c^{3}+B \,a^{2} c^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (B \,b^{2} d^{3}+2 C a b \,d^{3}+3 C \,b^{2} c \,d^{2}\right ) \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}+\frac {\left (A \,b^{2} d^{3}+2 B a b \,d^{3}+3 B \,b^{2} c \,d^{2}+C \,a^{2} d^{3}+6 C a b c \,d^{2}+3 C \,b^{2} c^{2} d \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 (3 A \,a^{2} c \,d^{2}+6 A a b \,c^{2} d +A \,b^{2} c^{3}+3 B \,a^{2} c^{2} d +2 B a b \,c^{3}+C \,a^{2} c^{3}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (2 A a b \,d^{3}+3 A \,b^{2} c \,d^{2}+B \,a^{2} d^{3}+6 B a b c \,d^{2}+3 B \,b^{2} c^{2} d +3 C \,a^{2} c \,d^{2}+6 C a b \,c^{2} d +C \,b^{2} c^{3}\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 (A \,a^{2} d^{3}+6 A a b c \,d^{2}+3 A \,b^{2} c^{2} d +3 B \,a^{2} c \,d^{2}+6 B a b \,c^{2} d +B \,b^{2} c^{3}+3 C \,a^{2} c^{2} d +2 C a 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^{2} c^{3} x +\frac {C \,b^{2} d^{3} \left (\frac {\tan \left (f x +e \right )^{6}}{6}-\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}\) \(546\)
norman \(\left (A \,a^{2} c^{3}-3 A \,a^{2} c \,d^{2}-6 A a b \,c^{2} d +2 A a b \,d^{3}-A \,b^{2} c^{3}+3 A \,b^{2} c \,d^{2}-3 B \,a^{2} c^{2} d +B \,a^{2} d^{3}-2 B a b \,c^{3}+6 B a b c \,d^{2}+3 B \,b^{2} c^{2} d -B \,b^{2} d^{3}-C \,a^{2} c^{3}+3 C \,a^{2} c \,d^{2}+6 C a b \,c^{2} d -2 C a b \,d^{3}+C \,b^{2} c^{3}-3 C \,b^{2} c \,d^{2}\right ) x +\frac {\left (3 A \,a^{2} c \,d^{2}+6 A a b \,c^{2} d -2 A a b \,d^{3}+A \,b^{2} c^{3}-3 A \,b^{2} c \,d^{2}+3 B \,a^{2} c^{2} d -B \,a^{2} d^{3}+2 B a b \,c^{3}-6 B a b c \,d^{2}-3 B \,b^{2} c^{2} d +B \,b^{2} d^{3}+C \,a^{2} c^{3}-3 C \,a^{2} c \,d^{2}-6 C a b \,c^{2} d +2 C a b \,d^{3}-C \,b^{2} c^{3}+3 C \,b^{2} c \,d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {\left (2 A a b \,d^{3}+3 A \,b^{2} c \,d^{2}+B \,a^{2} d^{3}+6 B a b c \,d^{2}+3 B \,b^{2} c^{2} d -B \,b^{2} d^{3}+3 C \,a^{2} c \,d^{2}+6 C a b \,c^{2} d -2 C a b \,d^{3}+C \,b^{2} c^{3}-3 C \,b^{2} c \,d^{2}\right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {\left (A \,a^{2} d^{3}+6 A a b c \,d^{2}+3 A \,b^{2} c^{2} d -A \,b^{2} d^{3}+3 B \,a^{2} c \,d^{2}+6 B a b \,c^{2} d -2 B a b \,d^{3}+B \,b^{2} c^{3}-3 B \,b^{2} c \,d^{2}+3 C \,a^{2} c^{2} d -C \,a^{2} d^{3}+2 C a b \,c^{3}-6 C a b c \,d^{2}-3 C \,b^{2} c^{2} d +C \,b^{2} d^{3}\right ) \tan \left (f x +e \right )^{2}}{2 f}+\frac {d \left (A \,b^{2} d^{2}+2 B a b \,d^{2}+3 B \,b^{2} c d +a^{2} C \,d^{2}+6 C a b c d +3 C \,b^{2} c^{2}-b^{2} d^{2} C \right ) \tan \left (f x +e \right )^{4}}{4 f}+\frac {C \,b^{2} d^{3} \tan \left (f x +e \right )^{6}}{6 f}+\frac {b \,d^{2} \left (B b d +2 C a d +3 C b c \right ) \tan \left (f x +e \right )^{5}}{5 f}+\frac {\left (3 A \,a^{2} c^{2} d -A \,a^{2} d^{3}+2 A a b \,c^{3}-6 A a b c \,d^{2}-3 A \,b^{2} c^{2} d +A \,b^{2} d^{3}+B \,a^{2} c^{3}-3 B \,a^{2} c \,d^{2}-6 B a b \,c^{2} d +2 B a b \,d^{3}-B \,b^{2} c^{3}+3 B \,b^{2} c \,d^{2}-3 C \,a^{2} c^{2} d +C \,a^{2} d^{3}-2 C a b \,c^{3}+6 C a b c \,d^{2}+3 C \,b^{2} c^{2} d -C \,b^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) \(896\)
derivativedivides \(\text {Expression too large to display}\) \(1239\)
default \(\text {Expression too large to display}\) \(1239\)
parallelrisch \(\text {Expression too large to display}\) \(1464\)
risch \(\text {Expression too large to display}\) \(4231\)

Input:

int((a+b*tan(f*x+e))^2*(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^2*c^2*d+2*A*a*b*c^3+B*a^2*c^3)/f*ln(1+tan(f*x+e)^2)+(B*b^2*d^3+ 
2*C*a*b*d^3+3*C*b^2*c*d^2)/f*(1/5*tan(f*x+e)^5-1/3*tan(f*x+e)^3+tan(f*x+e) 
-arctan(tan(f*x+e)))+(A*b^2*d^3+2*B*a*b*d^3+3*B*b^2*c*d^2+C*a^2*d^3+6*C*a* 
b*c*d^2+3*C*b^2*c^2*d)/f*(1/4*tan(f*x+e)^4-1/2*tan(f*x+e)^2+1/2*ln(1+tan(f 
*x+e)^2))+(3*A*a^2*c*d^2+6*A*a*b*c^2*d+A*b^2*c^3+3*B*a^2*c^2*d+2*B*a*b*c^3 
+C*a^2*c^3)/f*(tan(f*x+e)-arctan(tan(f*x+e)))+(2*A*a*b*d^3+3*A*b^2*c*d^2+B 
*a^2*d^3+6*B*a*b*c*d^2+3*B*b^2*c^2*d+3*C*a^2*c*d^2+6*C*a*b*c^2*d+C*b^2*c^3 
)/f*(1/3*tan(f*x+e)^3-tan(f*x+e)+arctan(tan(f*x+e)))+(A*a^2*d^3+6*A*a*b*c* 
d^2+3*A*b^2*c^2*d+3*B*a^2*c*d^2+6*B*a*b*c^2*d+B*b^2*c^3+3*C*a^2*c^2*d+2*C* 
a*b*c^3)/f*(1/2*tan(f*x+e)^2-1/2*ln(1+tan(f*x+e)^2))+A*a^2*c^3*x+C*b^2*d^3 
/f*(1/6*tan(f*x+e)^6-1/4*tan(f*x+e)^4+1/2*tan(f*x+e)^2-1/2*ln(1+tan(f*x+e) 
^2))
 

Fricas [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 679, normalized size of antiderivative = 1.13 \[ \int (a+b \tan (e+f x))^2 (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))^2*(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*(10*C*b^2*d^3*tan(f*x + e)^6 + 12*(3*C*b^2*c*d^2 + (2*C*a*b + B*b^2)* 
d^3)*tan(f*x + e)^5 + 15*(3*C*b^2*c^2*d + 3*(2*C*a*b + B*b^2)*c*d^2 + (C*a 
^2 + 2*B*a*b + (A - C)*b^2)*d^3)*tan(f*x + e)^4 + 20*(C*b^2*c^3 + 3*(2*C*a 
*b + B*b^2)*c^2*d + 3*(C*a^2 + 2*B*a*b + (A - C)*b^2)*c*d^2 + (B*a^2 + 2*( 
A - C)*a*b - B*b^2)*d^3)*tan(f*x + e)^3 + 60*(((A - C)*a^2 - 2*B*a*b - (A 
- C)*b^2)*c^3 - 3*(B*a^2 + 2*(A - C)*a*b - B*b^2)*c^2*d - 3*((A - C)*a^2 - 
 2*B*a*b - (A - C)*b^2)*c*d^2 + (B*a^2 + 2*(A - C)*a*b - B*b^2)*d^3)*f*x + 
 30*((2*C*a*b + B*b^2)*c^3 + 3*(C*a^2 + 2*B*a*b + (A - C)*b^2)*c^2*d + 3*( 
B*a^2 + 2*(A - C)*a*b - B*b^2)*c*d^2 + ((A - C)*a^2 - 2*B*a*b - (A - C)*b^ 
2)*d^3)*tan(f*x + e)^2 - 30*((B*a^2 + 2*(A - C)*a*b - B*b^2)*c^3 + 3*((A - 
 C)*a^2 - 2*B*a*b - (A - C)*b^2)*c^2*d - 3*(B*a^2 + 2*(A - C)*a*b - B*b^2) 
*c*d^2 - ((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*d^3)*log(1/(tan(f*x + e)^2 
+ 1)) + 60*((C*a^2 + 2*B*a*b + (A - C)*b^2)*c^3 + 3*(B*a^2 + 2*(A - C)*a*b 
 - B*b^2)*c^2*d + 3*((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*c*d^2 - (B*a^2 + 
 2*(A - C)*a*b - B*b^2)*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. 1819 vs. \(2 (547) = 1094\).

Time = 0.41 (sec) , antiderivative size = 1819, normalized size of antiderivative = 3.02 \[ \int (a+b \tan (e+f x))^2 (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))**2*(c+d*tan(f*x+e))**3*(A+B*tan(f*x+e)+C*tan(f* 
x+e)**2),x)
 

Output:

Piecewise((A*a**2*c**3*x + 3*A*a**2*c**2*d*log(tan(e + f*x)**2 + 1)/(2*f) 
- 3*A*a**2*c*d**2*x + 3*A*a**2*c*d**2*tan(e + f*x)/f - A*a**2*d**3*log(tan 
(e + f*x)**2 + 1)/(2*f) + A*a**2*d**3*tan(e + f*x)**2/(2*f) + A*a*b*c**3*l 
og(tan(e + f*x)**2 + 1)/f - 6*A*a*b*c**2*d*x + 6*A*a*b*c**2*d*tan(e + f*x) 
/f - 3*A*a*b*c*d**2*log(tan(e + f*x)**2 + 1)/f + 3*A*a*b*c*d**2*tan(e + f* 
x)**2/f + 2*A*a*b*d**3*x + 2*A*a*b*d**3*tan(e + f*x)**3/(3*f) - 2*A*a*b*d* 
*3*tan(e + f*x)/f - A*b**2*c**3*x + A*b**2*c**3*tan(e + f*x)/f - 3*A*b**2* 
c**2*d*log(tan(e + f*x)**2 + 1)/(2*f) + 3*A*b**2*c**2*d*tan(e + f*x)**2/(2 
*f) + 3*A*b**2*c*d**2*x + A*b**2*c*d**2*tan(e + f*x)**3/f - 3*A*b**2*c*d** 
2*tan(e + f*x)/f + A*b**2*d**3*log(tan(e + f*x)**2 + 1)/(2*f) + A*b**2*d** 
3*tan(e + f*x)**4/(4*f) - A*b**2*d**3*tan(e + f*x)**2/(2*f) + B*a**2*c**3* 
log(tan(e + f*x)**2 + 1)/(2*f) - 3*B*a**2*c**2*d*x + 3*B*a**2*c**2*d*tan(e 
 + f*x)/f - 3*B*a**2*c*d**2*log(tan(e + f*x)**2 + 1)/(2*f) + 3*B*a**2*c*d* 
*2*tan(e + f*x)**2/(2*f) + B*a**2*d**3*x + B*a**2*d**3*tan(e + f*x)**3/(3* 
f) - B*a**2*d**3*tan(e + f*x)/f - 2*B*a*b*c**3*x + 2*B*a*b*c**3*tan(e + f* 
x)/f - 3*B*a*b*c**2*d*log(tan(e + f*x)**2 + 1)/f + 3*B*a*b*c**2*d*tan(e + 
f*x)**2/f + 6*B*a*b*c*d**2*x + 2*B*a*b*c*d**2*tan(e + f*x)**3/f - 6*B*a*b* 
c*d**2*tan(e + f*x)/f + B*a*b*d**3*log(tan(e + f*x)**2 + 1)/f + B*a*b*d**3 
*tan(e + f*x)**4/(2*f) - B*a*b*d**3*tan(e + f*x)**2/f - B*b**2*c**3*log(ta 
n(e + f*x)**2 + 1)/(2*f) + B*b**2*c**3*tan(e + f*x)**2/(2*f) + 3*B*b**2...
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 680, normalized size of antiderivative = 1.13 \[ \int (a+b \tan (e+f x))^2 (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))^2*(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*(10*C*b^2*d^3*tan(f*x + e)^6 + 12*(3*C*b^2*c*d^2 + (2*C*a*b + B*b^2)* 
d^3)*tan(f*x + e)^5 + 15*(3*C*b^2*c^2*d + 3*(2*C*a*b + B*b^2)*c*d^2 + (C*a 
^2 + 2*B*a*b + (A - C)*b^2)*d^3)*tan(f*x + e)^4 + 20*(C*b^2*c^3 + 3*(2*C*a 
*b + B*b^2)*c^2*d + 3*(C*a^2 + 2*B*a*b + (A - C)*b^2)*c*d^2 + (B*a^2 + 2*( 
A - C)*a*b - B*b^2)*d^3)*tan(f*x + e)^3 + 30*((2*C*a*b + B*b^2)*c^3 + 3*(C 
*a^2 + 2*B*a*b + (A - C)*b^2)*c^2*d + 3*(B*a^2 + 2*(A - C)*a*b - B*b^2)*c* 
d^2 + ((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*d^3)*tan(f*x + e)^2 + 60*(((A 
- C)*a^2 - 2*B*a*b - (A - C)*b^2)*c^3 - 3*(B*a^2 + 2*(A - C)*a*b - B*b^2)* 
c^2*d - 3*((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*c*d^2 + (B*a^2 + 2*(A - C) 
*a*b - B*b^2)*d^3)*(f*x + e) + 30*((B*a^2 + 2*(A - C)*a*b - B*b^2)*c^3 + 3 
*((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*c^2*d - 3*(B*a^2 + 2*(A - C)*a*b - 
B*b^2)*c*d^2 - ((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*d^3)*log(tan(f*x + e) 
^2 + 1) + 60*((C*a^2 + 2*B*a*b + (A - C)*b^2)*c^3 + 3*(B*a^2 + 2*(A - C)*a 
*b - B*b^2)*c^2*d + 3*((A - C)*a^2 - 2*B*a*b - (A - C)*b^2)*c*d^2 - (B*a^2 
 + 2*(A - C)*a*b - B*b^2)*d^3)*tan(f*x + e))/f
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1413 vs. \(2 (593) = 1186\).

Time = 1.18 (sec) , antiderivative size = 1413, normalized size of antiderivative = 2.34 \[ \int (a+b \tan (e+f x))^2 (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))^2*(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^2*c^3 - C*a^2*c^3 - 2*B*a*b*c^3 - A*b^2*c^3 + C*b^2*c^3 - 3*B*a^2*c^2 
*d - 6*A*a*b*c^2*d + 6*C*a*b*c^2*d + 3*B*b^2*c^2*d - 3*A*a^2*c*d^2 + 3*C*a 
^2*c*d^2 + 6*B*a*b*c*d^2 + 3*A*b^2*c*d^2 - 3*C*b^2*c*d^2 + B*a^2*d^3 + 2*A 
*a*b*d^3 - 2*C*a*b*d^3 - B*b^2*d^3)*(f*x + e)/f + 1/2*(B*a^2*c^3 + 2*A*a*b 
*c^3 - 2*C*a*b*c^3 - B*b^2*c^3 + 3*A*a^2*c^2*d - 3*C*a^2*c^2*d - 6*B*a*b*c 
^2*d - 3*A*b^2*c^2*d + 3*C*b^2*c^2*d - 3*B*a^2*c*d^2 - 6*A*a*b*c*d^2 + 6*C 
*a*b*c*d^2 + 3*B*b^2*c*d^2 - A*a^2*d^3 + C*a^2*d^3 + 2*B*a*b*d^3 + A*b^2*d 
^3 - C*b^2*d^3)*log(tan(f*x + e)^2 + 1)/f + 1/60*(10*C*b^2*d^3*f^5*tan(f*x 
 + e)^6 + 36*C*b^2*c*d^2*f^5*tan(f*x + e)^5 + 24*C*a*b*d^3*f^5*tan(f*x + e 
)^5 + 12*B*b^2*d^3*f^5*tan(f*x + e)^5 + 45*C*b^2*c^2*d*f^5*tan(f*x + e)^4 
+ 90*C*a*b*c*d^2*f^5*tan(f*x + e)^4 + 45*B*b^2*c*d^2*f^5*tan(f*x + e)^4 + 
15*C*a^2*d^3*f^5*tan(f*x + e)^4 + 30*B*a*b*d^3*f^5*tan(f*x + e)^4 + 15*A*b 
^2*d^3*f^5*tan(f*x + e)^4 - 15*C*b^2*d^3*f^5*tan(f*x + e)^4 + 20*C*b^2*c^3 
*f^5*tan(f*x + e)^3 + 120*C*a*b*c^2*d*f^5*tan(f*x + e)^3 + 60*B*b^2*c^2*d* 
f^5*tan(f*x + e)^3 + 60*C*a^2*c*d^2*f^5*tan(f*x + e)^3 + 120*B*a*b*c*d^2*f 
^5*tan(f*x + e)^3 + 60*A*b^2*c*d^2*f^5*tan(f*x + e)^3 - 60*C*b^2*c*d^2*f^5 
*tan(f*x + e)^3 + 20*B*a^2*d^3*f^5*tan(f*x + e)^3 + 40*A*a*b*d^3*f^5*tan(f 
*x + e)^3 - 40*C*a*b*d^3*f^5*tan(f*x + e)^3 - 20*B*b^2*d^3*f^5*tan(f*x + e 
)^3 + 60*C*a*b*c^3*f^5*tan(f*x + e)^2 + 30*B*b^2*c^3*f^5*tan(f*x + e)^2 + 
90*C*a^2*c^2*d*f^5*tan(f*x + e)^2 + 180*B*a*b*c^2*d*f^5*tan(f*x + e)^2 ...
                                                                                    
                                                                                    
 

Mupad [B] (verification not implemented)

Time = 5.99 (sec) , antiderivative size = 891, normalized size of antiderivative = 1.48 \[ \int (a+b \tan (e+f x))^2 (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(e + f*x))^2*(c + d*tan(e + f*x))^3*(A + B*tan(e + f*x) + C* 
tan(e + f*x)^2),x)
 

Output:

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

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 1163, normalized size of antiderivative = 1.93 \[ \int (a+b \tan (e+f x))^2 (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))^2*(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**3*c**2*d - 30*log(tan(e + f*x)**2 + 1)*a** 
3*d**3 + 90*log(tan(e + f*x)**2 + 1)*a**2*b*c**3 - 270*log(tan(e + f*x)**2 
 + 1)*a**2*b*c*d**2 - 90*log(tan(e + f*x)**2 + 1)*a**2*c**3*d + 30*log(tan 
(e + f*x)**2 + 1)*a**2*c*d**3 - 270*log(tan(e + f*x)**2 + 1)*a*b**2*c**2*d 
 + 90*log(tan(e + f*x)**2 + 1)*a*b**2*d**3 - 60*log(tan(e + f*x)**2 + 1)*a 
*b*c**4 + 180*log(tan(e + f*x)**2 + 1)*a*b*c**2*d**2 - 30*log(tan(e + f*x) 
**2 + 1)*b**3*c**3 + 90*log(tan(e + f*x)**2 + 1)*b**3*c*d**2 + 90*log(tan( 
e + f*x)**2 + 1)*b**2*c**3*d - 30*log(tan(e + f*x)**2 + 1)*b**2*c*d**3 + 1 
0*tan(e + f*x)**6*b**2*c*d**3 + 24*tan(e + f*x)**5*a*b*c*d**3 + 12*tan(e + 
 f*x)**5*b**3*d**3 + 36*tan(e + f*x)**5*b**2*c**2*d**2 + 15*tan(e + f*x)** 
4*a**2*c*d**3 + 45*tan(e + f*x)**4*a*b**2*d**3 + 90*tan(e + f*x)**4*a*b*c* 
*2*d**2 + 45*tan(e + f*x)**4*b**3*c*d**2 + 45*tan(e + f*x)**4*b**2*c**3*d 
- 15*tan(e + f*x)**4*b**2*c*d**3 + 60*tan(e + f*x)**3*a**2*b*d**3 + 60*tan 
(e + f*x)**3*a**2*c**2*d**2 + 180*tan(e + f*x)**3*a*b**2*c*d**2 + 120*tan( 
e + f*x)**3*a*b*c**3*d - 40*tan(e + f*x)**3*a*b*c*d**3 + 60*tan(e + f*x)** 
3*b**3*c**2*d - 20*tan(e + f*x)**3*b**3*d**3 + 20*tan(e + f*x)**3*b**2*c** 
4 - 60*tan(e + f*x)**3*b**2*c**2*d**2 + 30*tan(e + f*x)**2*a**3*d**3 + 270 
*tan(e + f*x)**2*a**2*b*c*d**2 + 90*tan(e + f*x)**2*a**2*c**3*d - 30*tan(e 
 + f*x)**2*a**2*c*d**3 + 270*tan(e + f*x)**2*a*b**2*c**2*d - 90*tan(e + f* 
x)**2*a*b**2*d**3 + 60*tan(e + f*x)**2*a*b*c**4 - 180*tan(e + f*x)**2*a...