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

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

Optimal result

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

-2*x^2*arctanh(exp(I*x))*sec(x)/(a*sec(x)^2)^(1/2)+2*I*x*polylog(2,-exp(I* 
x))*sec(x)/(a*sec(x)^2)^(1/2)-2*I*x*polylog(2,exp(I*x))*sec(x)/(a*sec(x)^2 
)^(1/2)-2*polylog(3,-exp(I*x))*sec(x)/(a*sec(x)^2)^(1/2)+2*polylog(3,exp(I 
*x))*sec(x)/(a*sec(x)^2)^(1/2)
 

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.88 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.68, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {7271, 3042, 4671, 3011, 2720, 7143}

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 \frac {x^2 \csc (x) \sec (x)}{\sqrt {a \sec ^2(x)}} \, dx\)

\(\Big \downarrow \) 7271

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4671

\(\displaystyle \frac {\sec (x) \left (-2 \int x \log \left (1-e^{i x}\right )dx+2 \int x \log \left (1+e^{i x}\right )dx-2 x^2 \text {arctanh}\left (e^{i x}\right )\right )}{\sqrt {a \sec ^2(x)}}\)

\(\Big \downarrow \) 3011

\(\displaystyle \frac {\sec (x) \left (2 \left (i x \operatorname {PolyLog}\left (2,-e^{i x}\right )-i \int \operatorname {PolyLog}\left (2,-e^{i x}\right )dx\right )-2 \left (i x \operatorname {PolyLog}\left (2,e^{i x}\right )-i \int \operatorname {PolyLog}\left (2,e^{i x}\right )dx\right )-2 x^2 \text {arctanh}\left (e^{i x}\right )\right )}{\sqrt {a \sec ^2(x)}}\)

\(\Big \downarrow \) 2720

\(\displaystyle \frac {\sec (x) \left (2 \left (i x \operatorname {PolyLog}\left (2,-e^{i x}\right )-\int e^{-i x} \operatorname {PolyLog}\left (2,-e^{i x}\right )de^{i x}\right )-2 \left (i x \operatorname {PolyLog}\left (2,e^{i x}\right )-\int e^{-i x} \operatorname {PolyLog}\left (2,e^{i x}\right )de^{i x}\right )-2 x^2 \text {arctanh}\left (e^{i x}\right )\right )}{\sqrt {a \sec ^2(x)}}\)

\(\Big \downarrow \) 7143

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x)) 
*(F_)[v_] /; FreeQ[{a, b, c}, x] && InverseFunctionQ[F[x]]]
 

