\(\int (\csc (x)-\sin (x))^4 \, dx\) [303]

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

Optimal result

Integrand size = 9, antiderivative size = 44 \[ \int (\csc (x)-\sin (x))^4 \, dx=\frac {35 x}{8}+\frac {35 \cot (x)}{8}-\frac {35 \cot ^3(x)}{24}+\frac {7}{8} \cos ^2(x) \cot ^3(x)+\frac {1}{4} \cos ^4(x) \cot ^3(x) \]

[Out]

35/8*x+35/8*cot(x)-35/24*cot(x)^3+7/8*cos(x)^2*cot(x)^3+1/4*cos(x)^4*cot(x)^3

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {296, 331, 209} \[ \int (\csc (x)-\sin (x))^4 \, dx=\frac {35 x}{8}-\frac {35 \cot ^3(x)}{24}+\frac {35 \cot (x)}{8}+\frac {1}{4} \cos ^4(x) \cot ^3(x)+\frac {7}{8} \cos ^2(x) \cot ^3(x) \]

[In]

Int[(Csc[x] - Sin[x])^4,x]

[Out]

(35*x)/8 + (35*Cot[x])/8 - (35*Cot[x]^3)/24 + (7*Cos[x]^2*Cot[x]^3)/8 + (Cos[x]^4*Cot[x]^3)/4

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 296

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(-(c*x)^(m + 1))*((a + b*x^n)^(p + 1)/
(a*c*n*(p + 1))), x] + Dist[(m + n*(p + 1) + 1)/(a*n*(p + 1)), Int[(c*x)^m*(a + b*x^n)^(p + 1), x], x] /; Free
Q[{a, b, c, m}, x] && IGtQ[n, 0] && LtQ[p, -1] && IntBinomialQ[a, b, c, n, m, p, x]

