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

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

Optimal result

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

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

Mathematica [A] (verified)

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

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

Output:

(a*(1 + Cos[e + f*x])*Sec[(e + f*x)/2]^2*(-2*(2*c - d)*ArcTanh[((-c + d)*T 
an[(e + f*x)/2])/Sqrt[c^2 - d^2]]*(d + c*Cos[e + f*x])^2 + Sqrt[c^2 - d^2] 
*((c - 2*d)*d + (2*c^2 - 2*c*d - d^2)*Cos[e + f*x])*Sin[e + f*x]))/(4*(c - 
 d)*(c + d)^2*Sqrt[c^2 - d^2]*f*(d + c*Cos[e + f*x])^2)
 

Rubi [A] (verified)

Time = 0.74 (sec) , antiderivative size = 149, normalized size of antiderivative = 1.14, number of steps used = 13, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.414, Rules used = {3042, 4491, 25, 3042, 4491, 25, 27, 3042, 4318, 3042, 3138, 221}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4491

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4491

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4318

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3138

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

\(\Big \downarrow \) 221

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

Input:

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

Output:

(a*Tan[e + f*x])/(2*(c + d)*f*(c + d*Sec[e + f*x])^2) + ((2*a*Sqrt[c - d]* 
(2*c - d)*ArcTanh[(Sqrt[c - d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/(Sqrt[c + d 
]*(c^2 - d^2)*f) + (a*(c - 2*d)*Tan[e + f*x])/((c + d)*f*(c + d*Sec[e + f* 
x])))/(2*(c^2 - d^2))
 

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 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

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

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + b + 
(a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] 
 && NeQ[a^2 - b^2, 0]
 

rule 4318
Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbo 
l] :> Simp[1/b   Int[1/(1 + (a/b)*Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, 
f}, x] && NeQ[a^2 - b^2, 0]
 

rule 4491
Int[csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(cs 
c[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-(A*b - a*B))*Cot[e 
 + f*x]*((a + b*Csc[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 - b^2))), x] + Simp[1 
/((m + 1)*(a^2 - b^2))   Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^(m + 1)*Simp 
[(a*A - b*B)*(m + 1) - (A*b - a*B)*(m + 2)*Csc[e + f*x], x], x], x] /; Free 
Q[{a, b, A, B, e, f}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && LtQ[m 
, -1]
 
Maple [A] (verified)

Time = 0.36 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.36

method result size
derivativedivides \(\frac {4 a \left (\frac {-\frac {\left (2 c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{4 \left (c^{2}+2 c d +d^{2}\right )}+\frac {\left (2 c -3 d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{4 \left (c -d \right ) \left (c +d \right )}}{\left (c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )^{2}}+\frac {\left (2 c -d \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c -d \right ) \left (c +d \right )}}\right )}{4 \left (c^{3}+c^{2} d -c \,d^{2}-d^{3}\right ) \sqrt {\left (c -d \right ) \left (c +d \right )}}\right )}{f}\) \(178\)
default \(\frac {4 a \left (\frac {-\frac {\left (2 c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{4 \left (c^{2}+2 c d +d^{2}\right )}+\frac {\left (2 c -3 d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{4 \left (c -d \right ) \left (c +d \right )}}{\left (c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )^{2}}+\frac {\left (2 c -d \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c -d \right ) \left (c +d \right )}}\right )}{4 \left (c^{3}+c^{2} d -c \,d^{2}-d^{3}\right ) \sqrt {\left (c -d \right ) \left (c +d \right )}}\right )}{f}\) \(178\)
risch \(\frac {i a \left (-3 c^{3} d \,{\mathrm e}^{3 i \left (f x +e \right )}+2 c^{2} d^{2} {\mathrm e}^{3 i \left (f x +e \right )}+2 c \,d^{3} {\mathrm e}^{3 i \left (f x +e \right )}-2 c^{4} {\mathrm e}^{2 i \left (f x +e \right )}+2 c^{3} d \,{\mathrm e}^{2 i \left (f x +e \right )}-3 c^{2} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+4 c \,d^{3} {\mathrm e}^{2 i \left (f x +e \right )}+2 d^{4} {\mathrm e}^{2 i \left (f x +e \right )}-5 c^{3} d \,{\mathrm e}^{i \left (f x +e \right )}+6 c^{2} d^{2} {\mathrm e}^{i \left (f x +e \right )}+2 c \,d^{3} {\mathrm e}^{i \left (f x +e \right )}-2 c^{4}+2 c^{3} d +c^{2} d^{2}\right )}{c^{2} \left (-c^{2}+d^{2}\right ) f \left (c \,{\mathrm e}^{2 i \left (f x +e \right )}+2 d \,{\mathrm e}^{i \left (f x +e \right )}+c \right )^{2} \left (c +d \right )}+\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) c}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right )^{2} \left (c -d \right ) f}-\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) d}{2 \sqrt {c^{2}-d^{2}}\, \left (c +d \right )^{2} \left (c -d \right ) f}-\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) c}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right )^{2} \left (c -d \right ) f}+\frac {a \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) d}{2 \sqrt {c^{2}-d^{2}}\, \left (c +d \right )^{2} \left (c -d \right ) f}\) \(574\)

