\(\int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx\) [169]

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

Optimal result

Integrand size = 32, antiderivative size = 86 \[ \int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\frac {a^2 c \text {arctanh}(\sin (e+f x))}{8 f}+\frac {a^2 c \sec (e+f x) \tan (e+f x)}{8 f}-\frac {a^2 c \sec ^3(e+f x) \tan (e+f x)}{4 f}-\frac {a^2 c \tan ^3(e+f x)}{3 f} \] Output:

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

Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 57, normalized size of antiderivative = 0.66 \[ \int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\frac {a^2 c \left (3 \text {arctanh}(\sin (e+f x))+\tan (e+f x) \left (3 \sec (e+f x)-6 \sec ^3(e+f x)-8 \tan ^2(e+f x)\right )\right )}{24 f} \] Input:

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

Output:

(a^2*c*(3*ArcTanh[Sin[e + f*x]] + Tan[e + f*x]*(3*Sec[e + f*x] - 6*Sec[e + 
 f*x]^3 - 8*Tan[e + f*x]^2)))/(24*f)
 

Rubi [A] (verified)

Time = 0.36 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.91, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.094, Rules used = {3042, 4450, 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 \sec ^2(e+f x) (a \sec (e+f x)+a)^2 (c-c \sec (e+f x)) \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4450

\(\displaystyle -a c \int \left (a \tan ^2(e+f x) \sec ^3(e+f x)+a \tan ^2(e+f x) \sec ^2(e+f x)\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle -a c \left (-\frac {a \text {arctanh}(\sin (e+f x))}{8 f}+\frac {a \tan ^3(e+f x)}{3 f}+\frac {a \tan (e+f x) \sec ^3(e+f x)}{4 f}-\frac {a \tan (e+f x) \sec (e+f x)}{8 f}\right )\)

Input:

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

Output:

-(a*c*(-1/8*(a*ArcTanh[Sin[e + f*x]])/f - (a*Sec[e + f*x]*Tan[e + f*x])/(8 
*f) + (a*Sec[e + f*x]^3*Tan[e + f*x])/(4*f) + (a*Tan[e + f*x]^3)/(3*f)))
 

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 4450
Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^(m_.)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.), x_Symbol] :> Simp 
[((-a)*c)^m   Int[ExpandTrig[(g*csc[e + f*x])^p*cot[e + f*x]^(2*m), (c + d* 
csc[e + f*x])^(n - m), x], x], x] /; FreeQ[{a, b, c, d, e, f, g, n, p}, x] 
&& EqQ[b*c + a*d, 0] && EqQ[a^2 - b^2, 0] && IntegersQ[m, n] && GeQ[n - m, 
0] && GtQ[m*n, 0]
 
Maple [A] (verified)

Time = 2.79 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.47

