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

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

Optimal result

Integrand size = 31, antiderivative size = 198 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^2}{(a+b \sec (e+f x))^2} \, dx=\frac {d^2 \text {arctanh}(\sin (e+f x))}{b^2 f}+\frac {2 (b c-a d)^2 \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a (a-b)^{3/2} (a+b)^{3/2} f}+\frac {2 \left (b^2 c^2-a^2 d^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} b^2 \sqrt {a+b} f}-\frac {(b c-a d)^2 \sin (e+f x)}{b \left (a^2-b^2\right ) f (b+a \cos (e+f x))} \] Output:

d^2*arctanh(sin(f*x+e))/b^2/f+2*(-a*d+b*c)^2*arctanh((a-b)^(1/2)*tan(1/2*f 
*x+1/2*e)/(a+b)^(1/2))/a/(a-b)^(3/2)/(a+b)^(3/2)/f+2*(-a^2*d^2+b^2*c^2)*ar 
ctanh((a-b)^(1/2)*tan(1/2*f*x+1/2*e)/(a+b)^(1/2))/a/(a-b)^(1/2)/b^2/(a+b)^ 
(1/2)/f-(-a*d+b*c)^2*sin(f*x+e)/b/(a^2-b^2)/f/(b+a*cos(f*x+e))
 

Mathematica [A] (verified)

Time = 1.12 (sec) , antiderivative size = 180, normalized size of antiderivative = 0.91 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^2}{(a+b \sec (e+f x))^2} \, dx=\frac {\frac {2 \left (2 b^3 c d+a^3 d^2-a b^2 \left (c^2+2 d^2\right )\right ) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}-d^2 \log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )+d^2 \log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )+\frac {b (b c-a d)^2 \sin (e+f x)}{(-a+b) (a+b) (b+a \cos (e+f x))}}{b^2 f} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.65 (sec) , antiderivative size = 198, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3042, 4476, 3042, 3431, 2009}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4476

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3431

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {2 \left (b^2 c^2-a^2 d^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a b^2 f \sqrt {a-b} \sqrt {a+b}}-\frac {(b c-a d)^2 \sin (e+f x)}{b f \left (a^2-b^2\right ) (a \cos (e+f x)+b)}+\frac {2 (b c-a d)^2 \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a f (a-b)^{3/2} (a+b)^{3/2}}+\frac {d^2 \text {arctanh}(\sin (e+f x))}{b^2 f}\)

Input:

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

Output:

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

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 3431
Int[((g_.)*sin[(e_.) + (f_.)*(x_)])^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Int[Exp 
andTrig[(g*sin[e + f*x])^p*(a + b*sin[e + f*x])^m*(c + d*sin[e + f*x])^n, x 
], x] /; FreeQ[{a, b, c, d, e, f, g, n, p}, x] && NeQ[b*c - a*d, 0] && (Int 
egersQ[m, n] || IntegersQ[m, p] || IntegersQ[n, p]) && NeQ[p, 2]
 

rule 4476
Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_), x_Symbol] :> Simp[1 
/g^(m + n)   Int[(g*Csc[e + f*x])^(m + n + p)*(b + a*Sin[e + f*x])^m*(d + c 
*Sin[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] && NeQ[b*c - 
 a*d, 0] && IntegerQ[m] && IntegerQ[n]
 
Maple [A] (verified)

Time = 0.49 (sec) , antiderivative size = 215, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {\frac {\frac {2 b \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} a -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} b -a -b \right )}-\frac {2 \left (a^{3} d^{2}-b^{2} c^{2} a -2 b^{2} d^{2} a +2 c d \,b^{3}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}}{b^{2}}+\frac {d^{2} \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{b^{2}}-\frac {d^{2} \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{b^{2}}}{f}\) \(215\)
default \(\frac {\frac {\frac {2 b \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} a -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} b -a -b \right )}-\frac {2 \left (a^{3} d^{2}-b^{2} c^{2} a -2 b^{2} d^{2} a +2 c d \,b^{3}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}}{b^{2}}+\frac {d^{2} \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{b^{2}}-\frac {d^{2} \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{b^{2}}}{f}\) \(215\)
risch \(-\frac {2 i \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \left (b \,{\mathrm e}^{i \left (f x +e \right )}+a \right )}{\left (a^{2}-b^{2}\right ) f b a \left (a \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b \,{\mathrm e}^{i \left (f x +e \right )}+a \right )}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) a^{3} d^{2}}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f \,b^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) c^{2} a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}-\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) d^{2} a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}+\frac {2 b \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) c d}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) a^{3} d^{2}}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f \,b^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) c^{2} a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}+\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) d^{2} a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}-\frac {2 b \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) c d}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}+\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{b^{2} f}-\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{b^{2} f}\) \(819\)

