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

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

Optimal result

Integrand size = 25, antiderivative size = 183 \[ \int \frac {1}{(a+b \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx=\frac {\left (a^2 c-b^2 c-2 a b d\right ) x}{\left (a^2+b^2\right )^2 \left (c^2+d^2\right )}+\frac {b^2 \left (2 a b c-3 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 (b c-a d)^2 f}+\frac {d^3 \log (c \cos (e+f x)+d \sin (e+f x))}{(b c-a d)^2 \left (c^2+d^2\right ) f}-\frac {b^2}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))} \] Output:

(a^2*c-2*a*b*d-b^2*c)*x/(a^2+b^2)^2/(c^2+d^2)+b^2*(-3*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/(-a*d+b*c)^2/f+d^3*ln(c*cos(f*x 
+e)+d*sin(f*x+e))/(-a*d+b*c)^2/(c^2+d^2)/f-b^2/(a^2+b^2)/(-a*d+b*c)/f/(a+b 
*tan(f*x+e))
 

Mathematica [A] (verified)

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

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

Output:

-1/2*(((2*a*b*c + a^2*d - b^2*d + (Sqrt[-b^2]*(a^2*c - b^2*c - 2*a*b*d))/b 
)*Log[Sqrt[-b^2] - b*Tan[e + f*x]])/((a^2 + b^2)^2*(c^2 + d^2)) + (2*b^2*( 
-2*a*b*c + 3*a^2*d + b^2*d)*Log[a + b*Tan[e + f*x]])/((a^2 + b^2)^2*(b*c - 
 a*d)^2) + ((2*a*b*c + a^2*d - b^2*d + (Sqrt[-b^2]*(-(a^2*c) + b^2*c + 2*a 
*b*d))/b)*Log[Sqrt[-b^2] + b*Tan[e + f*x]])/((a^2 + b^2)^2*(c^2 + d^2)) - 
(2*d^3*Log[c + d*Tan[e + f*x]])/((b*c - a*d)^2*(c^2 + d^2)) + (2*b^2)/((a^ 
2 + b^2)*(b*c - a*d)*(a + b*Tan[e + f*x])))/f
 

Rubi [A] (verified)

Time = 0.96 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.20, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.280, Rules used = {3042, 4052, 25, 3042, 4134, 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 {1}{(a+b \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4052

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4134

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4013

\(\displaystyle \frac {\frac {x (b c-a d) \left (a^2 c-2 a b d-b^2 c\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )}+\frac {d^3 \left (a^2+b^2\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right ) (b c-a d)}+\frac {b^2 \left (-3 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 ) (b c-a d)}}{\left (a^2+b^2\right ) (b c-a d)}-\frac {b^2}{f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))}\)

Input:

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

Output:

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

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

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 4052
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m + 1)*((c 
+ d*Tan[e + f*x])^(n + 1)/(f*(m + 1)*(a^2 + b^2)*(b*c - a*d))), x] + Simp[1 
/((m + 1)*(a^2 + b^2)*(b*c - a*d))   Int[(a + b*Tan[e + f*x])^(m + 1)*(c + 
d*Tan[e + f*x])^n*Simp[a*(b*c - a*d)*(m + 1) - b^2*d*(m + n + 2) - b*(b*c - 
 a*d)*(m + 1)*Tan[e + f*x] - b^2*d*(m + n + 2)*Tan[e + f*x]^2, x], x], x] / 
; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] 
 && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && LtQ[m, -1] && (LtQ[n, 0] || Integ 
erQ[m]) &&  !(ILtQ[n, -1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))
 

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

Time = 0.35 (sec) , antiderivative size = 202, normalized size of antiderivative = 1.10

