\(\int (e x)^{-1+n} (a+b \sec (c+d x^n))^2 \, dx\) [75]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [C] (warning: unable to verify)
Fricas [A] (verification not implemented)
Sympy [F]
Maxima [F]
Giac [F]
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 79 \[ \int (e x)^{-1+n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {a^2 (e x)^n}{e n}+\frac {2 a b x^{-n} (e x)^n \text {arctanh}\left (\sin \left (c+d x^n\right )\right )}{d e n}+\frac {b^2 x^{-n} (e x)^n \tan \left (c+d x^n\right )}{d e n} \] Output:

a^2*(e*x)^n/e/n+2*a*b*(e*x)^n*arctanh(sin(c+d*x^n))/d/e/n/(x^n)+b^2*(e*x)^ 
n*tan(c+d*x^n)/d/e/n/(x^n)
 

Mathematica [A] (verified)

Time = 0.34 (sec) , antiderivative size = 54, normalized size of antiderivative = 0.68 \[ \int (e x)^{-1+n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {x^{-n} (e x)^n \left (a^2 d x^n+2 a b \coth ^{-1}\left (\sin \left (c+d x^n\right )\right )+b^2 \tan \left (c+d x^n\right )\right )}{d e n} \] Input:

Integrate[(e*x)^(-1 + n)*(a + b*Sec[c + d*x^n])^2,x]
 

Output:

((e*x)^n*(a^2*d*x^n + 2*a*b*ArcCoth[Sin[c + d*x^n]] + b^2*Tan[c + d*x^n])) 
/(d*e*n*x^n)
 

Rubi [A] (verified)

Time = 0.45 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.71, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.364, Rules used = {4696, 4692, 3042, 4260, 3042, 4254, 24, 4257}

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

\(\Big \downarrow \) 4696

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

\(\Big \downarrow \) 4692

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4260

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4254

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

\(\Big \downarrow \) 24

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

\(\Big \downarrow \) 4257

\(\displaystyle \frac {x^{-n} (e x)^n \left (a^2 x^n+\frac {2 a b \text {arctanh}\left (\sin \left (c+d x^n\right )\right )}{d}+\frac {b^2 \tan \left (c+d x^n\right )}{d}\right )}{e n}\)

Input:

Int[(e*x)^(-1 + n)*(a + b*Sec[c + d*x^n])^2,x]
 

Output:

((e*x)^n*(a^2*x^n + (2*a*b*ArcTanh[Sin[c + d*x^n]])/d + (b^2*Tan[c + d*x^n 
])/d))/(e*n*x^n)
 

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

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

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4260
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Simp[a^2*x, x] + 
 (Simp[2*a*b   Int[Csc[c + d*x], x], x] + Simp[b^2   Int[Csc[c + d*x]^2, x] 
, x]) /; FreeQ[{a, b, c, d}, x]
 

rule 4692
Int[(x_)^(m_.)*((a_.) + (b_.)*Sec[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x_Symbol 
] :> Simp[1/n   Subst[Int[x^(Simplify[(m + 1)/n] - 1)*(a + b*Sec[c + d*x])^ 
p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IGtQ[Simplify[(m + 
 1)/n], 0] && IntegerQ[p]
 

rule 4696
Int[((e_)*(x_))^(m_.)*((a_.) + (b_.)*Sec[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x 
_Symbol] :> Simp[e^IntPart[m]*((e*x)^FracPart[m]/x^FracPart[m])   Int[x^m*( 
a + b*Sec[c + d*x^n])^p, x], x] /; FreeQ[{a, b, c, d, e, m, n, p}, x]
 
Maple [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 4.22 (sec) , antiderivative size = 276, normalized size of antiderivative = 3.49

method result size
risch \(\frac {a^{2} x \,{\mathrm e}^{\frac {\left (-1+n \right ) \left (-i \operatorname {csgn}\left (i e \right ) \operatorname {csgn}\left (i x \right ) \operatorname {csgn}\left (i e x \right ) \pi +i \operatorname {csgn}\left (i e \right ) \operatorname {csgn}\left (i e x \right )^{2} \pi +i \operatorname {csgn}\left (i x \right ) \operatorname {csgn}\left (i e x \right )^{2} \pi -i \operatorname {csgn}\left (i e x \right )^{3} \pi +2 \ln \left (x \right )+2 \ln \left (e \right )\right )}{2}}}{n}+\frac {2 i x \,b^{2} {\mathrm e}^{\frac {\left (-1+n \right ) \left (-i \operatorname {csgn}\left (i e \right ) \operatorname {csgn}\left (i x \right ) \operatorname {csgn}\left (i e x \right ) \pi +i \operatorname {csgn}\left (i e \right ) \operatorname {csgn}\left (i e x \right )^{2} \pi +i \operatorname {csgn}\left (i x \right ) \operatorname {csgn}\left (i e x \right )^{2} \pi -i \operatorname {csgn}\left (i e x \right )^{3} \pi +2 \ln \left (x \right )+2 \ln \left (e \right )\right )}{2}} x^{-n}}{d n \left (1+{\mathrm e}^{2 i \left (c +d \,x^{n}\right )}\right )}-\frac {4 i \arctan \left ({\mathrm e}^{i \left (c +d \,x^{n}\right )}\right ) e^{n} b a \,{\mathrm e}^{\frac {i \pi \,\operatorname {csgn}\left (i e x \right ) \left (-1+n \right ) \left (\operatorname {csgn}\left (i e x \right )-\operatorname {csgn}\left (i x \right )\right ) \left (-\operatorname {csgn}\left (i e x \right )+\operatorname {csgn}\left (i e \right )\right )}{2}}}{d e n}\) \(276\)

Input:

int((e*x)^(-1+n)*(a+b*sec(c+d*x^n))^2,x,method=_RETURNVERBOSE)
 

Output:

a^2/n*x*exp(1/2*(-1+n)*(-I*csgn(I*e)*csgn(I*x)*csgn(I*e*x)*Pi+I*csgn(I*e)* 
csgn(I*e*x)^2*Pi+I*csgn(I*x)*csgn(I*e*x)^2*Pi-I*csgn(I*e*x)^3*Pi+2*ln(x)+2 
*ln(e)))+2*I*x*b^2*exp(1/2*(-1+n)*(-I*csgn(I*e)*csgn(I*x)*csgn(I*e*x)*Pi+I 
*csgn(I*e)*csgn(I*e*x)^2*Pi+I*csgn(I*x)*csgn(I*e*x)^2*Pi-I*csgn(I*e*x)^3*P 
i+2*ln(x)+2*ln(e)))/d/n/(x^n)/(1+exp(2*I*(c+d*x^n)))-4*I*arctan(exp(I*(c+d 
*x^n)))/d/e*e^n/n*b*a*exp(1/2*I*Pi*csgn(I*e*x)*(-1+n)*(csgn(I*e*x)-csgn(I* 
x))*(-csgn(I*e*x)+csgn(I*e)))
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 113, normalized size of antiderivative = 1.43 \[ \int (e x)^{-1+n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {a^{2} d e^{n - 1} x^{n} \cos \left (d x^{n} + c\right ) + a b e^{n - 1} \cos \left (d x^{n} + c\right ) \log \left (\sin \left (d x^{n} + c\right ) + 1\right ) - a b e^{n - 1} \cos \left (d x^{n} + c\right ) \log \left (-\sin \left (d x^{n} + c\right ) + 1\right ) + b^{2} e^{n - 1} \sin \left (d x^{n} + c\right )}{d n \cos \left (d x^{n} + c\right )} \] Input:

integrate((e*x)^(-1+n)*(a+b*sec(c+d*x^n))^2,x, algorithm="fricas")
 

Output:

(a^2*d*e^(n - 1)*x^n*cos(d*x^n + c) + a*b*e^(n - 1)*cos(d*x^n + c)*log(sin 
(d*x^n + c) + 1) - a*b*e^(n - 1)*cos(d*x^n + c)*log(-sin(d*x^n + c) + 1) + 
 b^2*e^(n - 1)*sin(d*x^n + c))/(d*n*cos(d*x^n + c))
 

Sympy [F]

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

integrate((e*x)**(-1+n)*(a+b*sec(c+d*x**n))**2,x)
 

Output:

Integral((e*x)**(n - 1)*(a + b*sec(c + d*x**n))**2, x)
 

Maxima [F]

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

integrate((e*x)^(-1+n)*(a+b*sec(c+d*x^n))^2,x, algorithm="maxima")
 

Output:

(e*x)^n*a^2/(e*n) + 2*(b^2*e^n*sin(2*d*x^n + 2*c) + 2*(a*b*d*e^(n + 1)*n*c 
os(2*d*x^n + 2*c)^2 + a*b*d*e^(n + 1)*n*sin(2*d*x^n + 2*c)^2 + 2*a*b*d*e^( 
n + 1)*n*cos(2*d*x^n + 2*c) + a*b*d*e^(n + 1)*n)*integrate((x^n*cos(2*d*x^ 
n + 2*c)*cos(d*x^n + c) + x^n*sin(2*d*x^n + 2*c)*sin(d*x^n + c) + x^n*cos( 
d*x^n + c))/(e*x*cos(2*d*x^n + 2*c)^2 + e*x*sin(2*d*x^n + 2*c)^2 + 2*e*x*c 
os(2*d*x^n + 2*c) + e*x), x))/(d*e*n*cos(2*d*x^n + 2*c)^2 + d*e*n*sin(2*d* 
x^n + 2*c)^2 + 2*d*e*n*cos(2*d*x^n + 2*c) + d*e*n)
 

Giac [F]

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

integrate((e*x)^(-1+n)*(a+b*sec(c+d*x^n))^2,x, algorithm="giac")
 

Output:

integrate((b*sec(d*x^n + c) + a)^2*(e*x)^(n - 1), x)
 

Mupad [B] (verification not implemented)

Time = 17.27 (sec) , antiderivative size = 180, normalized size of antiderivative = 2.28 \[ \int (e x)^{-1+n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {a^2\,x\,{\left (e\,x\right )}^{n-1}}{n}+\frac {b^2\,x\,{\left (e\,x\right )}^{n-1}\,2{}\mathrm {i}}{d\,n\,x^n\,\left ({\mathrm {e}}^{c\,2{}\mathrm {i}+d\,x^n\,2{}\mathrm {i}}+1\right )}+\frac {2\,a\,b\,x\,\ln \left (-a\,b\,{\left (e\,x\right )}^{n-1}\,4{}\mathrm {i}-4\,a\,b\,{\mathrm {e}}^{c\,1{}\mathrm {i}}\,{\mathrm {e}}^{d\,x^n\,1{}\mathrm {i}}\,{\left (e\,x\right )}^{n-1}\right )\,{\left (e\,x\right )}^{n-1}}{d\,n\,x^n}-\frac {2\,a\,b\,x\,\ln \left (a\,b\,{\left (e\,x\right )}^{n-1}\,4{}\mathrm {i}-4\,a\,b\,{\mathrm {e}}^{c\,1{}\mathrm {i}}\,{\mathrm {e}}^{d\,x^n\,1{}\mathrm {i}}\,{\left (e\,x\right )}^{n-1}\right )\,{\left (e\,x\right )}^{n-1}}{d\,n\,x^n} \] Input:

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

Output:

(a^2*x*(e*x)^(n - 1))/n + (b^2*x*(e*x)^(n - 1)*2i)/(d*n*x^n*(exp(c*2i + d* 
x^n*2i) + 1)) + (2*a*b*x*log(- a*b*(e*x)^(n - 1)*4i - 4*a*b*exp(c*1i)*exp( 
d*x^n*1i)*(e*x)^(n - 1))*(e*x)^(n - 1))/(d*n*x^n) - (2*a*b*x*log(a*b*(e*x) 
^(n - 1)*4i - 4*a*b*exp(c*1i)*exp(d*x^n*1i)*(e*x)^(n - 1))*(e*x)^(n - 1))/ 
(d*n*x^n)
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.32 \[ \int (e x)^{-1+n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {e^{n} \left (x^{n} \cos \left (x^{n} d +c \right ) a^{2} d -2 \cos \left (x^{n} d +c \right ) \mathrm {log}\left (\tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )-1\right ) a b +2 \cos \left (x^{n} d +c \right ) \mathrm {log}\left (\tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )+1\right ) a b +\sin \left (x^{n} d +c \right ) b^{2}\right )}{\cos \left (x^{n} d +c \right ) d e n} \] Input:

int((e*x)^(-1+n)*(a+b*sec(c+d*x^n))^2,x)
 

Output:

(e**n*(x**n*cos(x**n*d + c)*a**2*d - 2*cos(x**n*d + c)*log(tan((x**n*d + c 
)/2) - 1)*a*b + 2*cos(x**n*d + c)*log(tan((x**n*d + c)/2) + 1)*a*b + sin(x 
**n*d + c)*b**2))/(cos(x**n*d + c)*d*e*n)