\(\int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx\) [818]

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

Optimal result

Integrand size = 18, antiderivative size = 225 \[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=x^2 \sqrt {a \sec ^2(x)}+4 i x \arctan \left (e^{i x}\right ) \cos (x) \sqrt {a \sec ^2(x)}-2 x^2 \text {arctanh}\left (e^{i x}\right ) \cos (x) \sqrt {a \sec ^2(x)}+2 i x \cos (x) \operatorname {PolyLog}\left (2,-e^{i x}\right ) \sqrt {a \sec ^2(x)}-2 i \cos (x) \operatorname {PolyLog}\left (2,-i e^{i x}\right ) \sqrt {a \sec ^2(x)}+2 i \cos (x) \operatorname {PolyLog}\left (2,i e^{i x}\right ) \sqrt {a \sec ^2(x)}-2 i x \cos (x) \operatorname {PolyLog}\left (2,e^{i x}\right ) \sqrt {a \sec ^2(x)}-2 \cos (x) \operatorname {PolyLog}\left (3,-e^{i x}\right ) \sqrt {a \sec ^2(x)}+2 \cos (x) \operatorname {PolyLog}\left (3,e^{i x}\right ) \sqrt {a \sec ^2(x)} \] Output:

x^2*(a*sec(x)^2)^(1/2)+4*I*x*arctan(exp(I*x))*cos(x)*(a*sec(x)^2)^(1/2)-2* 
x^2*arctanh(exp(I*x))*cos(x)*(a*sec(x)^2)^(1/2)+2*I*x*cos(x)*polylog(2,-ex 
p(I*x))*(a*sec(x)^2)^(1/2)-2*I*cos(x)*polylog(2,-I*exp(I*x))*(a*sec(x)^2)^ 
(1/2)+2*I*cos(x)*polylog(2,I*exp(I*x))*(a*sec(x)^2)^(1/2)-2*I*x*cos(x)*pol 
ylog(2,exp(I*x))*(a*sec(x)^2)^(1/2)-2*cos(x)*polylog(3,-exp(I*x))*(a*sec(x 
)^2)^(1/2)+2*cos(x)*polylog(3,exp(I*x))*(a*sec(x)^2)^(1/2)
 

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 174, normalized size of antiderivative = 0.77 \[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=\left (x^2+x^2 \cos (x) \left (\log \left (1-e^{i x}\right )-\log \left (1+e^{i x}\right )\right )-2 \cos (x) \left (x \left (\log \left (1-i e^{i x}\right )-\log \left (1+i e^{i x}\right )\right )+i \left (\operatorname {PolyLog}\left (2,-i e^{i x}\right )-\operatorname {PolyLog}\left (2,i e^{i x}\right )\right )\right )+2 i x \cos (x) \left (\operatorname {PolyLog}\left (2,-e^{i x}\right )-\operatorname {PolyLog}\left (2,e^{i x}\right )\right )+2 \cos (x) \left (-\operatorname {PolyLog}\left (3,-e^{i x}\right )+\operatorname {PolyLog}\left (3,e^{i x}\right )\right )\right ) \sqrt {a \sec ^2(x)} \] Input:

Integrate[x^2*Csc[x]*Sec[x]*Sqrt[a*Sec[x]^2],x]
 

Output:

(x^2 + x^2*Cos[x]*(Log[1 - E^(I*x)] - Log[1 + E^(I*x)]) - 2*Cos[x]*(x*(Log 
[1 - I*E^(I*x)] - Log[1 + I*E^(I*x)]) + I*(PolyLog[2, (-I)*E^(I*x)] - Poly 
Log[2, I*E^(I*x)])) + (2*I)*x*Cos[x]*(PolyLog[2, -E^(I*x)] - PolyLog[2, E^ 
(I*x)]) + 2*Cos[x]*(-PolyLog[3, -E^(I*x)] + PolyLog[3, E^(I*x)]))*Sqrt[a*S 
ec[x]^2]
 

Rubi [A] (verified)

Time = 0.76 (sec) , antiderivative size = 153, normalized size of antiderivative = 0.68, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {7271, 4920, 25, 2010, 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 x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx\)