method result size
derivativedivides \(\frac {\frac {d^{3} \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (c^{2}+d^{2}\right )}+\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} \left (c^{2}+d^{2}\right )}+\frac {b^{2}}{\left (a d -b c \right ) \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}-\frac {b^{2} \left (3 a^{2} d -2 a b c +b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (a^{2}+b^{2}\right )^{2}}}{f}\) \(202\)
default \(\frac {\frac {d^{3} \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (c^{2}+d^{2}\right )}+\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} \left (c^{2}+d^{2}\right )}+\frac {b^{2}}{\left (a d -b c \right ) \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}-\frac {b^{2} \left (3 a^{2} d -2 a b c +b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (a^{2}+b^{2}\right )^{2}}}{f}\) \(202\)
norman \(\frac {\frac {a \left (a^{2} c -2 a b d -b^{2} c \right ) x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (c^{2}+d^{2}\right )}+\frac {b^{2}}{\left (a d -b c \right ) f \left (a^{2}+b^{2}\right )}+\frac {\left (a^{2} c -2 a b d -b^{2} c \right ) b x \tan \left (f x +e \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (c^{2}+d^{2}\right )}}{a +b \tan \left (f x +e \right )}+\frac {d^{3} \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (a^{2} c^{2} d^{2}+a^{2} d^{4}-2 a b \,c^{3} d -2 a b c \,d^{3}+b^{2} c^{4}+b^{2} c^{2} d^{2}\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 ) \left (c^{2}+d^{2}\right )}-\frac {b^{2} \left (3 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} d^{2}-2 a b c d +b^{2} c^{2}\right ) f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) \(346\)
parallelrisch \(\text {Expression too large to display}\) \(1143\)
risch \(\text {Expression too large to display}\) \(1273\)

Input:

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

Output:

1/f*(d^3/(a*d-b*c)^2/(c^2+d^2)*ln(c+d*tan(f*x+e))+1/(a^2+b^2)^2/(c^2+d^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)*arcta 
n(tan(f*x+e)))+b^2/(a*d-b*c)/(a^2+b^2)/(a+b*tan(f*x+e))-b^2*(3*a^2*d-2*a*b 
*c+b^2*d)/(a*d-b*c)^2/(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. 756 vs. \(2 (183) = 366\).

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

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

Output:

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

Sympy [F(-2)]

Exception generated. \[ \int \frac {1}{(a+b \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx=\text {Exception raised: NotImplementedError} \] Input:

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

Output:

Exception raised: NotImplementedError >> no valid subset found
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 384 vs. \(2 (183) = 366\).

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

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

Output:

1/2*(2*d^3*log(d*tan(f*x + e) + c)/(b^2*c^4 - 2*a*b*c^3*d - 2*a*b*c*d^3 + 
a^2*d^4 + (a^2 + b^2)*c^2*d^2) - 2*(2*a*b*d - (a^2 - b^2)*c)*(f*x + e)/((a 
^4 + 2*a^2*b^2 + b^4)*c^2 + (a^4 + 2*a^2*b^2 + b^4)*d^2) - 2*b^2/((a^3*b + 
 a*b^3)*c - (a^4 + a^2*b^2)*d + ((a^2*b^2 + b^4)*c - (a^3*b + a*b^3)*d)*ta 
n(f*x + e)) + 2*(2*a*b^3*c - (3*a^2*b^2 + b^4)*d)*log(b*tan(f*x + e) + a)/ 
((a^4*b^2 + 2*a^2*b^4 + b^6)*c^2 - 2*(a^5*b + 2*a^3*b^3 + a*b^5)*c*d + (a^ 
6 + 2*a^4*b^2 + a^2*b^4)*d^2) - (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)*c^2 + (a^4 + 2*a^2*b^2 + b^4)*d^2))/f
                                                                                    
                                                                                    
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 449 vs. \(2 (183) = 366\).

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 4.18 (sec) , antiderivative size = 309, normalized size of antiderivative = 1.69 \[ \int \frac {1}{(a+b \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx=\frac {b^2}{f\,\left (a\,d-b\,c\right )\,\left (a^2+b^2\right )\,\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (d\,\left (3\,a^2\,b^2+b^4\right )-2\,a\,b^3\,c\right )}{f\,\left (a^6\,d^2-2\,a^5\,b\,c\,d+a^4\,b^2\,c^2+2\,a^4\,b^2\,d^2-4\,a^3\,b^3\,c\,d+2\,a^2\,b^4\,c^2+a^2\,b^4\,d^2-2\,a\,b^5\,c\,d+b^6\,c^2\right )}+\frac {d^3\,\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}{f\,{\left (a\,d-b\,c\right )}^2\,\left (c^2+d^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (a^2\,c-b^2\,c-2\,a\,b\,d+a^2\,d\,1{}\mathrm {i}-b^2\,d\,1{}\mathrm {i}+a\,b\,c\,2{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (b^2\,c-a^2\,c+2\,a\,b\,d+a^2\,d\,1{}\mathrm {i}-b^2\,d\,1{}\mathrm {i}+a\,b\,c\,2{}\mathrm {i}\right )} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

( - log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**5*b*d**3 + 3*log(tan(e + f*x) 
**2 + 1)*tan(e + f*x)*a**3*b**3*c**2*d + log(tan(e + f*x)**2 + 1)*tan(e + 
f*x)*a**3*b**3*d**3 - 2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**2*b**4*c* 
*3 - 2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**2*b**4*c*d**2 + log(tan(e 
+ f*x)**2 + 1)*tan(e + f*x)*a*b**5*c**2*d - log(tan(e + f*x)**2 + 1)*a**6* 
d**3 + 3*log(tan(e + f*x)**2 + 1)*a**4*b**2*c**2*d + log(tan(e + f*x)**2 + 
 1)*a**4*b**2*d**3 - 2*log(tan(e + f*x)**2 + 1)*a**3*b**3*c**3 - 2*log(tan 
(e + f*x)**2 + 1)*a**3*b**3*c*d**2 + log(tan(e + f*x)**2 + 1)*a**2*b**4*c* 
*2*d - 6*log(tan(e + f*x)*b + a)*tan(e + f*x)*a**3*b**3*c**2*d - 6*log(tan 
(e + f*x)*b + a)*tan(e + f*x)*a**3*b**3*d**3 + 4*log(tan(e + f*x)*b + a)*t 
an(e + f*x)*a**2*b**4*c**3 + 4*log(tan(e + f*x)*b + a)*tan(e + f*x)*a**2*b 
**4*c*d**2 - 2*log(tan(e + f*x)*b + a)*tan(e + f*x)*a*b**5*c**2*d - 2*log( 
tan(e + f*x)*b + a)*tan(e + f*x)*a*b**5*d**3 - 6*log(tan(e + f*x)*b + a)*a 
**4*b**2*c**2*d - 6*log(tan(e + f*x)*b + a)*a**4*b**2*d**3 + 4*log(tan(e + 
 f*x)*b + a)*a**3*b**3*c**3 + 4*log(tan(e + f*x)*b + a)*a**3*b**3*c*d**2 - 
 2*log(tan(e + f*x)*b + a)*a**2*b**4*c**2*d - 2*log(tan(e + f*x)*b + a)*a* 
*2*b**4*d**3 + 2*log(tan(e + f*x)*d + c)*tan(e + f*x)*a**5*b*d**3 + 4*log( 
tan(e + f*x)*d + c)*tan(e + f*x)*a**3*b**3*d**3 + 2*log(tan(e + f*x)*d + c 
)*tan(e + f*x)*a*b**5*d**3 + 2*log(tan(e + f*x)*d + c)*a**6*d**3 + 4*log(t 
an(e + f*x)*d + c)*a**4*b**2*d**3 + 2*log(tan(e + f*x)*d + c)*a**2*b**4...