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

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

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

Mathematica [C] (verified)

Result contains complex when optimal does not.

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

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

Output:

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

Rubi [A] (verified)

Time = 0.55 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.10, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 4012, 3042, 4014, 3042, 4013}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4012

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4014

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4013

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

Input:

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

Output:

(((a^2*c - b^2*c + 2*a*b*d)*x)/(a^2 + b^2) + ((2*a*b*c - a^2*d + b^2*d)*Lo 
g[a*Cos[e + f*x] + b*Sin[e + f*x]])/((a^2 + b^2)*f))/(a^2 + b^2) - (b*c - 
a*d)/((a^2 + b^2)*f*(a + b*Tan[e + f*x]))
 

Defintions of rubi rules used

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

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

rule 4013
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* 
(x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si 
n[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] && EqQ[a*c + b*d, 0]
 

rule 4014
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a 
*d)/(a^2 + b^2)   Int[(b - a*Tan[e + f*x])/(a + b*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] && N 
eQ[a*c + b*d, 0]
 
Maple [A] (verified)

Time = 0.17 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.27

method result size
derivativedivides \(\frac {\frac {\frac {\left (a^{2} d -2 a b c -b^{2} d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{2} c +2 a b d -b^{2} c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {a d -b c}{\left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}-\frac {\left (a^{2} d -2 a b c -b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{f}\) \(141\)
default \(\frac {\frac {\frac {\left (a^{2} d -2 a b c -b^{2} d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{2} c +2 a b d -b^{2} c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {a d -b c}{\left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}-\frac {\left (a^{2} d -2 a b c -b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{f}\) \(141\)
norman \(\frac {\frac {a \left (a^{2} c +2 a b d -b^{2} c \right ) x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {b \left (a^{2} c +2 a b d -b^{2} c \right ) x \tan \left (f x +e \right )}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {\left (-a d +b c \right ) b \tan \left (f x +e \right )}{a f \left (a^{2}+b^{2}\right )}}{a +b \tan \left (f x +e \right )}+\frac {\left (a^{2} d -2 a b c -b^{2} d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {\left (a^{2} d -2 a b c -b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) \(227\)
parallelrisch \(\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a^{3} b d -2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a^{2} b^{2} c -\ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a \,b^{3} d -2 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{3} b d +4 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} b^{2} c +2 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a \,b^{3} d +4 x \,a^{3} b d f -2 x \,a^{2} b^{2} c f +2 x \,a^{4} c f -2 \tan \left (f x +e \right ) a^{3} b d +2 \tan \left (f x +e \right ) a^{2} b^{2} c -2 \tan \left (f x +e \right ) a \,b^{3} d -2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} b c -\ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} b^{2} d +4 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{3} b c +2 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{2} b^{2} d +4 x \tan \left (f x +e \right ) a^{2} b^{2} d f -2 x \tan \left (f x +e \right ) a \,b^{3} c f +2 x \tan \left (f x +e \right ) a^{3} b c f +\ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{4} d -2 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{4} d +2 \tan \left (f x +e \right ) b^{4} c}{2 \left (a +b \tan \left (f x +e \right )\right ) \left (a^{2}+b^{2}\right )^{2} a f}\) \(415\)
risch \(\frac {i x d}{2 i a b -a^{2}+b^{2}}-\frac {x c}{2 i a b -a^{2}+b^{2}}+\frac {2 i a^{2} d x}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {4 i a b c x}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {2 i b^{2} d x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {2 i a^{2} d e}{f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {4 i a b c e}{f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {2 i b^{2} d e}{f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 i b a d}{\left (-i a +b \right ) f \left (i a +b \right )^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )} b +i a \,{\mathrm e}^{2 i \left (f x +e \right )}-b +i a \right )}-\frac {2 i b^{2} c}{\left (-i a +b \right ) f \left (i a +b \right )^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )} b +i a \,{\mathrm e}^{2 i \left (f x +e \right )}-b +i a \right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) a^{2} d}{f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) a b c}{f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) b^{2} d}{f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) \(482\)

Input:

int((c+d*tan(f*x+e))/(a+b*tan(f*x+e))^2,x,method=_RETURNVERBOSE)
 

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 225 vs. \(2 (111) = 222\).

Time = 0.10 (sec) , antiderivative size = 225, normalized size of antiderivative = 2.03 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx=-\frac {2 \, b^{3} c - 2 \, a b^{2} d - 2 \, {\left (2 \, a^{2} b d + {\left (a^{3} - a b^{2}\right )} c\right )} f x - {\left (2 \, a^{2} b c - {\left (a^{3} - a b^{2}\right )} d + {\left (2 \, a b^{2} c - {\left (a^{2} b - b^{3}\right )} d\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (a b^{2} c - a^{2} b d + {\left (2 \, a b^{2} d + {\left (a^{2} b - b^{3}\right )} c\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} f \tan \left (f x + e\right ) + {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} f\right )}} \] Input:

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

Output:

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

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.90 (sec) , antiderivative size = 2878, normalized size of antiderivative = 25.93 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx=\text {Too large to display} \] Input:

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

Output:

Piecewise((zoo*x*(c + d*tan(e))/tan(e)**2, Eq(a, 0) & Eq(b, 0) & Eq(f, 0)) 
, ((c*x + d*log(tan(e + f*x)**2 + 1)/(2*f))/a**2, Eq(b, 0)), (-c*f*x*tan(e 
 + f*x)**2/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) 
 + 2*I*c*f*x*tan(e + f*x)/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f 
*x) - 4*b**2*f) + c*f*x/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x 
) - 4*b**2*f) - c*tan(e + f*x)/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan( 
e + f*x) - 4*b**2*f) + 2*I*c/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e 
+ f*x) - 4*b**2*f) + I*d*f*x*tan(e + f*x)**2/(4*b**2*f*tan(e + f*x)**2 - 8 
*I*b**2*f*tan(e + f*x) - 4*b**2*f) + 2*d*f*x*tan(e + f*x)/(4*b**2*f*tan(e 
+ f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) - I*d*f*x/(4*b**2*f*tan(e 
+ f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + I*d*tan(e + f*x)/(4*b**2 
*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f), Eq(a, -I*b)), (- 
c*f*x*tan(e + f*x)**2/(4*b**2*f*tan(e + f*x)**2 + 8*I*b**2*f*tan(e + f*x) 
- 4*b**2*f) - 2*I*c*f*x*tan(e + f*x)/(4*b**2*f*tan(e + f*x)**2 + 8*I*b**2* 
f*tan(e + f*x) - 4*b**2*f) + c*f*x/(4*b**2*f*tan(e + f*x)**2 + 8*I*b**2*f* 
tan(e + f*x) - 4*b**2*f) - c*tan(e + f*x)/(4*b**2*f*tan(e + f*x)**2 + 8*I* 
b**2*f*tan(e + f*x) - 4*b**2*f) - 2*I*c/(4*b**2*f*tan(e + f*x)**2 + 8*I*b* 
*2*f*tan(e + f*x) - 4*b**2*f) - I*d*f*x*tan(e + f*x)**2/(4*b**2*f*tan(e + 
f*x)**2 + 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + 2*d*f*x*tan(e + f*x)/(4*b* 
*2*f*tan(e + f*x)**2 + 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + I*d*f*x/(4...
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 205, normalized size of antiderivative = 1.85 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx=\frac {{\left (a^{2} c - b^{2} c + 2 \, a b d\right )} {\left (f x + e\right )}}{a^{4} f + 2 \, a^{2} b^{2} f + b^{4} f} - \frac {{\left (2 \, a b c - a^{2} d + b^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, {\left (a^{4} f + 2 \, a^{2} b^{2} f + b^{4} f\right )}} + \frac {{\left (2 \, a b^{2} c - a^{2} b d + b^{3} d\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{4} b f + 2 \, a^{2} b^{3} f + b^{5} f} - \frac {a^{2} b c + b^{3} c - a^{3} d - a b^{2} d}{{\left (a^{2} + b^{2}\right )}^{2} {\left (b \tan \left (f x + e\right ) + a\right )} f} \] Input:

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

Output:

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

Mupad [B] (verification not implemented)

Time = 2.46 (sec) , antiderivative size = 152, normalized size of antiderivative = 1.37 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx=\frac {a\,d-b\,c}{f\,\left (a^2+b^2\right )\,\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (c+d\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^2\,1{}\mathrm {i}+2\,a\,b+b^2\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (d+c\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^2+a\,b\,2{}\mathrm {i}+b^2\right )}+\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (-d\,a^2+2\,c\,a\,b+d\,b^2\right )}{f\,{\left (a^2+b^2\right )}^2} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 447, normalized size of antiderivative = 4.03 \[ \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx=\frac {\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) \tan \left (f x +e \right ) a^{3} b d -2 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) \tan \left (f x +e \right ) a^{2} b^{2} c -\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) \tan \left (f x +e \right ) a \,b^{3} d +\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{4} d -2 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{3} b c -\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{2} b^{2} d -2 \,\mathrm {log}\left (\tan \left (f x +e \right ) b +a \right ) \tan \left (f x +e \right ) a^{3} b d +4 \,\mathrm {log}\left (\tan \left (f x +e \right ) b +a \right ) \tan \left (f x +e \right ) a^{2} b^{2} c +2 \,\mathrm {log}\left (\tan \left (f x +e \right ) b +a \right ) \tan \left (f x +e \right ) a \,b^{3} d -2 \,\mathrm {log}\left (\tan \left (f x +e \right ) b +a \right ) a^{4} d +4 \,\mathrm {log}\left (\tan \left (f x +e \right ) b +a \right ) a^{3} b c +2 \,\mathrm {log}\left (\tan \left (f x +e \right ) b +a \right ) a^{2} b^{2} d +2 \tan \left (f x +e \right ) a^{3} b c f x -2 \tan \left (f x +e \right ) a^{3} b d +2 \tan \left (f x +e \right ) a^{2} b^{2} c +4 \tan \left (f x +e \right ) a^{2} b^{2} d f x -2 \tan \left (f x +e \right ) a \,b^{3} c f x -2 \tan \left (f x +e \right ) a \,b^{3} d +2 \tan \left (f x +e \right ) b^{4} c +2 a^{4} c f x +4 a^{3} b d f x -2 a^{2} b^{2} c f x}{2 a f \left (\tan \left (f x +e \right ) a^{4} b +2 \tan \left (f x +e \right ) a^{2} b^{3}+\tan \left (f x +e \right ) b^{5}+a^{5}+2 a^{3} b^{2}+a \,b^{4}\right )} \] Input:

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

Output:

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