\(\Big \downarrow \) 7271

\(\displaystyle \cos (x) \sqrt {a \sec ^2(x)} \int x^2 \csc (x) \sec ^2(x)dx\)

\(\Big \downarrow \) 4920

\(\displaystyle \cos (x) \sqrt {a \sec ^2(x)} \left (-2 \int -x (\text {arctanh}(\cos (x))-\sec (x))dx+x^2 (-\text {arctanh}(\cos (x)))+x^2 \sec (x)\right )\)

\(\Big \downarrow \) 25

\(\displaystyle \cos (x) \sqrt {a \sec ^2(x)} \left (2 \int x (\text {arctanh}(\cos (x))-\sec (x))dx+x^2 (-\text {arctanh}(\cos (x)))+x^2 \sec (x)\right )\)

\(\Big \downarrow \) 2010

\(\displaystyle \cos (x) \sqrt {a \sec ^2(x)} \left (2 \int (x \text {arctanh}(\cos (x))-x \sec (x))dx+x^2 (-\text {arctanh}(\cos (x)))+x^2 \sec (x)\right )\)

\(\Big \downarrow \) 2009

\(\displaystyle \cos (x) \sqrt {a \sec ^2(x)} \left (2 \left (2 i x \arctan \left (e^{i x}\right )+x^2 \left (-\text {arctanh}\left (e^{i x}\right )\right )+\frac {1}{2} x^2 \text {arctanh}(\cos (x))+i x \operatorname {PolyLog}\left (2,-e^{i x}\right )-i x \operatorname {PolyLog}\left (2,e^{i x}\right )-i \operatorname {PolyLog}\left (2,-i e^{i x}\right )+i \operatorname {PolyLog}\left (2,i e^{i x}\right )-\operatorname {PolyLog}\left (3,-e^{i x}\right )+\operatorname {PolyLog}\left (3,e^{i x}\right )\right )+x^2 (-\text {arctanh}(\cos (x)))+x^2 \sec (x)\right )\)

Input:

Int[x^2*Csc[x]*Sec[x]*Sqrt[a*Sec[x]^2],x]
 

Output:

Cos[x]*Sqrt[a*Sec[x]^2]*(-(x^2*ArcTanh[Cos[x]]) + 2*((2*I)*x*ArcTan[E^(I*x 
)] - x^2*ArcTanh[E^(I*x)] + (x^2*ArcTanh[Cos[x]])/2 + I*x*PolyLog[2, -E^(I 
*x)] - I*PolyLog[2, (-I)*E^(I*x)] + I*PolyLog[2, I*E^(I*x)] - I*x*PolyLog[ 
2, E^(I*x)] - PolyLog[3, -E^(I*x)] + PolyLog[3, E^(I*x)]) + x^2*Sec[x])
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

rule 2010
Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x] 
, x] /; FreeQ[{c, m}, x] && SumQ[u] &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) 
+ (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]
 

rule 4920
Int[Csc[(a_.) + (b_.)*(x_)]^(n_.)*((c_.) + (d_.)*(x_))^(m_.)*Sec[(a_.) + (b 
_.)*(x_)]^(p_.), x_Symbol] :> Module[{u = IntHide[Csc[a + b*x]^n*Sec[a + b* 
x]^p, x]}, Simp[(c + d*x)^m   u, x] - Simp[d*m   Int[(c + d*x)^(m - 1)*u, x 
], x]] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p] && GtQ[m, 0] && NeQ[n, 
p]
 

rule 7271
Int[(u_.)*((a_.)*(v_)^(m_.))^(p_), x_Symbol] :> Simp[a^IntPart[p]*((a*v^m)^ 
FracPart[p]/v^(m*FracPart[p]))   Int[u*v^(m*p), x], x] /; FreeQ[{a, m, p}, 
x] &&  !IntegerQ[p] &&  !FreeQ[v, x] &&  !(EqQ[a, 1] && EqQ[m, 1]) &&  !(Eq 
Q[v, x] && EqQ[m, 1])
 
Maple [A] (verified)

