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

3.9.75.1 Optimal result
3.9.75.2 Mathematica [A] (verified)
3.9.75.3 Rubi [A] (verified)
3.9.75.4 Maple [A] (verified)
3.9.75.5 Fricas [B] (verification not implemented)
3.9.75.6 Sympy [F]
3.9.75.7 Maxima [F]
3.9.75.8 Giac [F]
3.9.75.9 Mupad [F(-1)]

3.9.75.1 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)
 
3.9.75.2 Mathematica [A] (verified)

Time = 0.13 (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]
 
3.9.75.3 Rubi [A] (verified)

Time = 0.70 (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])
 

3.9.75.3.1 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])
 
3.9.75.4 Maple [A] (verified)

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

method result size
risch \(2 \sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}+1\right )^{2}}}\, x^{2}-4 i \sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}+1\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 ({\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}-\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}\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)/(exp(2*I*x)+1)^2)^(1/2)*x^2-4*I*(a*exp(2*I*x)/(exp(2*I*x)+ 
1)^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(exp(I* 
x)+1)-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(1-exp(I*x))+2*I*x*polylog(2,exp(I*x))-2*polylog(3,exp(I*x))))*cos(x 
)
 
3.9.75.5 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.30 (sec) , antiderivative size = 337, normalized size of antiderivative = 1.50 \[ \int x^2 \csc (x) \sec (x) \sqrt {a \sec ^2(x)} \, dx=\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 ) + \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 ) - \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 ) - \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 ) - \frac {1}{2} \, {\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 ) + 2 \, x \cos \left (x\right ) \log \left (i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) - 2 \, x \cos \left (x\right ) \log \left (i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) + 2 \, x \cos \left (x\right ) \log \left (-i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) - 2 \, x \cos \left (x\right ) \log \left (-i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) - 2 \, x^{2} - 2 i \, \cos \left (x\right ) {\rm Li}_2\left (i \, \cos \left (x\right ) + \sin \left (x\right )\right ) - 2 i \, \cos \left (x\right ) {\rm Li}_2\left (i \, \cos \left (x\right ) - \sin \left (x\right )\right ) + 2 i \, \cos \left (x\right ) {\rm Li}_2\left (-i \, \cos \left (x\right ) + \sin \left (x\right )\right ) + 2 i \, \cos \left (x\right ) {\rm Li}_2\left (-i \, \cos \left (x\right ) - \sin \left (x\right )\right )\right )} \sqrt {\frac {a}{\cos \left (x\right )^{2}}} \]

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)
 
3.9.75.6 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)
 
3.9.75.7 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)
 
3.9.75.8 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)
 
3.9.75.9 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)