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

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

Optimal result

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

1/2*x^2*cos(x)^2*(a*sec(x)^4)^(1/2)-2*x^2*arctanh(exp(2*I*x))*cos(x)^2*(a* 
sec(x)^4)^(1/2)-cos(x)^2*ln(cos(x))*(a*sec(x)^4)^(1/2)+I*x*cos(x)^2*polylo 
g(2,-exp(2*I*x))*(a*sec(x)^4)^(1/2)-I*x*cos(x)^2*polylog(2,exp(2*I*x))*(a* 
sec(x)^4)^(1/2)-1/2*cos(x)^2*polylog(3,-exp(2*I*x))*(a*sec(x)^4)^(1/2)+1/2 
*cos(x)^2*polylog(3,exp(2*I*x))*(a*sec(x)^4)^(1/2)-x*cos(x)*(a*sec(x)^4)^( 
1/2)*sin(x)+1/2*x^2*(a*sec(x)^4)^(1/2)*sin(x)^2
 

Mathematica [A] (verified)

Time = 0.48 (sec) , antiderivative size = 138, normalized size of antiderivative = 0.63 \[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^4(x)} \, dx=\frac {1}{24} \cos ^2(x) \sqrt {a \sec ^4(x)} \left (-i \pi ^3+16 i x^3+24 x^2 \log \left (1-e^{-2 i x}\right )-24 x^2 \log \left (1+e^{2 i x}\right )-24 \log (\cos (x))+24 i x \operatorname {PolyLog}\left (2,e^{-2 i x}\right )+24 i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )+12 \operatorname {PolyLog}\left (3,e^{-2 i x}\right )-12 \operatorname {PolyLog}\left (3,-e^{2 i x}\right )+12 x^2 \sec ^2(x)-24 x \tan (x)\right ) \] Input:

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

Output:

(Cos[x]^2*Sqrt[a*Sec[x]^4]*((-I)*Pi^3 + (16*I)*x^3 + 24*x^2*Log[1 - E^((-2 
*I)*x)] - 24*x^2*Log[1 + E^((2*I)*x)] - 24*Log[Cos[x]] + (24*I)*x*PolyLog[ 
2, E^((-2*I)*x)] + (24*I)*x*PolyLog[2, -E^((2*I)*x)] + 12*PolyLog[3, E^((- 
2*I)*x)] - 12*PolyLog[3, -E^((2*I)*x)] + 12*x^2*Sec[x]^2 - 24*x*Tan[x]))/2 
4
 

Rubi [A] (verified)

Time = 0.76 (sec) , antiderivative size = 115, normalized size of antiderivative = 0.52, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {7271, 4920, 27, 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 ^4(x)} \, dx\)

\(\Big \downarrow \) 7271

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

\(\Big \downarrow \) 4920

\(\displaystyle \cos ^2(x) \sqrt {a \sec ^4(x)} \left (-2 \int \frac {1}{2} x \left (\tan ^2(x)+2 \log (\tan (x))\right )dx+\frac {1}{2} x^2 \tan ^2(x)+x^2 \log (\tan (x))\right )\)

\(\Big \downarrow \) 27

\(\displaystyle \cos ^2(x) \sqrt {a \sec ^4(x)} \left (-\int x \left (\tan ^2(x)+2 \log (\tan (x))\right )dx+\frac {1}{2} x^2 \tan ^2(x)+x^2 \log (\tan (x))\right )\)

\(\Big \downarrow \) 2010

\(\displaystyle \cos ^2(x) \sqrt {a \sec ^4(x)} \left (-\int \left (x \tan ^2(x)+2 x \log (\tan (x))\right )dx+\frac {1}{2} x^2 \tan ^2(x)+x^2 \log (\tan (x))\right )\)

\(\Big \downarrow \) 2009

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

Input:

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

Output:

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