Input:

int(sec(f*x+e)*(c+d*sec(f*x+e))^2/(a+b*sec(f*x+e))^2,x,method=_RETURNVERBO 
SE)
 

Output:

1/f*(2/b^2*(b*(a^2*d^2-2*a*b*c*d+b^2*c^2)/(a^2-b^2)*tan(1/2*f*x+1/2*e)/(ta 
n(1/2*f*x+1/2*e)^2*a-tan(1/2*f*x+1/2*e)^2*b-a-b)-(a^3*d^2-a*b^2*c^2-2*a*b^ 
2*d^2+2*b^3*c*d)/(a+b)/(a-b)/((a+b)*(a-b))^(1/2)*arctanh((a-b)*tan(1/2*f*x 
+1/2*e)/((a+b)*(a-b))^(1/2)))+d^2/b^2*ln(tan(1/2*f*x+1/2*e)+1)-d^2/b^2*ln( 
tan(1/2*f*x+1/2*e)-1))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 371 vs. \(2 (180) = 360\).

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

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

Output:

[-1/2*((a*b^3*c^2 - 2*b^4*c*d - (a^3*b - 2*a*b^3)*d^2 + (a^2*b^2*c^2 - 2*a 
*b^3*c*d - (a^4 - 2*a^2*b^2)*d^2)*cos(f*x + e))*sqrt(a^2 - b^2)*log((2*a*b 
*cos(f*x + e) - (a^2 - 2*b^2)*cos(f*x + e)^2 - 2*sqrt(a^2 - b^2)*(b*cos(f* 
x + e) + a)*sin(f*x + e) + 2*a^2 - b^2)/(a^2*cos(f*x + e)^2 + 2*a*b*cos(f* 
x + e) + b^2)) - ((a^5 - 2*a^3*b^2 + a*b^4)*d^2*cos(f*x + e) + (a^4*b - 2* 
a^2*b^3 + b^5)*d^2)*log(sin(f*x + e) + 1) + ((a^5 - 2*a^3*b^2 + a*b^4)*d^2 
*cos(f*x + e) + (a^4*b - 2*a^2*b^3 + b^5)*d^2)*log(-sin(f*x + e) + 1) + 2* 
((a^2*b^3 - b^5)*c^2 - 2*(a^3*b^2 - a*b^4)*c*d + (a^4*b - a^2*b^3)*d^2)*si 
n(f*x + e))/((a^5*b^2 - 2*a^3*b^4 + a*b^6)*f*cos(f*x + e) + (a^4*b^3 - 2*a 
^2*b^5 + b^7)*f), 1/2*(2*(a*b^3*c^2 - 2*b^4*c*d - (a^3*b - 2*a*b^3)*d^2 + 
(a^2*b^2*c^2 - 2*a*b^3*c*d - (a^4 - 2*a^2*b^2)*d^2)*cos(f*x + e))*sqrt(-a^ 
2 + b^2)*arctan(-sqrt(-a^2 + b^2)*(b*cos(f*x + e) + a)/((a^2 - b^2)*sin(f* 
x + e))) + ((a^5 - 2*a^3*b^2 + a*b^4)*d^2*cos(f*x + e) + (a^4*b - 2*a^2*b^ 
3 + b^5)*d^2)*log(sin(f*x + e) + 1) - ((a^5 - 2*a^3*b^2 + a*b^4)*d^2*cos(f 
*x + e) + (a^4*b - 2*a^2*b^3 + b^5)*d^2)*log(-sin(f*x + e) + 1) - 2*((a^2* 
b^3 - b^5)*c^2 - 2*(a^3*b^2 - a*b^4)*c*d + (a^4*b - a^2*b^3)*d^2)*sin(f*x 
+ e))/((a^5*b^2 - 2*a^3*b^4 + a*b^6)*f*cos(f*x + e) + (a^4*b^3 - 2*a^2*b^5 
 + b^7)*f)]
 

