\(\int \frac {(a+b \tan (e+f x)) (A+B \tan (e+f x)+C \tan ^2(e+f x))}{c+d \tan (e+f x)} \, dx\) [72]

Optimal result
Mathematica [C] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [C] (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 = 156 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{c+d \tan (e+f x)} \, dx=\frac {(a (A c-c C+B d)-b (B c-(A-C) d)) x}{c^2+d^2}-\frac {(A b c+a B c-b c C-a A d+b B d+a C d) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}-\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right ) f}+\frac {b C \tan (e+f x)}{d f} \] Output:

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

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.72 (sec) , antiderivative size = 148, normalized size of antiderivative = 0.95 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{c+d \tan (e+f x)} \, dx=\frac {\frac {(-i a+b) (A+i B-C) \log (i-\tan (e+f x))}{c+i d}+\frac {(i a+b) (A-i B-C) \log (i+\tan (e+f x))}{c-i d}+\frac {2 (-b c+a d) \left (c^2 C-B c d+A d^2\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right )}+\frac {2 b C \tan (e+f x)}{d}}{2 f} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 1.30 (sec) , antiderivative size = 163, normalized size of antiderivative = 1.04, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.186, Rules used = {3042, 4120, 3042, 4109, 3042, 3956, 4100, 16}

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 \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{c+d \tan (e+f x)} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4120

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4109

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

\(\Big \downarrow \) 4100

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

\(\Big \downarrow \) 16

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 16
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + 
b*x, x]]/b), x] /; FreeQ[{a, b, c}, 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 4100
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + 
 (f_.)*(x_)]^2), x_Symbol] :> Simp[A/(b*f)   Subst[Int[(a + x)^m, x], x, b* 
Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]
 

rule 4109
Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2 
)/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*A + b*B - a 
*C)*(x/(a^2 + b^2)), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2)   Int[( 
1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Simp[(A*b - a*B - b*C)/( 
a^2 + b^2)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] & 
& NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a*B - b*C 
, 0]
 

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] (verified)

Time = 0.19 (sec) , antiderivative size = 173, normalized size of antiderivative = 1.11