method result size
derivativedivides \(\frac {a^{2} c \tan \left (f x +e \right )+a^{2} c \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )+a^{2} c \left (-\frac {2}{3}-\frac {\sec \left (f x +e \right )^{2}}{3}\right ) \tan \left (f x +e \right )-a^{2} c \left (-\left (-\frac {\sec \left (f x +e \right )^{3}}{4}-\frac {3 \sec \left (f x +e \right )}{8}\right ) \tan \left (f x +e \right )+\frac {3 \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{8}\right )}{f}\) \(126\)
default \(\frac {a^{2} c \tan \left (f x +e \right )+a^{2} c \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )+a^{2} c \left (-\frac {2}{3}-\frac {\sec \left (f x +e \right )^{2}}{3}\right ) \tan \left (f x +e \right )-a^{2} c \left (-\left (-\frac {\sec \left (f x +e \right )^{3}}{4}-\frac {3 \sec \left (f x +e \right )}{8}\right ) \tan \left (f x +e \right )+\frac {3 \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{8}\right )}{f}\) \(126\)
parts \(\frac {a^{2} c \tan \left (f x +e \right )}{f}+\frac {a^{2} c \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )}{f}+\frac {a^{2} c \left (-\frac {2}{3}-\frac {\sec \left (f x +e \right )^{2}}{3}\right ) \tan \left (f x +e \right )}{f}-\frac {a^{2} c \left (-\left (-\frac {\sec \left (f x +e \right )^{3}}{4}-\frac {3 \sec \left (f x +e \right )}{8}\right ) \tan \left (f x +e \right )+\frac {3 \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{8}\right )}{f}\) \(134\)
norman \(\frac {-\frac {a^{2} c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{4 f}-\frac {53 a^{2} c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{12 f}+\frac {11 a^{2} c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{12 f}-\frac {a^{2} c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{7}}{4 f}}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )^{4}}-\frac {a^{2} c \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{8 f}+\frac {a^{2} c \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{8 f}\) \(139\)
risch \(-\frac {i a^{2} c \left (3 \,{\mathrm e}^{7 i \left (f x +e \right )}-24 \,{\mathrm e}^{6 i \left (f x +e \right )}-21 \,{\mathrm e}^{5 i \left (f x +e \right )}-24 \,{\mathrm e}^{4 i \left (f x +e \right )}+21 \,{\mathrm e}^{3 i \left (f x +e \right )}-8 \,{\mathrm e}^{2 i \left (f x +e \right )}-3 \,{\mathrm e}^{i \left (f x +e \right )}-8\right )}{12 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}+\frac {a^{2} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{8 f}-\frac {a^{2} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{8 f}\) \(148\)
parallelrisch \(\frac {a^{2} \left (\left (-2 \cos \left (2 f x +2 e \right )-\frac {\cos \left (4 f x +4 e \right )}{2}-\frac {3}{2}\right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )+\left (2 \cos \left (2 f x +2 e \right )+\frac {\cos \left (4 f x +4 e \right )}{2}+\frac {3}{2}\right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )+\sin \left (3 f x +3 e \right )+\frac {4 \sin \left (4 f x +4 e \right )}{3}-7 \sin \left (f x +e \right )-\frac {8 \sin \left (2 f x +2 e \right )}{3}\right ) c}{4 f \left (\cos \left (4 f x +4 e \right )+4 \cos \left (2 f x +2 e \right )+3\right )}\) \(148\)

Input:

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

Output:

1/f*(a^2*c*tan(f*x+e)+a^2*c*(1/2*sec(f*x+e)*tan(f*x+e)+1/2*ln(sec(f*x+e)+t 
an(f*x+e)))+a^2*c*(-2/3-1/3*sec(f*x+e)^2)*tan(f*x+e)-a^2*c*(-(-1/4*sec(f*x 
+e)^3-3/8*sec(f*x+e))*tan(f*x+e)+3/8*ln(sec(f*x+e)+tan(f*x+e))))
 

Fricas [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.36 \[ \int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\frac {3 \, a^{2} c \cos \left (f x + e\right )^{4} \log \left (\sin \left (f x + e\right ) + 1\right ) - 3 \, a^{2} c \cos \left (f x + e\right )^{4} \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \, {\left (8 \, a^{2} c \cos \left (f x + e\right )^{3} + 3 \, a^{2} c \cos \left (f x + e\right )^{2} - 8 \, a^{2} c \cos \left (f x + e\right ) - 6 \, a^{2} c\right )} \sin \left (f x + e\right )}{48 \, f \cos \left (f x + e\right )^{4}} \] Input:

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

Output:

1/48*(3*a^2*c*cos(f*x + e)^4*log(sin(f*x + e) + 1) - 3*a^2*c*cos(f*x + e)^ 
4*log(-sin(f*x + e) + 1) + 2*(8*a^2*c*cos(f*x + e)^3 + 3*a^2*c*cos(f*x + e 
)^2 - 8*a^2*c*cos(f*x + e) - 6*a^2*c)*sin(f*x + e))/(f*cos(f*x + e)^4)
 

Sympy [F]

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

integrate(sec(f*x+e)**2*(a+a*sec(f*x+e))**2*(c-c*sec(f*x+e)),x)
 

Output:

-a**2*c*(Integral(-sec(e + f*x)**2, x) + Integral(-sec(e + f*x)**3, x) + I 
ntegral(sec(e + f*x)**4, x) + Integral(sec(e + f*x)**5, x))
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 160 vs. \(2 (78) = 156\).

Time = 0.03 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.86 \[ \int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=-\frac {16 \, {\left (\tan \left (f x + e\right )^{3} + 3 \, \tan \left (f x + e\right )\right )} a^{2} c - 3 \, a^{2} c {\left (\frac {2 \, {\left (3 \, \sin \left (f x + e\right )^{3} - 5 \, \sin \left (f x + e\right )\right )}}{\sin \left (f x + e\right )^{4} - 2 \, \sin \left (f x + e\right )^{2} + 1} - 3 \, \log \left (\sin \left (f x + e\right ) + 1\right ) + 3 \, \log \left (\sin \left (f x + e\right ) - 1\right )\right )} + 12 \, a^{2} c {\left (\frac {2 \, \sin \left (f x + e\right )}{\sin \left (f x + e\right )^{2} - 1} - \log \left (\sin \left (f x + e\right ) + 1\right ) + \log \left (\sin \left (f x + e\right ) - 1\right )\right )} - 48 \, a^{2} c \tan \left (f x + e\right )}{48 \, f} \] Input:

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

Output:

-1/48*(16*(tan(f*x + e)^3 + 3*tan(f*x + e))*a^2*c - 3*a^2*c*(2*(3*sin(f*x 
+ e)^3 - 5*sin(f*x + e))/(sin(f*x + e)^4 - 2*sin(f*x + e)^2 + 1) - 3*log(s 
in(f*x + e) + 1) + 3*log(sin(f*x + e) - 1)) + 12*a^2*c*(2*sin(f*x + e)/(si 
n(f*x + e)^2 - 1) - log(sin(f*x + e) + 1) + log(sin(f*x + e) - 1)) - 48*a^ 
2*c*tan(f*x + e))/f
 

Giac [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.49 \[ \int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\frac {3 \, a^{2} c \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right ) - 3 \, a^{2} c \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right ) - \frac {2 \, {\left (3 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{7} - 11 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 53 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 3 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )}^{4}}}{24 \, f} \] Input:

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

Output:

1/24*(3*a^2*c*log(abs(tan(1/2*f*x + 1/2*e) + 1)) - 3*a^2*c*log(abs(tan(1/2 
*f*x + 1/2*e) - 1)) - 2*(3*a^2*c*tan(1/2*f*x + 1/2*e)^7 - 11*a^2*c*tan(1/2 
*f*x + 1/2*e)^5 + 53*a^2*c*tan(1/2*f*x + 1/2*e)^3 + 3*a^2*c*tan(1/2*f*x + 
1/2*e))/(tan(1/2*f*x + 1/2*e)^2 - 1)^4)/f
 

Mupad [B] (verification not implemented)

Time = 13.69 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.70 \[ \int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\frac {a^2\,c\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )}{4\,f}-\frac {\frac {c\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^7}{4}-\frac {11\,c\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5}{12}+\frac {53\,c\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3}{12}+\frac {c\,a^2\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{4}}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^8-4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+6\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4-4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+1\right )} \] Input:

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

Output:

(a^2*c*atanh(tan(e/2 + (f*x)/2)))/(4*f) - ((a^2*c*tan(e/2 + (f*x)/2))/4 + 
(53*a^2*c*tan(e/2 + (f*x)/2)^3)/12 - (11*a^2*c*tan(e/2 + (f*x)/2)^5)/12 + 
(a^2*c*tan(e/2 + (f*x)/2)^7)/4)/(f*(6*tan(e/2 + (f*x)/2)^4 - 4*tan(e/2 + ( 
f*x)/2)^2 - 4*tan(e/2 + (f*x)/2)^6 + tan(e/2 + (f*x)/2)^8 + 1))
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 182, normalized size of antiderivative = 2.12 \[ \int \sec ^2(e+f x) (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\frac {a^{2} c \left (-8 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{3}-3 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \sin \left (f x +e \right )^{4}+6 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \sin \left (f x +e \right )^{2}-3 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )+3 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) \sin \left (f x +e \right )^{4}-6 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) \sin \left (f x +e \right )^{2}+3 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )-3 \sin \left (f x +e \right )^{3}-3 \sin \left (f x +e \right )\right )}{24 f \left (\sin \left (f x +e \right )^{4}-2 \sin \left (f x +e \right )^{2}+1\right )} \] Input:

int(sec(f*x+e)^2*(a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x)
 

Output:

(a**2*c*( - 8*cos(e + f*x)*sin(e + f*x)**3 - 3*log(tan((e + f*x)/2) - 1)*s 
in(e + f*x)**4 + 6*log(tan((e + f*x)/2) - 1)*sin(e + f*x)**2 - 3*log(tan(( 
e + f*x)/2) - 1) + 3*log(tan((e + f*x)/2) + 1)*sin(e + f*x)**4 - 6*log(tan 
((e + f*x)/2) + 1)*sin(e + f*x)**2 + 3*log(tan((e + f*x)/2) + 1) - 3*sin(e 
 + f*x)**3 - 3*sin(e + f*x)))/(24*f*(sin(e + f*x)**4 - 2*sin(e + f*x)**2 + 
 1))