Input:

int(sec(f*x+e)*(a+a*sec(f*x+e))/(c+d*sec(f*x+e))^3,x,method=_RETURNVERBOSE 
)
 

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 339 vs. \(2 (118) = 236\).

Time = 0.17 (sec) , antiderivative size = 736, normalized size of antiderivative = 5.62 \[ \int \frac {\sec (e+f x) (a+a \sec (e+f x))}{(c+d \sec (e+f x))^3} \, dx =\text {Too large to display} \] Input:

integrate(sec(f*x+e)*(a+a*sec(f*x+e))/(c+d*sec(f*x+e))^3,x, algorithm="fri 
cas")
 

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

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

integrate(sec(f*x+e)*(a+a*sec(f*x+e))/(c+d*sec(f*x+e))^3,x, algorithm="max 
ima")
 

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*c^2-4*d^2>0)', see `assume?` f 
or more de
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 263 vs. \(2 (118) = 236\).

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

integrate(sec(f*x+e)*(a+a*sec(f*x+e))/(c+d*sec(f*x+e))^3,x, algorithm="gia 
c")
 

Output:

((pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(-2*c + 2*d) + arctan(-(c*tan(1/2*f* 
x + 1/2*e) - d*tan(1/2*f*x + 1/2*e))/sqrt(-c^2 + d^2)))*(2*a*c - a*d)/((c^ 
3 + c^2*d - c*d^2 - d^3)*sqrt(-c^2 + d^2)) - (2*a*c^2*tan(1/2*f*x + 1/2*e) 
^3 - 3*a*c*d*tan(1/2*f*x + 1/2*e)^3 + a*d^2*tan(1/2*f*x + 1/2*e)^3 - 2*a*c 
^2*tan(1/2*f*x + 1/2*e) + a*c*d*tan(1/2*f*x + 1/2*e) + 3*a*d^2*tan(1/2*f*x 
 + 1/2*e))/((c^3 + c^2*d - c*d^2 - d^3)*(c*tan(1/2*f*x + 1/2*e)^2 - d*tan( 
1/2*f*x + 1/2*e)^2 - c - d)^2))/f
 

Mupad [B] (verification not implemented)

Time = 12.41 (sec) , antiderivative size = 171, normalized size of antiderivative = 1.31 \[ \int \frac {\sec (e+f x) (a+a \sec (e+f x))}{(c+d \sec (e+f x))^3} \, dx=\frac {a\,\mathrm {atanh}\left (\frac {\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c-d}}{\sqrt {c+d}}\right )\,\left (2\,c-d\right )}{f\,{\left (c+d\right )}^{5/2}\,{\left (c-d\right )}^{3/2}}-\frac {\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3\,\left (2\,a\,c-a\,d\right )}{{\left (c+d\right )}^2}-\frac {a\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (2\,c-3\,d\right )}{\left (c+d\right )\,\left (c-d\right )}}{f\,\left (2\,c\,d-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (2\,c^2-2\,d^2\right )+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (c^2-2\,c\,d+d^2\right )+c^2+d^2\right )} \] Input:

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