Time = 0.25 (sec) , antiderivative size = 200, normalized size of antiderivative = 0.89

method result size
risch \(2 \sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left (1+{\mathrm e}^{2 i x}\right )^{2}}}\, x^{2}-4 i \sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left (1+{\mathrm e}^{2 i x}\right )^{2}}}\, \left (2 i \left (\frac {x \ln \left (1+i {\mathrm e}^{i x}\right )}{2}-\frac {x \ln \left (1-i {\mathrm e}^{i x}\right )}{2}-\frac {i \operatorname {dilog}\left (1+i {\mathrm e}^{i x}\right )}{2}+\frac {i \operatorname {dilog}\left (1-i {\mathrm e}^{i x}\right )}{2}\right )-\frac {i \left (\frac {i x^{3}}{3}-x^{2} \ln \left (1-{\mathrm e}^{i x}\right )+2 i x \operatorname {polylog}\left (2, {\mathrm e}^{i x}\right )-2 \operatorname {polylog}\left (3, {\mathrm e}^{i x}\right )\right )}{2}-\frac {i \left (-\frac {i x^{3}}{3}+x^{2} \ln \left ({\mathrm e}^{i x}+1\right )-2 i x \operatorname {polylog}\left (2, -{\mathrm e}^{i x}\right )+2 \operatorname {polylog}\left (3, -{\mathrm e}^{i x}\right )\right )}{2}\right ) \cos \left (x \right )\) \(200\)

Input:

int(x^2*csc(x)*sec(x)*(a*sec(x)^2)^(1/2),x,method=_RETURNVERBOSE)
 

Output:

2*(a*exp(2*I*x)/(1+exp(2*I*x))^2)^(1/2)*x^2-4*I*(a*exp(2*I*x)/(1+exp(2*I*x 
))^2)^(1/2)*(2*I*(1/2*x*ln(1+I*exp(I*x))-1/2*x*ln(1-I*exp(I*x))-1/2*I*dilo 
g(1+I*exp(I*x))+1/2*I*dilog(1-I*exp(I*x)))-1/2*I*(1/3*I*x^3-x^2*ln(1-exp(I 
*x))+2*I*x*polylog(2,exp(I*x))-2*polylog(3,exp(I*x)))-1/2*I*(-1/3*I*x^3+x^ 
2*ln(exp(I*x)+1)-2*I*x*polylog(2,-exp(I*x))+2*polylog(3,-exp(I*x))))*cos(x 
)
 

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. 337 vs. \(2 (165) = 330\).

Time = 0.11 (sec) , antiderivative size = 337, normalized size of antiderivative = 1.50 \[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx =\text {Too large to display} \] Input:

integrate(x^2*csc(x)*sec(x)*(a*sec(x)^2)^(1/2),x, algorithm="fricas")
 

Output:

sqrt(a/cos(x)^2)*cos(x)*polylog(3, cos(x) + I*sin(x)) + sqrt(a/cos(x)^2)*c 
os(x)*polylog(3, cos(x) - I*sin(x)) - sqrt(a/cos(x)^2)*cos(x)*polylog(3, - 
cos(x) + I*sin(x)) - sqrt(a/cos(x)^2)*cos(x)*polylog(3, -cos(x) - I*sin(x) 
) - 1/2*(x^2*cos(x)*log(cos(x) + I*sin(x) + 1) + x^2*cos(x)*log(cos(x) - I 
*sin(x) + 1) - x^2*cos(x)*log(-cos(x) + I*sin(x) + 1) - x^2*cos(x)*log(-co 
s(x) - I*sin(x) + 1) + 2*I*x*cos(x)*dilog(cos(x) + I*sin(x)) - 2*I*x*cos(x 
)*dilog(cos(x) - I*sin(x)) + 2*I*x*cos(x)*dilog(-cos(x) + I*sin(x)) - 2*I* 
x*cos(x)*dilog(-cos(x) - I*sin(x)) + 2*x*cos(x)*log(I*cos(x) + sin(x) + 1) 
 - 2*x*cos(x)*log(I*cos(x) - sin(x) + 1) + 2*x*cos(x)*log(-I*cos(x) + sin( 
x) + 1) - 2*x*cos(x)*log(-I*cos(x) - sin(x) + 1) - 2*x^2 - 2*I*cos(x)*dilo 
g(I*cos(x) + sin(x)) - 2*I*cos(x)*dilog(I*cos(x) - sin(x)) + 2*I*cos(x)*di 
log(-I*cos(x) + sin(x)) + 2*I*cos(x)*dilog(-I*cos(x) - sin(x)))*sqrt(a/cos 
(x)^2)
 