Rule 331

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(c*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*c
*(m + 1))), x] - Dist[b*((m + n*(p + 1) + 1)/(a*c^n*(m + 1))), Int[(c*x)^(m + n)*(a + b*x^n)^p, x], x] /; Free
Q[{a, b, c, p}, x] && IGtQ[n, 0] && LtQ[m, -1] && IntBinomialQ[a, b, c, n, m, p, x]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1}{x^4 \left (1+x^2\right )^3} \, dx,x,\tan (x)\right ) \\ & = \frac {1}{4} \cos ^4(x) \cot ^3(x)+\frac {7}{4} \text {Subst}\left (\int \frac {1}{x^4 \left (1+x^2\right )^2} \, dx,x,\tan (x)\right ) \\ & = \frac {7}{8} \cos ^2(x) \cot ^3(x)+\frac {1}{4} \cos ^4(x) \cot ^3(x)+\frac {35}{8} \text {Subst}\left (\int \frac {1}{x^4 \left (1+x^2\right )} \, dx,x,\tan (x)\right ) \\ & = -\frac {35}{24} \cot ^3(x)+\frac {7}{8} \cos ^2(x) \cot ^3(x)+\frac {1}{4} \cos ^4(x) \cot ^3(x)-\frac {35}{8} \text {Subst}\left (\int \frac {1}{x^2 \left (1+x^2\right )} \, dx,x,\tan (x)\right ) \\ & = \frac {35 \cot (x)}{8}-\frac {35 \cot ^3(x)}{24}+\frac {7}{8} \cos ^2(x) \cot ^3(x)+\frac {1}{4} \cos ^4(x) \cot ^3(x)+\frac {35}{8} \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (x)\right ) \\ & = \frac {35 x}{8}+\frac {35 \cot (x)}{8}-\frac {35 \cot ^3(x)}{24}+\frac {7}{8} \cos ^2(x) \cot ^3(x)+\frac {1}{4} \cos ^4(x) \cot ^3(x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 38, normalized size of antiderivative = 0.86 \[ \int (\csc (x)-\sin (x))^4 \, dx=\frac {35 x}{8}+\frac {10 \cot (x)}{3}-\frac {1}{3} \cot (x) \csc ^2(x)+\frac {3}{4} \sin (2 x)+\frac {1}{32} \sin (4 x) \]

[In]

Integrate[(Csc[x] - Sin[x])^4,x]

[Out]

(35*x)/8 + (10*Cot[x])/3 - (Cot[x]*Csc[x]^2)/3 + (3*Sin[2*x])/4 + Sin[4*x]/32

Maple [A] (verified)

Time = 2.08 (sec) , antiderivative size = 39, normalized size of antiderivative = 0.89

method result size
default \(-\frac {\left (\sin \left (x \right )^{3}+\frac {3 \sin \left (x \right )}{2}\right ) \cos \left (x \right )}{4}+\frac {35 x}{8}+2 \cos \left (x \right ) \sin \left (x \right )+4 \cot \left (x \right )+\left (-\frac {2}{3}-\frac {\csc \left (x \right )^{2}}{3}\right ) \cot \left (x \right )\) \(39\)
parts \(-\frac {\left (\sin \left (x \right )^{3}+\frac {3 \sin \left (x \right )}{2}\right ) \cos \left (x \right )}{4}+\frac {35 x}{8}+2 \cos \left (x \right ) \sin \left (x \right )+4 \cot \left (x \right )+\left (-\frac {2}{3}-\frac {\csc \left (x \right )^{2}}{3}\right ) \cot \left (x \right )\) \(39\)
parallelrisch \(\frac {\csc \left (x \right )^{3} \left (2520 x \sin \left (x \right )-840 x \sin \left (3 x \right )+525 \cos \left (x \right )+3 \cos \left (7 x \right )+63 \cos \left (5 x \right )-847 \cos \left (3 x \right )\right )}{768}\) \(42\)
risch \(\frac {35 x}{8}-\frac {i {\mathrm e}^{4 i x}}{64}-\frac {3 i {\mathrm e}^{2 i x}}{8}+\frac {3 i {\mathrm e}^{-2 i x}}{8}+\frac {i {\mathrm e}^{-4 i x}}{64}+\frac {4 i \left (6 \,{\mathrm e}^{4 i x}-9 \,{\mathrm e}^{2 i x}+5\right )}{3 \left ({\mathrm e}^{2 i x}-1\right )^{3}}\) \(65\)
norman \(\frac {-\frac {1}{24}+\frac {35 \tan \left (\frac {x}{2}\right )^{2}}{24}+\frac {63 \tan \left (\frac {x}{2}\right )^{4}}{8}+\frac {35 \tan \left (\frac {x}{2}\right )^{6}}{8}-\frac {35 \tan \left (\frac {x}{2}\right )^{8}}{8}-\frac {63 \tan \left (\frac {x}{2}\right )^{10}}{8}-\frac {35 \tan \left (\frac {x}{2}\right )^{12}}{24}+\frac {\tan \left (\frac {x}{2}\right )^{14}}{24}+\frac {35 x \tan \left (\frac {x}{2}\right )^{3}}{8}+\frac {35 x \tan \left (\frac {x}{2}\right )^{5}}{2}+\frac {105 x \tan \left (\frac {x}{2}\right )^{7}}{4}+\frac {35 x \tan \left (\frac {x}{2}\right )^{9}}{2}+\frac {35 x \tan \left (\frac {x}{2}\right )^{11}}{8}}{\tan \left (\frac {x}{2}\right )^{3} \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )^{4}}\) \(121\)

[In]

int((csc(x)-sin(x))^4,x,method=_RETURNVERBOSE)

[Out]

-1/4*(sin(x)^3+3/2*sin(x))*cos(x)+35/8*x+2*cos(x)*sin(x)+4*cot(x)+(-2/3-1/3*csc(x)^2)*cot(x)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.16 \[ \int (\csc (x)-\sin (x))^4 \, dx=-\frac {6 \, \cos \left (x\right )^{7} + 21 \, \cos \left (x\right )^{5} - 140 \, \cos \left (x\right )^{3} - 105 \, {\left (x \cos \left (x\right )^{2} - x\right )} \sin \left (x\right ) + 105 \, \cos \left (x\right )}{24 \, {\left (\cos \left (x\right )^{2} - 1\right )} \sin \left (x\right )} \]

