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

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

Optimal result

Integrand size = 24, antiderivative size = 221 \[ \int (e x)^{-1+2 n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {a^2 (e x)^{2 n}}{2 e n}-\frac {4 i a b x^{-n} (e x)^{2 n} \arctan \left (e^{i \left (c+d x^n\right )}\right )}{d e n}+\frac {b^2 x^{-2 n} (e x)^{2 n} \log \left (\cos \left (c+d x^n\right )\right )}{d^2 e n}+\frac {2 i a b x^{-2 n} (e x)^{2 n} \operatorname {PolyLog}\left (2,-i e^{i \left (c+d x^n\right )}\right )}{d^2 e n}-\frac {2 i a b x^{-2 n} (e x)^{2 n} \operatorname {PolyLog}\left (2,i e^{i \left (c+d x^n\right )}\right )}{d^2 e n}+\frac {b^2 x^{-n} (e x)^{2 n} \tan \left (c+d x^n\right )}{d e n} \] Output:

1/2*a^2*(e*x)^(2*n)/e/n-4*I*a*b*(e*x)^(2*n)*arctan(exp(I*(c+d*x^n)))/d/e/n 
/(x^n)+b^2*(e*x)^(2*n)*ln(cos(c+d*x^n))/d^2/e/n/(x^(2*n))+2*I*a*b*(e*x)^(2 
*n)*polylog(2,-I*exp(I*(c+d*x^n)))/d^2/e/n/(x^(2*n))-2*I*a*b*(e*x)^(2*n)*p 
olylog(2,I*exp(I*(c+d*x^n)))/d^2/e/n/(x^(2*n))+b^2*(e*x)^(2*n)*tan(c+d*x^n 
)/d/e/n/(x^n)
 

Mathematica [A] (warning: unable to verify)

Time = 4.05 (sec) , antiderivative size = 347, normalized size of antiderivative = 1.57 \[ \int (e x)^{-1+2 n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {x^{-2 n} (e x)^{2 n} \left (8 a b \arctan (\cot (c)) \text {arctanh}\left (\sin (c)+\cos (c) \tan \left (\frac {d x^n}{2}\right )\right )-\frac {4 a b \csc (c) \left (\left (d x^n-\arctan (\cot (c))\right ) \left (\log \left (1-e^{i \left (d x^n-\arctan (\cot (c))\right )}\right )-\log \left (1+e^{i \left (d x^n-\arctan (\cot (c))\right )}\right )\right )+i \operatorname {PolyLog}\left (2,-e^{i \left (d x^n-\arctan (\cot (c))\right )}\right )-i \operatorname {PolyLog}\left (2,e^{i \left (d x^n-\arctan (\cot (c))\right )}\right )\right )}{\sqrt {\csc ^2(c)}}+\frac {2 b^2 d x^n \sin \left (\frac {d x^n}{2}\right )}{\left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} \left (c+d x^n\right )\right )-\sin \left (\frac {1}{2} \left (c+d x^n\right )\right )\right )}+\frac {2 b^2 d x^n \sin \left (\frac {d x^n}{2}\right )}{\left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} \left (c+d x^n\right )\right )+\sin \left (\frac {1}{2} \left (c+d x^n\right )\right )\right )}-2 b^2 d x^n \tan (c)+d x^n \left (a^2 d x^n+2 b^2 \tan (c)\right )+2 b^2 \left (\log \left (\cos \left (c+d x^n\right )\right )+d x^n \tan (c)\right )\right )}{2 d^2 e n} \] Input:

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

Output:

((e*x)^(2*n)*(8*a*b*ArcTan[Cot[c]]*ArcTanh[Sin[c] + Cos[c]*Tan[(d*x^n)/2]] 
 - (4*a*b*Csc[c]*((d*x^n - ArcTan[Cot[c]])*(Log[1 - E^(I*(d*x^n - ArcTan[C 
ot[c]]))] - Log[1 + E^(I*(d*x^n - ArcTan[Cot[c]]))]) + I*PolyLog[2, -E^(I* 
(d*x^n - ArcTan[Cot[c]]))] - I*PolyLog[2, E^(I*(d*x^n - ArcTan[Cot[c]]))]) 
)/Sqrt[Csc[c]^2] + (2*b^2*d*x^n*Sin[(d*x^n)/2])/((Cos[c/2] - Sin[c/2])*(Co 
s[(c + d*x^n)/2] - Sin[(c + d*x^n)/2])) + (2*b^2*d*x^n*Sin[(d*x^n)/2])/((C 
os[c/2] + Sin[c/2])*(Cos[(c + d*x^n)/2] + Sin[(c + d*x^n)/2])) - 2*b^2*d*x 
^n*Tan[c] + d*x^n*(a^2*d*x^n + 2*b^2*Tan[c]) + 2*b^2*(Log[Cos[c + d*x^n]] 
+ d*x^n*Tan[c])))/(2*d^2*e*n*x^(2*n))
 