rule 3011
Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.) 
*(x_))^(m_.), x_Symbol] :> Simp[(-(f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + 
b*x)))^n]/(b*c*n*Log[F])), x] + Simp[g*(m/(b*c*n*Log[F]))   Int[(f + g*x)^( 
m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e 
, f, g, n}, x] && GtQ[m, 0]
 

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

rule 4671
Int[csc[(e_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[- 
2*(c + d*x)^m*(ArcTanh[E^(I*(e + f*x))]/f), x] + (-Simp[d*(m/f)   Int[(c + 
d*x)^(m - 1)*Log[1 - E^(I*(e + f*x))], x], x] + Simp[d*(m/f)   Int[(c + d*x 
)^(m - 1)*Log[1 + E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e, f}, x] && IG 
tQ[m, 0]
 

rule 7143
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S 
ymbol] :> Simp[PolyLog[n + 1, c*(a + b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d 
, e, n, p}, x] && EqQ[b*d, a*e]
 

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.15 (sec) , antiderivative size = 106, normalized size of antiderivative = 0.83

method result size
risch \(-\frac {2 \,{\mathrm e}^{i x} \left (-\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 )}{\sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left (1+{\mathrm e}^{2 i x}\right )^{2}}}\, \left (1+{\mathrm e}^{2 i x}\right )}\) \(106\)

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)/(1+exp(2*I*x))*exp(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))+polylog(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. 227 vs. \(2 (97) = 194\).

Time = 0.09 (sec) , antiderivative size = 227, normalized size of antiderivative = 1.77 \[ \int \frac {x^2 \csc (x) \sec (x)}{\sqrt {a \sec ^2(x)}} \, dx=\frac {2 \, \sqrt {\frac {a}{\cos \left (x\right )^{2}}} \cos \left (x\right ) {\rm polylog}\left (3, \cos \left (x\right ) + i \, \sin \left (x\right )\right ) + 2 \, \sqrt {\frac {a}{\cos \left (x\right )^{2}}} \cos \left (x\right ) {\rm polylog}\left (3, \cos \left (x\right ) - i \, \sin \left (x\right )\right ) - 2 \, \sqrt {\frac {a}{\cos \left (x\right )^{2}}} \cos \left (x\right ) {\rm polylog}\left (3, -\cos \left (x\right ) + i \, \sin \left (x\right )\right ) - 2 \, \sqrt {\frac {a}{\cos \left (x\right )^{2}}} \cos \left (x\right ) {\rm polylog}\left (3, -\cos \left (x\right ) - i \, \sin \left (x\right )\right ) - {\left (x^{2} \cos \left (x\right ) \log \left (\cos \left (x\right ) + i \, \sin \left (x\right ) + 1\right ) + x^{2} \cos \left (x\right ) \log \left (\cos \left (x\right ) - i \, \sin \left (x\right ) + 1\right ) - x^{2} \cos \left (x\right ) \log \left (-\cos \left (x\right ) + i \, \sin \left (x\right ) + 1\right ) - x^{2} \cos \left (x\right ) \log \left (-\cos \left (x\right ) - i \, \sin \left (x\right ) + 1\right ) + 2 i \, x \cos \left (x\right ) {\rm Li}_2\left (\cos \left (x\right ) + i \, \sin \left (x\right )\right ) - 2 i \, x \cos \left (x\right ) {\rm Li}_2\left (\cos \left (x\right ) - i \, \sin \left (x\right )\right ) + 2 i \, x \cos \left (x\right ) {\rm Li}_2\left (-\cos \left (x\right ) + i \, \sin \left (x\right )\right ) - 2 i \, x \cos \left (x\right ) {\rm Li}_2\left (-\cos \left (x\right ) - i \, \sin \left (x\right )\right )\right )} \sqrt {\frac {a}{\cos \left (x\right )^{2}}}}{2 \, a} \] Input:

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

Output:

1/2*(2*sqrt(a/cos(x)^2)*cos(x)*polylog(3, cos(x) + I*sin(x)) + 2*sqrt(a/co 
s(x)^2)*cos(x)*polylog(3, cos(x) - I*sin(x)) - 2*sqrt(a/cos(x)^2)*cos(x)*p 
olylog(3, -cos(x) + I*sin(x)) - 2*sqrt(a/cos(x)^2)*cos(x)*polylog(3, -cos( 
x) - I*sin(x)) - (x^2*cos(x)*log(cos(x) + I*sin(x) + 1) + x^2*cos(x)*log(c 
os(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) + 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)))*sqrt(a/cos(x)^2))/a
 

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.84 \[ \int \frac {x^2 \csc (x) \sec (x)}{\sqrt {a \sec ^2(x)}} \, dx=-\frac {2 i \, x^{2} \arctan \left (\sin \left (x\right ), \cos \left (x\right ) + 1\right ) + 2 i \, x^{2} \arctan \left (\sin \left (x\right ), -\cos \left (x\right ) + 1\right ) + x^{2} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \cos \left (x\right ) + 1\right ) - x^{2} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \cos \left (x\right ) + 1\right ) - 4 i \, x {\rm Li}_2\left (-e^{\left (i \, x\right )}\right ) + 4 i \, x {\rm Li}_2\left (e^{\left (i \, x\right )}\right ) + 4 \, {\rm Li}_{3}(-e^{\left (i \, x\right )}) - 4 \, {\rm Li}_{3}(e^{\left (i \, x\right )})}{2 \, \sqrt {a}} \] Input:

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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