Defintions of rubi rules used

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 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.21 (sec) , antiderivative size = 191, normalized size of antiderivative = 0.87

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

Input:

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

Output:

2*(a*exp(4*I*x)/(1+exp(2*I*x))^4)^(1/2)*x*(x-I-I*exp(-2*I*x))+2*(a*exp(4*I 
*x)/(1+exp(2*I*x))^4)^(1/2)*exp(-2*I*x)*(1+exp(2*I*x))^2*(-1/2*ln(1+exp(2* 
I*x))+ln(exp(I*x))-1/2*x^2*ln(1+exp(2*I*x))+1/2*I*x*polylog(2,-exp(2*I*x)) 
-1/4*polylog(3,-exp(2*I*x))+1/2*x^2*ln(1-exp(I*x))-I*x*polylog(2,exp(I*x)) 
+polylog(3,exp(I*x))+1/2*x^2*ln(exp(I*x)+1)-I*x*polylog(2,-exp(I*x))+polyl 
og(3,-exp(I*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. 550 vs. \(2 (173) = 346\).

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

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

Output:

sqrt(a/cos(x)^4)*cos(x)^2*polylog(3, cos(x) + I*sin(x)) + sqrt(a/cos(x)^4) 
*cos(x)^2*polylog(3, cos(x) - I*sin(x)) - sqrt(a/cos(x)^4)*cos(x)^2*polylo 
g(3, I*cos(x) + sin(x)) - sqrt(a/cos(x)^4)*cos(x)^2*polylog(3, I*cos(x) - 
sin(x)) - sqrt(a/cos(x)^4)*cos(x)^2*polylog(3, -I*cos(x) + sin(x)) - sqrt( 
a/cos(x)^4)*cos(x)^2*polylog(3, -I*cos(x) - sin(x)) + sqrt(a/cos(x)^4)*cos 
(x)^2*polylog(3, -cos(x) + I*sin(x)) + sqrt(a/cos(x)^4)*cos(x)^2*polylog(3 
, -cos(x) - I*sin(x)) + 1/2*(x^2*cos(x)^2*log(cos(x) + I*sin(x) + 1) + x^2 
*cos(x)^2*log(cos(x) - I*sin(x) + 1) - x^2*cos(x)^2*log(I*cos(x) + sin(x) 
+ 1) - x^2*cos(x)^2*log(I*cos(x) - sin(x) + 1) - x^2*cos(x)^2*log(-I*cos(x 
) + sin(x) + 1) - x^2*cos(x)^2*log(-I*cos(x) - sin(x) + 1) + x^2*cos(x)^2* 
log(-cos(x) + I*sin(x) + 1) + x^2*cos(x)^2*log(-cos(x) - I*sin(x) + 1) - 2 
*I*x*cos(x)^2*dilog(cos(x) + I*sin(x)) + 2*I*x*cos(x)^2*dilog(cos(x) - I*s 
in(x)) - 2*I*x*cos(x)^2*dilog(I*cos(x) + sin(x)) + 2*I*x*cos(x)^2*dilog(I* 
cos(x) - sin(x)) + 2*I*x*cos(x)^2*dilog(-I*cos(x) + sin(x)) - 2*I*x*cos(x) 
^2*dilog(-I*cos(x) - sin(x)) + 2*I*x*cos(x)^2*dilog(-cos(x) + I*sin(x)) - 
2*I*x*cos(x)^2*dilog(-cos(x) - I*sin(x)) - cos(x)^2*log(cos(x) + I*sin(x) 
+ I) - cos(x)^2*log(cos(x) - I*sin(x) + I) - cos(x)^2*log(-cos(x) + I*sin( 
x) + I) - cos(x)^2*log(-cos(x) - I*sin(x) + I) - 2*x*cos(x)*sin(x) + x^2)* 
sqrt(a/cos(x)^4)
 

Sympy [F]

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

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

Output:

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

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 639 vs. \(2 (173) = 346\).

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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