Sympy [F]

\[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^2}{(a+b \sec (e+f x))^2} \, dx=\int \frac {\left (c + d \sec {\left (e + f x \right )}\right )^{2} \sec {\left (e + f x \right )}}{\left (a + b \sec {\left (e + f x \right )}\right )^{2}}\, dx \] Input:

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

Output:

Integral((c + d*sec(e + f*x))**2*sec(e + f*x)/(a + b*sec(e + f*x))**2, x)
 

Maxima [F(-2)]

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

integrate(sec(f*x+e)*(c+d*sec(f*x+e))^2/(a+b*sec(f*x+e))^2,x, algorithm="m 
axima")
 

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 267, normalized size of antiderivative = 1.35 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^2}{(a+b \sec (e+f x))^2} \, dx=\frac {\frac {d^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{b^{2}} - \frac {d^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{b^{2}} - \frac {2 \, {\left (a b^{2} c^{2} - 2 \, b^{3} c d - a^{3} d^{2} + 2 \, a b^{2} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{2} b^{2} - b^{4}\right )} \sqrt {-a^{2} + b^{2}}} + \frac {2 \, {\left (b^{2} c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 2 \, a b c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{{\left (a^{2} b - b^{3}\right )} {\left (a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - a - b\right )}}}{f} \] Input:

integrate(sec(f*x+e)*(c+d*sec(f*x+e))^2/(a+b*sec(f*x+e))^2,x, algorithm="g 
iac")
 

Output:

(d^2*log(abs(tan(1/2*f*x + 1/2*e) + 1))/b^2 - d^2*log(abs(tan(1/2*f*x + 1/ 
2*e) - 1))/b^2 - 2*(a*b^2*c^2 - 2*b^3*c*d - a^3*d^2 + 2*a*b^2*d^2)*(pi*flo 
or(1/2*(f*x + e)/pi + 1/2)*sgn(2*a - 2*b) + arctan((a*tan(1/2*f*x + 1/2*e) 
 - b*tan(1/2*f*x + 1/2*e))/sqrt(-a^2 + b^2)))/((a^2*b^2 - b^4)*sqrt(-a^2 + 
 b^2)) + 2*(b^2*c^2*tan(1/2*f*x + 1/2*e) - 2*a*b*c*d*tan(1/2*f*x + 1/2*e) 
+ a^2*d^2*tan(1/2*f*x + 1/2*e))/((a^2*b - b^3)*(a*tan(1/2*f*x + 1/2*e)^2 - 
 b*tan(1/2*f*x + 1/2*e)^2 - a - b)))/f
 

Mupad [B] (verification not implemented)

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

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

Output:

- (d^2*atan(((d^2*((32*tan(e/2 + (f*x)/2)*(2*a^6*d^4 + b^6*d^4 - 2*a*b^5*d 
^4 - 2*a^5*b*d^4 + a^2*b^4*c^4 + 3*a^2*b^4*d^4 + 4*a^3*b^3*d^4 - 5*a^4*b^2 
*d^4 + 4*b^6*c^2*d^2 + 4*a^3*b^3*c*d^3 + 4*a^2*b^4*c^2*d^2 - 2*a^4*b^2*c^2 
*d^2 - 8*a*b^5*c*d^3 - 4*a*b^5*c^3*d))/(a*b^4 + b^5 - a^2*b^3 - a^3*b^2) + 
 (d^2*((32*(a*b^8*c^2 - b^9*d^2 + 2*a*b^8*d^2 - a^2*b^7*c^2 - a^3*b^6*c^2 
+ a^4*b^5*c^2 + a^2*b^7*d^2 - 3*a^3*b^6*d^2 + a^5*b^4*d^2 - 2*b^9*c*d + 2* 
a*b^8*c*d + 2*a^2*b^7*c*d - 2*a^3*b^6*c*d))/(a*b^5 + b^6 - a^2*b^4 - a^3*b 
^3) + (32*d^2*tan(e/2 + (f*x)/2)*(2*a*b^9 - 2*a^2*b^8 - 4*a^3*b^7 + 4*a^4* 
b^6 + 2*a^5*b^5 - 2*a^6*b^4))/(b^2*(a*b^4 + b^5 - a^2*b^3 - a^3*b^2))))/b^ 
2)*1i)/b^2 + (d^2*((32*tan(e/2 + (f*x)/2)*(2*a^6*d^4 + b^6*d^4 - 2*a*b^5*d 
^4 - 2*a^5*b*d^4 + a^2*b^4*c^4 + 3*a^2*b^4*d^4 + 4*a^3*b^3*d^4 - 5*a^4*b^2 
*d^4 + 4*b^6*c^2*d^2 + 4*a^3*b^3*c*d^3 + 4*a^2*b^4*c^2*d^2 - 2*a^4*b^2*c^2 
*d^2 - 8*a*b^5*c*d^3 - 4*a*b^5*c^3*d))/(a*b^4 + b^5 - a^2*b^3 - a^3*b^2) - 
 (d^2*((32*(a*b^8*c^2 - b^9*d^2 + 2*a*b^8*d^2 - a^2*b^7*c^2 - a^3*b^6*c^2 
+ a^4*b^5*c^2 + a^2*b^7*d^2 - 3*a^3*b^6*d^2 + a^5*b^4*d^2 - 2*b^9*c*d + 2* 
a*b^8*c*d + 2*a^2*b^7*c*d - 2*a^3*b^6*c*d))/(a*b^5 + b^6 - a^2*b^4 - a^3*b 
^3) - (32*d^2*tan(e/2 + (f*x)/2)*(2*a*b^9 - 2*a^2*b^8 - 4*a^3*b^7 + 4*a^4* 
b^6 + 2*a^5*b^5 - 2*a^6*b^4))/(b^2*(a*b^4 + b^5 - a^2*b^3 - a^3*b^2))))/b^ 
2)*1i)/b^2)/((64*(a^5*d^6 + 2*a*b^4*d^6 - a^4*b*d^6 - 2*b^5*c*d^5 + 2*a^2* 
b^3*d^6 - 3*a^3*b^2*d^6 + 4*b^5*c^2*d^4 + a*b^4*c^2*d^4 - 4*a*b^4*c^3*d...
 

Reduce [B] (verification not implemented)

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

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

Output:

( - 2*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/ 
sqrt( - a**2 + b**2))*cos(e + f*x)*a**4*d**2 + 2*sqrt( - a**2 + b**2)*atan 
((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*cos(e + f 
*x)*a**2*b**2*c**2 + 4*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan 
((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*cos(e + f*x)*a**2*b**2*d**2 - 4*sqr 
t( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a 
**2 + b**2))*cos(e + f*x)*a*b**3*c*d - 2*sqrt( - a**2 + b**2)*atan((tan((e 
 + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*a**3*b*d**2 + 2*s 
qrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - 
 a**2 + b**2))*a*b**3*c**2 + 4*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2) 
*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*a*b**3*d**2 - 4*sqrt( - a** 
2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b* 
*2))*b**4*c*d - cos(e + f*x)*log(tan((e + f*x)/2) - 1)*a**5*d**2 + 2*cos(e 
 + f*x)*log(tan((e + f*x)/2) - 1)*a**3*b**2*d**2 - cos(e + f*x)*log(tan((e 
 + f*x)/2) - 1)*a*b**4*d**2 + cos(e + f*x)*log(tan((e + f*x)/2) + 1)*a**5* 
d**2 - 2*cos(e + f*x)*log(tan((e + f*x)/2) + 1)*a**3*b**2*d**2 + cos(e + f 
*x)*log(tan((e + f*x)/2) + 1)*a*b**4*d**2 - log(tan((e + f*x)/2) - 1)*a**4 
*b*d**2 + 2*log(tan((e + f*x)/2) - 1)*a**2*b**3*d**2 - log(tan((e + f*x)/2 
) - 1)*b**5*d**2 + log(tan((e + f*x)/2) + 1)*a**4*b*d**2 - 2*log(tan((e + 
f*x)/2) + 1)*a**2*b**3*d**2 + log(tan((e + f*x)/2) + 1)*b**5*d**2 - sin...