Rubi [A] (verified)

Time = 0.47 (sec) , antiderivative size = 148, normalized size of antiderivative = 0.67, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.208, Rules used = {4696, 4692, 3042, 4678, 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 (e x)^{2 n-1} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx\)

\(\Big \downarrow \) 4696

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

\(\Big \downarrow \) 4692

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4678

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {x^{-2 n} (e x)^{2 n} \left (\frac {1}{2} a^2 x^{2 n}-\frac {4 i a b x^n \arctan \left (e^{i \left (c+d x^n\right )}\right )}{d}+\frac {2 i a b \operatorname {PolyLog}\left (2,-i e^{i \left (d x^n+c\right )}\right )}{d^2}-\frac {2 i a b \operatorname {PolyLog}\left (2,i e^{i \left (d x^n+c\right )}\right )}{d^2}+\frac {b^2 \log \left (\cos \left (c+d x^n\right )\right )}{d^2}+\frac {b^2 x^n \tan \left (c+d x^n\right )}{d}\right )}{e n}\)

Input:

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

Output:

((e*x)^(2*n)*((a^2*x^(2*n))/2 - ((4*I)*a*b*x^n*ArcTan[E^(I*(c + d*x^n))])/ 
d + (b^2*Log[Cos[c + d*x^n]])/d^2 + ((2*I)*a*b*PolyLog[2, (-I)*E^(I*(c + d 
*x^n))])/d^2 - ((2*I)*a*b*PolyLog[2, I*E^(I*(c + d*x^n))])/d^2 + (b^2*x^n* 
Tan[c + d*x^n])/d))/(e*n*x^(2*n))
 

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 4678
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(n_.)*((c_.) + (d_.)*(x_))^(m_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, (a + b*Csc[e + f*x])^n, x], 
 x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]
 

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 4.

Time = 3.18 (sec) , antiderivative size = 1116, normalized size of antiderivative = 5.05

method result size
risch \(\text {Expression too large to display}\) \(1116\)

Input:

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

Output:

1/2*a^2/n*x*exp(1/2*(-1+2*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*l 
n(x)+2*ln(e)))+2*I*x*b^2*exp(1/2*(-1+2*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)))/d/n/(x^n)/(1+exp(2*I*(c+d*x^n)))+2*I*b/d/n*(e^ 
n)^2/e*a*ln(1+exp(I*x^n*d)*(-exp(2*I*c))^(1/2))*(-1)^(-1/2*csgn(I*e)*csgn( 
I*e*x)^2)*(-1)^(-1/2*csgn(I*x)*csgn(I*e*x)^2)*(-1)^(1/2*csgn(I*e)*csgn(I*x 
)*csgn(I*e*x))*(-exp(2*I*c))^(1/2)*x^n*exp(-1/2*I*(2*Pi*n*csgn(I*e*x)^3-2* 
Pi*n*csgn(I*e)*csgn(I*e*x)^2-2*Pi*n*csgn(I*x)*csgn(I*e*x)^2+2*Pi*n*csgn(I* 
e)*csgn(I*x)*csgn(I*e*x)-Pi*csgn(I*e*x)^3+2*c))-2*I*b/d/n*(e^n)^2/e*a*ln(1 
-exp(I*x^n*d)*(-exp(2*I*c))^(1/2))*(-1)^(-1/2*csgn(I*e)*csgn(I*e*x)^2)*(-1 
)^(-1/2*csgn(I*x)*csgn(I*e*x)^2)*(-1)^(1/2*csgn(I*e)*csgn(I*x)*csgn(I*e*x) 
)*(-exp(2*I*c))^(1/2)*x^n*exp(-1/2*I*(2*Pi*n*csgn(I*e*x)^3-2*Pi*n*csgn(I*e 
)*csgn(I*e*x)^2-2*Pi*n*csgn(I*x)*csgn(I*e*x)^2+2*Pi*n*csgn(I*e)*csgn(I*x)* 
csgn(I*e*x)-Pi*csgn(I*e*x)^3+2*c))+2*b/d^2/n*(e^n)^2/e*a*dilog(1+exp(I*x^n 
*d)*(-exp(2*I*c))^(1/2))*(-1)^(-1/2*csgn(I*e)*csgn(I*e*x)^2)*(-1)^(-1/2*cs 
gn(I*x)*csgn(I*e*x)^2)*(-1)^(1/2*csgn(I*e)*csgn(I*x)*csgn(I*e*x))*(-exp(2* 
I*c))^(1/2)*exp(-1/2*I*(2*Pi*n*csgn(I*e*x)^3-2*Pi*n*csgn(I*e)*csgn(I*e*x)^ 
2-2*Pi*n*csgn(I*x)*csgn(I*e*x)^2+2*Pi*n*csgn(I*e)*csgn(I*x)*csgn(I*e*x)-Pi 
*csgn(I*e*x)^3+2*c))-2*b/d^2/n*(e^n)^2/e*a*dilog(1-exp(I*x^n*d)*(-exp(2...
 

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 656 vs. \(2 (207) = 414\).

Time = 0.12 (sec) , antiderivative size = 656, normalized size of antiderivative = 2.97 \[ \int (e x)^{-1+2 n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx =\text {Too large to display} \] Input:

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [F]

\[ \int (e x)^{-1+2 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 )^{2 \, n - 1} \,d x } \] Input:

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

Output:

1/2*(e*x)^(2*n)*a^2/(e*n) + (2*b^2*e^(2*n)*x^n*sin(2*d*x^n + 2*c) + (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)*integrate(2*(2*a*b*d*e^(2*n)*x^(2*n)*cos(2*d*x^n + 2*c)*cos 
(d*x^n + c) + 2*a*b*d*e^(2*n)*x^(2*n)*cos(d*x^n + c) + (2*a*b*d*e^(2*n)*x^ 
(2*n)*sin(d*x^n + c) - b^2*e^(2*n)*x^n)*sin(2*d*x^n + 2*c))/(d*e*x*cos(2*d 
*x^n + 2*c)^2 + d*e*x*sin(2*d*x^n + 2*c)^2 + 2*d*e*x*cos(2*d*x^n + 2*c) + 
d*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+2 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 )^{2 \, n - 1} \,d x } \] Input:

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

\[ \int (e x)^{-1+2 n} \left (a+b \sec \left (c+d x^n\right )\right )^2 \, dx=\frac {e^{2 n} \left (x^{2 n} \cos \left (x^{n} d +c \right ) a^{2} d^{2}+3 x^{2 n} \cos \left (x^{n} d +c \right ) a b \,d^{2}-8 \cos \left (x^{n} d +c \right ) \left (\int \frac {x^{2 n} \tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )^{4}}{\tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )^{4} x -2 \tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )^{2} x +x}d x \right ) a b \,d^{2} n +16 \cos \left (x^{n} d +c \right ) \left (\int \frac {x^{2 n} \tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )^{2}}{\tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )^{4} x -2 \tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )^{2} x +x}d x \right ) a b \,d^{2} n +2 \cos \left (x^{n} d +c \right ) \mathrm {log}\left (\tan \left (\frac {x^{n} d}{2}+\frac {c}{2}\right )^{2}+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 )^{2}+1\right ) b^{2}-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 ) b^{2}-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 ) b^{2}-2 x^{n} \sin \left (x^{n} d +c \right ) a b d +2 x^{n} \sin \left (x^{n} d +c \right ) b^{2} d \right )}{2 \cos \left (x^{n} d +c \right ) d^{2} e n} \] Input:

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

Output:

(e**(2*n)*(x**(2*n)*cos(x**n*d + c)*a**2*d**2 + 3*x**(2*n)*cos(x**n*d + c) 
*a*b*d**2 - 8*cos(x**n*d + c)*int((x**(2*n)*tan((x**n*d + c)/2)**4)/(tan(( 
x**n*d + c)/2)**4*x - 2*tan((x**n*d + c)/2)**2*x + x),x)*a*b*d**2*n + 16*c 
os(x**n*d + c)*int((x**(2*n)*tan((x**n*d + c)/2)**2)/(tan((x**n*d + c)/2)* 
*4*x - 2*tan((x**n*d + c)/2)**2*x + x),x)*a*b*d**2*n + 2*cos(x**n*d + c)*l 
og(tan((x**n*d + c)/2)**2 + 1)*a*b - 2*cos(x**n*d + c)*log(tan((x**n*d + c 
)/2)**2 + 1)*b**2 - 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)*b**2 - 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)*b**2 - 2*x**n*sin(x**n*d + c)*a*b*d + 2*x**n*sin(x**n*d + c)*b**2*d)) 
/(2*cos(x**n*d + c)*d**2*e*n)