method result size
derivativedivides \(\frac {\frac {\tan \left (f x +e \right ) C b}{d}+\frac {\frac {\left (-A a d +A b c +B a c +B b d +C a d -C b c \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A a c +A b d +B a d -B b c -C a c -C b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}}{f}\) \(173\)
default \(\frac {\frac {\tan \left (f x +e \right ) C b}{d}+\frac {\frac {\left (-A a d +A b c +B a c +B b d +C a d -C b c \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A a c +A b d +B a d -B b c -C a c -C b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} \left (c^{2}+d^{2}\right )}}{f}\) \(173\)
norman \(\frac {\left (A a c +A b d +B a d -B b c -C a c -C b d \right ) x}{c^{2}+d^{2}}+\frac {b C \tan \left (f x +e \right )}{d f}+\frac {\left (A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{2} f \left (c^{2}+d^{2}\right )}-\frac {\left (A a d -A b c -B a c -B b d -C a d +C b c \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 \left (c^{2}+d^{2}\right ) f}\) \(181\)
parallelrisch \(-\frac {-2 A a c \,d^{2} f x -2 A b \,d^{3} f x -2 B a \,d^{3} f x +2 B b c \,d^{2} f x +2 C a c \,d^{2} f x +2 C b \,d^{3} f x +A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,d^{3}-A \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b c \,d^{2}-2 A \ln \left (c +d \tan \left (f x +e \right )\right ) a \,d^{3}+2 A \ln \left (c +d \tan \left (f x +e \right )\right ) b c \,d^{2}-B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a c \,d^{2}-B \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b \,d^{3}+2 B \ln \left (c +d \tan \left (f x +e \right )\right ) a c \,d^{2}-2 B \ln \left (c +d \tan \left (f x +e \right )\right ) b \,c^{2} d -C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,d^{3}+C \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b c \,d^{2}-2 C \ln \left (c +d \tan \left (f x +e \right )\right ) a \,c^{2} d +2 C \ln \left (c +d \tan \left (f x +e \right )\right ) b \,c^{3}-2 \tan \left (f x +e \right ) C b \,c^{2} d -2 \tan \left (f x +e \right ) C b \,d^{3}}{2 d^{2} f \left (c^{2}+d^{2}\right )}\) \(324\)
risch \(-\frac {x A a}{i d -c}+\frac {x B b}{i d -c}+\frac {x C a}{i d -c}+\frac {i x A b}{i d -c}+\frac {i x B a}{i d -c}-\frac {i x C b}{i d -c}+\frac {2 i B b x}{d}+\frac {2 i C a x}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B b}{d f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) C a}{d f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) B b \,c^{2}}{d f \left (c^{2}+d^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) C a \,c^{2}}{d f \left (c^{2}+d^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) C b \,c^{3}}{d^{2} f \left (c^{2}+d^{2}\right )}+\frac {2 i C b \,c^{3} e}{d^{2} f \left (c^{2}+d^{2}\right )}-\frac {2 i B b \,c^{2} e}{d f \left (c^{2}+d^{2}\right )}-\frac {2 i C a \,c^{2} e}{d f \left (c^{2}+d^{2}\right )}+\frac {2 i C b}{f d \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {2 i B b e}{d f}+\frac {2 i C a e}{d f}-\frac {2 i C b c x}{d^{2}}-\frac {2 i d A a x}{c^{2}+d^{2}}+\frac {2 i A b c x}{c^{2}+d^{2}}+\frac {2 i B a c x}{c^{2}+d^{2}}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) C b c}{d^{2} f}+\frac {d \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) A a}{f \left (c^{2}+d^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) A b c}{f \left (c^{2}+d^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) B a c}{f \left (c^{2}+d^{2}\right )}-\frac {2 i C b c e}{d^{2} f}-\frac {2 i d A a e}{f \left (c^{2}+d^{2}\right )}+\frac {2 i A b c e}{f \left (c^{2}+d^{2}\right )}+\frac {2 i B a c e}{f \left (c^{2}+d^{2}\right )}-\frac {2 i B b \,c^{2} x}{d \left (c^{2}+d^{2}\right )}-\frac {2 i C a \,c^{2} x}{d \left (c^{2}+d^{2}\right )}+\frac {2 i C b \,c^{3} x}{d^{2} \left (c^{2}+d^{2}\right )}\) \(776\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

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

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

Output:

Piecewise((zoo*x*(a + b*tan(e))*(A + B*tan(e) + C*tan(e)**2)/tan(e), Eq(c, 
 0) & Eq(d, 0) & Eq(f, 0)), ((A*a*x + A*b*log(tan(e + f*x)**2 + 1)/(2*f) + 
 B*a*log(tan(e + f*x)**2 + 1)/(2*f) - B*b*x + B*b*tan(e + f*x)/f - C*a*x + 
 C*a*tan(e + f*x)/f - C*b*log(tan(e + f*x)**2 + 1)/(2*f) + C*b*tan(e + f*x 
)**2/(2*f))/c, Eq(d, 0)), (I*A*a*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2* 
I*d*f) + A*a*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*A*a/(2*d*f*tan(e + f*x 
) - 2*I*d*f) + A*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*A*b 
*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) - A*b/(2*d*f*tan(e + f*x) - 2*I*d*f) + 
 B*a*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*B*a*f*x/(2*d*f*ta 
n(e + f*x) - 2*I*d*f) - B*a/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*B*b*f*x*tan 
(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) + B*b*f*x/(2*d*f*tan(e + f*x) - 2 
*I*d*f) + B*b*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) - 
2*I*d*f) - I*B*b*log(tan(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) - 2*I*d*f) - 
 I*B*b/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*C*a*f*x*tan(e + f*x)/(2*d*f*tan( 
e + f*x) - 2*I*d*f) + C*a*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + C*a*log(tan 
(e + f*x)**2 + 1)*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*C*a*log( 
tan(e + f*x)**2 + 1)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*C*a/(2*d*f*tan(e + 
 f*x) - 2*I*d*f) - 3*C*b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) + 
 3*I*C*b*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*C*b*log(tan(e + f*x)**2 + 
1)*tan(e + f*x)/(2*d*f*tan(e + f*x) - 2*I*d*f) + C*b*log(tan(e + f*x)**...
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.56 (sec) , antiderivative size = 190, normalized size of antiderivative = 1.22 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{c+d \tan (e+f x)} \, dx=\frac {{\left (A a c - C a c - B b c + B a d + A b d - C b d\right )} {\left (f x + e\right )}}{c^{2} f + d^{2} f} + \frac {{\left (B a c + A b c - C b c - A a d + C a d + B b d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, {\left (c^{2} f + d^{2} f\right )}} - \frac {{\left (C b c^{3} - C a c^{2} d - B b c^{2} d + B a c d^{2} + A b c d^{2} - A a d^{3}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{2} d^{2} f + d^{4} f} + \frac {C b \tan \left (f x + e\right )}{d f} \] Input:

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

Output:

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

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

( - log(tan(e + f*x)**2 + 1)*a**2*d**3 + 2*log(tan(e + f*x)**2 + 1)*a*b*c* 
d**2 + log(tan(e + f*x)**2 + 1)*a*c*d**3 + log(tan(e + f*x)**2 + 1)*b**2*d 
**3 - log(tan(e + f*x)**2 + 1)*b*c**2*d**2 + 2*log(tan(e + f*x)*d + c)*a** 
2*d**3 - 4*log(tan(e + f*x)*d + c)*a*b*c*d**2 + 2*log(tan(e + f*x)*d + c)* 
a*c**3*d + 2*log(tan(e + f*x)*d + c)*b**2*c**2*d - 2*log(tan(e + f*x)*d + 
c)*b*c**4 + 2*tan(e + f*x)*b*c**3*d + 2*tan(e + f*x)*b*c*d**3 + 2*a**2*c*d 
**2*f*x + 4*a*b*d**3*f*x - 2*a*c**2*d**2*f*x - 2*b**2*c*d**2*f*x - 2*b*c*d 
**3*f*x)/(2*d**2*f*(c**2 + d**2))