Output:

(a*atanh((tan(e/2 + (f*x)/2)*(c - d)^(1/2))/(c + d)^(1/2))*(2*c - d))/(f*( 
c + d)^(5/2)*(c - d)^(3/2)) - ((tan(e/2 + (f*x)/2)^3*(2*a*c - a*d))/(c + d 
)^2 - (a*tan(e/2 + (f*x)/2)*(2*c - 3*d))/((c + d)*(c - d)))/(f*(2*c*d - ta 
n(e/2 + (f*x)/2)^2*(2*c^2 - 2*d^2) + tan(e/2 + (f*x)/2)^4*(c^2 - 2*c*d + d 
^2) + c^2 + d^2))
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 823, normalized size of antiderivative = 6.28 \[ \int \frac {\sec (e+f x) (a+a \sec (e+f x))}{(c+d \sec (e+f x))^3} \, dx =\text {Too large to display} \] Input:

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

Output:

(a*(8*sqrt( - c**2 + d**2)*atan((tan((e + f*x)/2)*c - tan((e + f*x)/2)*d)/ 
sqrt( - c**2 + d**2))*cos(e + f*x)*c**2*d - 4*sqrt( - c**2 + d**2)*atan((t 
an((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*cos(e + f*x) 
*c*d**2 - 4*sqrt( - c**2 + d**2)*atan((tan((e + f*x)/2)*c - tan((e + f*x)/ 
2)*d)/sqrt( - c**2 + d**2))*sin(e + f*x)**2*c**3 + 2*sqrt( - c**2 + d**2)* 
atan((tan((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*sin(e 
 + f*x)**2*c**2*d + 4*sqrt( - c**2 + d**2)*atan((tan((e + f*x)/2)*c - tan( 
(e + f*x)/2)*d)/sqrt( - c**2 + d**2))*c**3 - 2*sqrt( - c**2 + d**2)*atan(( 
tan((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*c**2*d + 4* 
sqrt( - c**2 + d**2)*atan((tan((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( 
- c**2 + d**2))*c*d**2 - 2*sqrt( - c**2 + d**2)*atan((tan((e + f*x)/2)*c - 
 tan((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*d**3 + 2*cos(e + f*x)*sin(e + f 
*x)*c**4 - 2*cos(e + f*x)*sin(e + f*x)*c**3*d - 3*cos(e + f*x)*sin(e + f*x 
)*c**2*d**2 + 2*cos(e + f*x)*sin(e + f*x)*c*d**3 + cos(e + f*x)*sin(e + f* 
x)*d**4 + sin(e + f*x)*c**3*d - 2*sin(e + f*x)*c**2*d**2 - sin(e + f*x)*c* 
d**3 + 2*sin(e + f*x)*d**4))/(2*f*(2*cos(e + f*x)*c**6*d + 2*cos(e + f*x)* 
c**5*d**2 - 4*cos(e + f*x)*c**4*d**3 - 4*cos(e + f*x)*c**3*d**4 + 2*cos(e 
+ f*x)*c**2*d**5 + 2*cos(e + f*x)*c*d**6 - sin(e + f*x)**2*c**7 - sin(e + 
f*x)**2*c**6*d + 2*sin(e + f*x)**2*c**5*d**2 + 2*sin(e + f*x)**2*c**4*d**3 
 - sin(e + f*x)**2*c**3*d**4 - sin(e + f*x)**2*c**2*d**5 + c**7 + c**6*...