[In]

integrate((csc(x)-sin(x))^4,x, algorithm="fricas")

[Out]

-1/24*(6*cos(x)^7 + 21*cos(x)^5 - 140*cos(x)^3 - 105*(x*cos(x)^2 - x)*sin(x) + 105*cos(x))/((cos(x)^2 - 1)*sin
(x))

Sympy [A] (verification not implemented)

Time = 3.45 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.00 \[ \int (\csc (x)-\sin (x))^4 \, dx=\frac {35 x}{8} + 2 \sin {\left (x \right )} \cos {\left (x \right )} - \frac {\sin {\left (2 x \right )}}{4} + \frac {\sin {\left (4 x \right )}}{32} - \frac {\cot ^{3}{\left (x \right )}}{3} - \cot {\left (x \right )} + \frac {4 \cos {\left (x \right )}}{\sin {\left (x \right )}} \]

[In]

integrate((csc(x)-sin(x))**4,x)

[Out]

35*x/8 + 2*sin(x)*cos(x) - sin(2*x)/4 + sin(4*x)/32 - cot(x)**3/3 - cot(x) + 4*cos(x)/sin(x)

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.82 \[ \int (\csc (x)-\sin (x))^4 \, dx=\frac {35}{8} \, x + \frac {4}{\tan \left (x\right )} - \frac {3 \, \tan \left (x\right )^{2} + 1}{3 \, \tan \left (x\right )^{3}} + \frac {1}{32} \, \sin \left (4 \, x\right ) + \frac {3}{4} \, \sin \left (2 \, x\right ) \]

[In]

integrate((csc(x)-sin(x))^4,x, algorithm="maxima")

[Out]

35/8*x + 4/tan(x) - 1/3*(3*tan(x)^2 + 1)/tan(x)^3 + 1/32*sin(4*x) + 3/4*sin(2*x)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 39, normalized size of antiderivative = 0.89 \[ \int (\csc (x)-\sin (x))^4 \, dx=\frac {35}{8} \, x + \frac {11 \, \tan \left (x\right )^{3} + 13 \, \tan \left (x\right )}{8 \, {\left (\tan \left (x\right )^{2} + 1\right )}^{2}} + \frac {9 \, \tan \left (x\right )^{2} - 1}{3 \, \tan \left (x\right )^{3}} \]

[In]

integrate((csc(x)-sin(x))^4,x, algorithm="giac")

[Out]

35/8*x + 1/8*(11*tan(x)^3 + 13*tan(x))/(tan(x)^2 + 1)^2 + 1/3*(9*tan(x)^2 - 1)/tan(x)^3

Mupad [B] (verification not implemented)

Time = 29.12 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.34 \[ \int (\csc (x)-\sin (x))^4 \, dx=\frac {\frac {{\cos \left (x\right )}^7}{4}+\frac {7\,{\cos \left (x\right )}^5}{8}-\frac {35\,{\cos \left (x\right )}^3}{6}+\frac {35\,\cos \left (x\right )}{8}}{\sin \left (x\right )-{\cos \left (x\right )}^2\,\sin \left (x\right )}-\frac {\frac {35\,x}{8}-\frac {35\,x\,{\cos \left (x\right )}^2}{8}}{{\cos \left (x\right )}^2-1} \]

[In]

int((sin(x) - 1/sin(x))^4,x)

[Out]

((35*cos(x))/8 - (35*cos(x)^3)/6 + (7*cos(x)^5)/8 + cos(x)^7/4)/(sin(x) - cos(x)^2*sin(x)) - ((35*x)/8 - (35*x
*cos(x)^2)/8)/(cos(x)^2 - 1)