Sympy [F]

\[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=\int x^{2} \sqrt {a \sec ^{2}{\left (x \right )}} \csc {\left (x \right )} \sec {\left (x \right )}\, dx \] Input:

integrate(x**2*csc(x)*sec(x)*(a*sec(x)**2)**(1/2),x)
 

Output:

Integral(x**2*sqrt(a*sec(x)**2)*csc(x)*sec(x), x)
 

Maxima [F]

\[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=\int { \sqrt {a \sec \left (x\right )^{2}} x^{2} \csc \left (x\right ) \sec \left (x\right ) \,d x } \] Input:

integrate(x^2*csc(x)*sec(x)*(a*sec(x)^2)^(1/2),x, algorithm="maxima")
 

Output:

-(4*I*x^2*cos(x) - 4*x^2*sin(x) + 2*(x^2*cos(2*x) + I*x^2*sin(2*x) + x^2)* 
arctan2(sin(x), cos(x) + 1) + 2*(x^2*cos(2*x) + I*x^2*sin(2*x) + x^2)*arct 
an2(sin(x), -cos(x) + 1) - 4*(x*cos(2*x) + I*x*sin(2*x) + x)*dilog(-e^(I*x 
)) + 4*(x*cos(2*x) + I*x*sin(2*x) + x)*dilog(e^(I*x)) - 8*(I*cos(2*x) - si 
n(2*x) + I)*integrate((x*cos(2*x)*cos(x) + x*sin(2*x)*sin(x) + x*cos(x))/( 
cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1), x) - 8*(cos(2*x) + I*sin(2*x) + 
 1)*integrate((x*cos(x)*sin(2*x) - x*cos(2*x)*sin(x) - x*sin(x))/(cos(2*x) 
^2 + sin(2*x)^2 + 2*cos(2*x) + 1), x) + (-I*x^2*cos(2*x) + x^2*sin(2*x) - 
I*x^2)*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) + (I*x^2*cos(2*x) - x^2*sin 
(2*x) + I*x^2)*log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) - 4*(I*cos(2*x) - s 
in(2*x) + I)*polylog(3, -e^(I*x)) - 4*(-I*cos(2*x) + sin(2*x) - I)*polylog 
(3, e^(I*x)))*sqrt(a)/(-2*I*cos(2*x) + 2*sin(2*x) - 2*I)
 

Giac [F]

\[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=\int { \sqrt {a \sec \left (x\right )^{2}} x^{2} \csc \left (x\right ) \sec \left (x\right ) \,d x } \] Input:

integrate(x^2*csc(x)*sec(x)*(a*sec(x)^2)^(1/2),x, algorithm="giac")
 

Output:

integrate(sqrt(a*sec(x)^2)*x^2*csc(x)*sec(x), x)
 

Mupad [F(-1)]

Timed out. \[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=\int \frac {x^2\,\sqrt {\frac {a}{{\cos \left (x\right )}^2}}}{\cos \left (x\right )\,\sin \left (x\right )} \,d x \] Input:

int((x^2*(a/cos(x)^2)^(1/2))/(cos(x)*sin(x)),x)
 

Output:

int((x^2*(a/cos(x)^2)^(1/2))/(cos(x)*sin(x)), x)
 

Reduce [F]

\[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=\sqrt {a}\, \left (\int \csc \left (x \right ) \sec \left (x \right )^{2} x^{2}d x \right ) \] Input:

int(x^2*csc(x)*sec(x)*(a*sec(x)^2)^(1/2),x)
 

Output:

sqrt(a)*int(csc(x)*sec(x)**2*x**2,x)