Integrand size = 26, antiderivative size = 127 \[ \int \frac {x^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx=-\frac {2 i x^2}{a^3}-\frac {\cot (a x)}{a^5}-\frac {2 x^2 \cot (a x)}{a^3}-\frac {x \csc ^2(a x)}{a^4}-\frac {x^2 \cot (a x) \csc ^2(a x)}{a^3}+\frac {4 x \log \left (1-e^{2 i a x}\right )}{a^4}-\frac {2 i \operatorname {PolyLog}\left (2,e^{2 i a x}\right )}{a^5}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))} \]
-2*I*x^2/a^3-cot(a*x)/a^5-2*x^2*cot(a*x)/a^3-x*csc(a*x)^2/a^4-x^2*cot(a*x) *csc(a*x)^2/a^3+4*x*ln(1-exp(2*I*a*x))/a^4-2*I*polylog(2,exp(2*I*a*x))/a^5 +x^3*csc(a*x)^3/a^2/(a*x*cos(a*x)-sin(a*x))
Time = 1.30 (sec) , antiderivative size = 102, normalized size of antiderivative = 0.80 \[ \int \frac {x^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx=\frac {\frac {1}{x}+a^2 x-a^3 x^2 \cot (a x)+4 a^2 x \log \left (1-e^{2 i a x}\right )-2 i a \left (a^2 x^2+\operatorname {PolyLog}\left (2,e^{2 i a x}\right )\right )+\frac {\left (1+a^2 x^2\right )^2 \sin (a x)}{x (a x \cos (a x)-\sin (a x))}}{a^6} \]
(x^(-1) + a^2*x - a^3*x^2*Cot[a*x] + 4*a^2*x*Log[1 - E^((2*I)*a*x)] - (2*I )*a*(a^2*x^2 + PolyLog[2, E^((2*I)*a*x)]) + ((1 + a^2*x^2)^2*Sin[a*x])/(x* (a*x*Cos[a*x] - Sin[a*x])))/a^6
Time = 0.79 (sec) , antiderivative size = 158, normalized size of antiderivative = 1.24, number of steps used = 15, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.538, Rules used = {5111, 3042, 4674, 3042, 4254, 24, 4672, 3042, 25, 4200, 25, 2620, 2715, 2838}
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^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx\) |
\(\Big \downarrow \) 5111 |
\(\displaystyle \frac {3 \int x^2 \csc ^4(a x)dx}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {3 \int x^2 \csc (a x)^4dx}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 4674 |
\(\displaystyle \frac {3 \left (\frac {\int \csc ^2(a x)dx}{3 a^2}+\frac {2}{3} \int x^2 \csc ^2(a x)dx-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {3 \left (\frac {\int \csc (a x)^2dx}{3 a^2}+\frac {2}{3} \int x^2 \csc (a x)^2dx-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 4254 |
\(\displaystyle \frac {3 \left (-\frac {\int 1d\cot (a x)}{3 a^3}+\frac {2}{3} \int x^2 \csc (a x)^2dx-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {3 \left (\frac {2}{3} \int x^2 \csc (a x)^2dx-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 4672 |
\(\displaystyle \frac {3 \left (\frac {2}{3} \left (\frac {2 \int x \cot (a x)dx}{a}-\frac {x^2 \cot (a x)}{a}\right )-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {3 \left (\frac {2}{3} \left (\frac {2 \int -x \tan \left (a x+\frac {\pi }{2}\right )dx}{a}-\frac {x^2 \cot (a x)}{a}\right )-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {3 \left (\frac {2}{3} \left (-\frac {2 \int x \tan \left (a x+\frac {\pi }{2}\right )dx}{a}-\frac {x^2 \cot (a x)}{a}\right )-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}+\frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}\) |
\(\Big \downarrow \) 4200 |
\(\displaystyle \frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}+\frac {3 \left (\frac {2}{3} \left (-\frac {x^2 \cot (a x)}{a}-\frac {2 \left (\frac {i x^2}{2}-2 i \int -\frac {e^{2 i a x} x}{1-e^{2 i a x}}dx\right )}{a}\right )-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}+\frac {3 \left (\frac {2}{3} \left (-\frac {x^2 \cot (a x)}{a}-\frac {2 \left (2 i \int \frac {e^{2 i a x} x}{1-e^{2 i a x}}dx+\frac {i x^2}{2}\right )}{a}\right )-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}\) |
\(\Big \downarrow \) 2620 |
\(\displaystyle \frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}+\frac {3 \left (\frac {2}{3} \left (-\frac {x^2 \cot (a x)}{a}-\frac {2 \left (2 i \left (\frac {i x \log \left (1-e^{2 i a x}\right )}{2 a}-\frac {i \int \log \left (1-e^{2 i a x}\right )dx}{2 a}\right )+\frac {i x^2}{2}\right )}{a}\right )-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}\) |
\(\Big \downarrow \) 2715 |
\(\displaystyle \frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}+\frac {3 \left (\frac {2}{3} \left (-\frac {x^2 \cot (a x)}{a}-\frac {2 \left (2 i \left (\frac {i x \log \left (1-e^{2 i a x}\right )}{2 a}-\frac {\int e^{-2 i a x} \log \left (1-e^{2 i a x}\right )de^{2 i a x}}{4 a^2}\right )+\frac {i x^2}{2}\right )}{a}\right )-\frac {\cot (a x)}{3 a^3}-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}\) |
\(\Big \downarrow \) 2838 |
\(\displaystyle \frac {x^3 \csc ^3(a x)}{a^2 (a x \cos (a x)-\sin (a x))}+\frac {3 \left (-\frac {\cot (a x)}{3 a^3}+\frac {2}{3} \left (-\frac {x^2 \cot (a x)}{a}-\frac {2 \left (2 i \left (\frac {\operatorname {PolyLog}\left (2,e^{2 i a x}\right )}{4 a^2}+\frac {i x \log \left (1-e^{2 i a x}\right )}{2 a}\right )+\frac {i x^2}{2}\right )}{a}\right )-\frac {x \csc ^2(a x)}{3 a^2}-\frac {x^2 \cot (a x) \csc ^2(a x)}{3 a}\right )}{a^2}\) |
(3*(-1/3*Cot[a*x]/a^3 - (x*Csc[a*x]^2)/(3*a^2) - (x^2*Cot[a*x]*Csc[a*x]^2) /(3*a) + (2*(-((x^2*Cot[a*x])/a) - (2*((I/2)*x^2 + (2*I)*(((I/2)*x*Log[1 - E^((2*I)*a*x)])/a + PolyLog[2, E^((2*I)*a*x)]/(4*a^2))))/a))/3))/a^2 + (x ^3*Csc[a*x]^3)/(a^2*(a*x*Cos[a*x] - Sin[a*x]))
3.6.93.3.1 Defintions of rubi rules used
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ ((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp [((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si mp[d*(m/(b*f*g*n*Log[F])) Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x )))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Simp[1/(d*e*n*Log[F]) Subst[Int[Log[a + b*x]/x, x], x, (F^(e*(c + d*x) ))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 , (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + Pi*(k_.) + (f_.)*(x_)], x_Symbol ] :> Simp[I*((c + d*x)^(m + 1)/(d*(m + 1))), x] - Simp[2*I Int[(c + d*x)^ m*E^(2*I*k*Pi)*(E^(2*I*(e + f*x))/(1 + E^(2*I*k*Pi)*E^(2*I*(e + f*x)))), x] , x] /; FreeQ[{c, d, e, f}, x] && IntegerQ[4*k] && IGtQ[m, 0]
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1) Subst[Int[Exp andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]
Int[csc[(e_.) + (f_.)*(x_)]^2*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp [(-(c + d*x)^m)*(Cot[e + f*x]/f), x] + Simp[d*(m/f) Int[(c + d*x)^(m - 1) *Cot[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(n_)*((c_.) + (d_.)*(x_))^(m_), x_Symbo l] :> Simp[(-b^2)*(c + d*x)^m*Cot[e + f*x]*((b*Csc[e + f*x])^(n - 2)/(f*(n - 1))), x] + (-Simp[b^2*d*m*(c + d*x)^(m - 1)*((b*Csc[e + f*x])^(n - 2)/(f^ 2*(n - 1)*(n - 2))), x] + Simp[b^2*d^2*m*((m - 1)/(f^2*(n - 1)*(n - 2))) Int[(c + d*x)^(m - 2)*(b*Csc[e + f*x])^(n - 2), x], x] + Simp[b^2*((n - 2)/ (n - 1)) Int[(c + d*x)^m*(b*Csc[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c , d, e, f}, x] && GtQ[n, 1] && NeQ[n, 2] && GtQ[m, 1]
Int[(Csc[(a_.)*(x_)]^(n_.)*((b_.)*(x_))^(m_.))/(Cos[(a_.)*(x_)]*(d_.)*(x_) + (c_.)*Sin[(a_.)*(x_)])^2, x_Symbol] :> Simp[b*(b*x)^(m - 1)*(Csc[a*x]^(n + 1)/(a*d*(c*Sin[a*x] + d*x*Cos[a*x]))), x] + Simp[b^2*((n + 1)/d^2) Int[ (b*x)^(m - 2)*Csc[a*x]^(n + 2), x], x] /; FreeQ[{a, b, c, d, m, n}, x] && E qQ[a*c + d, 0] && EqQ[m, n + 2]
Time = 1.82 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.35
method | result | size |
risch | \(-\frac {2 i \left (2 i a^{2} x^{2} {\mathrm e}^{2 i a x}+2 a^{3} x^{3}-2 i a^{2} x^{2}-a x \,{\mathrm e}^{2 i a x}+i {\mathrm e}^{2 i a x}+a x -i\right )}{\left ({\mathrm e}^{2 i a x}-1\right ) \left (a x \,{\mathrm e}^{2 i a x}+i {\mathrm e}^{2 i a x}+a x -i\right ) a^{5}}-\frac {4 i x^{2}}{a^{3}}+\frac {4 x \ln \left (1-{\mathrm e}^{i a x}\right )}{a^{4}}-\frac {4 i \operatorname {polylog}\left (2, {\mathrm e}^{i a x}\right )}{a^{5}}+\frac {4 x \ln \left ({\mathrm e}^{i a x}+1\right )}{a^{4}}-\frac {4 i \operatorname {polylog}\left (2, -{\mathrm e}^{i a x}\right )}{a^{5}}\) | \(172\) |
-2*I*(2*I*a^2*x^2*exp(2*I*a*x)+2*a^3*x^3-2*I*a^2*x^2-a*x*exp(2*I*a*x)+I*ex p(2*I*a*x)+a*x-I)/(exp(2*I*a*x)-1)/(a*x*exp(2*I*a*x)+I*exp(2*I*a*x)+a*x-I) /a^5-4*I/a^3*x^2+4/a^4*x*ln(1-exp(I*a*x))-4*I/a^5*polylog(2,exp(I*a*x))+4/ a^4*x*ln(exp(I*a*x)+1)-4*I/a^5*polylog(2,-exp(I*a*x))
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 410 vs. \(2 (116) = 232\).
Time = 0.29 (sec) , antiderivative size = 410, normalized size of antiderivative = 3.23 \[ \int \frac {x^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx=\frac {a^{3} x^{3} - {\left (2 \, a^{3} x^{3} + a x\right )} \cos \left (a x\right )^{2} + {\left (2 \, a^{2} x^{2} + 1\right )} \cos \left (a x\right ) \sin \left (a x\right ) + a x - 2 \, {\left (i \, a x \cos \left (a x\right ) \sin \left (a x\right ) + i \, \cos \left (a x\right )^{2} - i\right )} {\rm Li}_2\left (\cos \left (a x\right ) + i \, \sin \left (a x\right )\right ) - 2 \, {\left (-i \, a x \cos \left (a x\right ) \sin \left (a x\right ) - i \, \cos \left (a x\right )^{2} + i\right )} {\rm Li}_2\left (\cos \left (a x\right ) - i \, \sin \left (a x\right )\right ) - 2 \, {\left (-i \, a x \cos \left (a x\right ) \sin \left (a x\right ) - i \, \cos \left (a x\right )^{2} + i\right )} {\rm Li}_2\left (-\cos \left (a x\right ) + i \, \sin \left (a x\right )\right ) - 2 \, {\left (i \, a x \cos \left (a x\right ) \sin \left (a x\right ) + i \, \cos \left (a x\right )^{2} - i\right )} {\rm Li}_2\left (-\cos \left (a x\right ) - i \, \sin \left (a x\right )\right ) + 2 \, {\left (a^{2} x^{2} \cos \left (a x\right ) \sin \left (a x\right ) + a x \cos \left (a x\right )^{2} - a x\right )} \log \left (\cos \left (a x\right ) + i \, \sin \left (a x\right ) + 1\right ) + 2 \, {\left (a^{2} x^{2} \cos \left (a x\right ) \sin \left (a x\right ) + a x \cos \left (a x\right )^{2} - a x\right )} \log \left (\cos \left (a x\right ) - i \, \sin \left (a x\right ) + 1\right ) + 2 \, {\left (a^{2} x^{2} \cos \left (a x\right ) \sin \left (a x\right ) + a x \cos \left (a x\right )^{2} - a x\right )} \log \left (-\cos \left (a x\right ) + i \, \sin \left (a x\right ) + 1\right ) + 2 \, {\left (a^{2} x^{2} \cos \left (a x\right ) \sin \left (a x\right ) + a x \cos \left (a x\right )^{2} - a x\right )} \log \left (-\cos \left (a x\right ) - i \, \sin \left (a x\right ) + 1\right )}{a^{6} x \cos \left (a x\right ) \sin \left (a x\right ) + a^{5} \cos \left (a x\right )^{2} - a^{5}} \]
(a^3*x^3 - (2*a^3*x^3 + a*x)*cos(a*x)^2 + (2*a^2*x^2 + 1)*cos(a*x)*sin(a*x ) + a*x - 2*(I*a*x*cos(a*x)*sin(a*x) + I*cos(a*x)^2 - I)*dilog(cos(a*x) + I*sin(a*x)) - 2*(-I*a*x*cos(a*x)*sin(a*x) - I*cos(a*x)^2 + I)*dilog(cos(a* x) - I*sin(a*x)) - 2*(-I*a*x*cos(a*x)*sin(a*x) - I*cos(a*x)^2 + I)*dilog(- cos(a*x) + I*sin(a*x)) - 2*(I*a*x*cos(a*x)*sin(a*x) + I*cos(a*x)^2 - I)*di log(-cos(a*x) - I*sin(a*x)) + 2*(a^2*x^2*cos(a*x)*sin(a*x) + a*x*cos(a*x)^ 2 - a*x)*log(cos(a*x) + I*sin(a*x) + 1) + 2*(a^2*x^2*cos(a*x)*sin(a*x) + a *x*cos(a*x)^2 - a*x)*log(cos(a*x) - I*sin(a*x) + 1) + 2*(a^2*x^2*cos(a*x)* sin(a*x) + a*x*cos(a*x)^2 - a*x)*log(-cos(a*x) + I*sin(a*x) + 1) + 2*(a^2* x^2*cos(a*x)*sin(a*x) + a*x*cos(a*x)^2 - a*x)*log(-cos(a*x) - I*sin(a*x) + 1))/(a^6*x*cos(a*x)*sin(a*x) + a^5*cos(a*x)^2 - a^5)
\[ \int \frac {x^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx=\int \frac {x^{4} \csc ^{2}{\left (a x \right )}}{\left (a x \cos {\left (a x \right )} - \sin {\left (a x \right )}\right )^{2}}\, dx \]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 594 vs. \(2 (116) = 232\).
Time = 0.26 (sec) , antiderivative size = 594, normalized size of antiderivative = 4.68 \[ \int \frac {x^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx=-\frac {2 \, {\left (a x + 2 \, {\left (a^{2} x^{2} + 2 i \, a x \cos \left (2 \, a x\right ) - 2 \, a x \sin \left (2 \, a x\right ) - i \, a x - {\left (a^{2} x^{2} + i \, a x\right )} \cos \left (4 \, a x\right ) + {\left (-i \, a^{2} x^{2} + a x\right )} \sin \left (4 \, a x\right )\right )} \arctan \left (\sin \left (a x\right ), \cos \left (a x\right ) + 1\right ) - 2 \, {\left (a^{2} x^{2} + 2 i \, a x \cos \left (2 \, a x\right ) - 2 \, a x \sin \left (2 \, a x\right ) - i \, a x - {\left (a^{2} x^{2} + i \, a x\right )} \cos \left (4 \, a x\right ) - {\left (i \, a^{2} x^{2} - a x\right )} \sin \left (4 \, a x\right )\right )} \arctan \left (\sin \left (a x\right ), -\cos \left (a x\right ) + 1\right ) + 2 \, {\left (a^{3} x^{3} + i \, a^{2} x^{2}\right )} \cos \left (4 \, a x\right ) + {\left (-2 i \, a^{2} x^{2} - a x + i\right )} \cos \left (2 \, a x\right ) - 2 \, {\left (a x - {\left (a x + i\right )} \cos \left (4 \, a x\right ) - {\left (i \, a x - 1\right )} \sin \left (4 \, a x\right ) + 2 i \, \cos \left (2 \, a x\right ) - 2 \, \sin \left (2 \, a x\right ) - i\right )} {\rm Li}_2\left (-e^{\left (i \, a x\right )}\right ) - 2 \, {\left (a x - {\left (a x + i\right )} \cos \left (4 \, a x\right ) - {\left (i \, a x - 1\right )} \sin \left (4 \, a x\right ) + 2 i \, \cos \left (2 \, a x\right ) - 2 \, \sin \left (2 \, a x\right ) - i\right )} {\rm Li}_2\left (e^{\left (i \, a x\right )}\right ) + {\left (-i \, a^{2} x^{2} + 2 \, a x \cos \left (2 \, a x\right ) + 2 i \, a x \sin \left (2 \, a x\right ) - a x + {\left (i \, a^{2} x^{2} - a x\right )} \cos \left (4 \, a x\right ) - {\left (a^{2} x^{2} + i \, a x\right )} \sin \left (4 \, a x\right )\right )} \log \left (\cos \left (a x\right )^{2} + \sin \left (a x\right )^{2} + 2 \, \cos \left (a x\right ) + 1\right ) + {\left (-i \, a^{2} x^{2} + 2 \, a x \cos \left (2 \, a x\right ) + 2 i \, a x \sin \left (2 \, a x\right ) - a x + {\left (i \, a^{2} x^{2} - a x\right )} \cos \left (4 \, a x\right ) - {\left (a^{2} x^{2} + i \, a x\right )} \sin \left (4 \, a x\right )\right )} \log \left (\cos \left (a x\right )^{2} + \sin \left (a x\right )^{2} - 2 \, \cos \left (a x\right ) + 1\right ) + 2 \, {\left (i \, a^{3} x^{3} - a^{2} x^{2}\right )} \sin \left (4 \, a x\right ) + {\left (2 \, a^{2} x^{2} - i \, a x - 1\right )} \sin \left (2 \, a x\right ) - i\right )}}{{\left (i \, a x + {\left (-i \, a x + 1\right )} \cos \left (4 \, a x\right ) + {\left (a x + i\right )} \sin \left (4 \, a x\right ) - 2 \, \cos \left (2 \, a x\right ) - 2 i \, \sin \left (2 \, a x\right ) + 1\right )} a^{5}} \]
-2*(a*x + 2*(a^2*x^2 + 2*I*a*x*cos(2*a*x) - 2*a*x*sin(2*a*x) - I*a*x - (a^ 2*x^2 + I*a*x)*cos(4*a*x) + (-I*a^2*x^2 + a*x)*sin(4*a*x))*arctan2(sin(a*x ), cos(a*x) + 1) - 2*(a^2*x^2 + 2*I*a*x*cos(2*a*x) - 2*a*x*sin(2*a*x) - I* a*x - (a^2*x^2 + I*a*x)*cos(4*a*x) - (I*a^2*x^2 - a*x)*sin(4*a*x))*arctan2 (sin(a*x), -cos(a*x) + 1) + 2*(a^3*x^3 + I*a^2*x^2)*cos(4*a*x) + (-2*I*a^2 *x^2 - a*x + I)*cos(2*a*x) - 2*(a*x - (a*x + I)*cos(4*a*x) - (I*a*x - 1)*s in(4*a*x) + 2*I*cos(2*a*x) - 2*sin(2*a*x) - I)*dilog(-e^(I*a*x)) - 2*(a*x - (a*x + I)*cos(4*a*x) - (I*a*x - 1)*sin(4*a*x) + 2*I*cos(2*a*x) - 2*sin(2 *a*x) - I)*dilog(e^(I*a*x)) + (-I*a^2*x^2 + 2*a*x*cos(2*a*x) + 2*I*a*x*sin (2*a*x) - a*x + (I*a^2*x^2 - a*x)*cos(4*a*x) - (a^2*x^2 + I*a*x)*sin(4*a*x ))*log(cos(a*x)^2 + sin(a*x)^2 + 2*cos(a*x) + 1) + (-I*a^2*x^2 + 2*a*x*cos (2*a*x) + 2*I*a*x*sin(2*a*x) - a*x + (I*a^2*x^2 - a*x)*cos(4*a*x) - (a^2*x ^2 + I*a*x)*sin(4*a*x))*log(cos(a*x)^2 + sin(a*x)^2 - 2*cos(a*x) + 1) + 2* (I*a^3*x^3 - a^2*x^2)*sin(4*a*x) + (2*a^2*x^2 - I*a*x - 1)*sin(2*a*x) - I) /((I*a*x + (-I*a*x + 1)*cos(4*a*x) + (a*x + I)*sin(4*a*x) - 2*cos(2*a*x) - 2*I*sin(2*a*x) + 1)*a^5)
\[ \int \frac {x^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx=\int { \frac {x^{4} \csc \left (a x\right )^{2}}{{\left (a x \cos \left (a x\right ) - \sin \left (a x\right )\right )}^{2}} \,d x } \]
Timed out. \[ \int \frac {x^4 \csc ^2(a x)}{(a x \cos (a x)-\sin (a x))^2} \, dx=\int \frac {x^4}{{\sin \left (a\,x\right )}^2\,{\left (\sin \left (a\,x\right )-a\,x\,\cos \left (a\,x\right )\right )}^2} \,d x \]