3.284 \(\int (a \cot (x)+b \csc (x))^4 \, dx\)

Optimal. Leaf size=101 \[ \frac{4}{3} a b \left (2 a^2-b^2\right ) \sin (x)+\frac{1}{3} a^2 \left (3 a^2-2 b^2\right ) \sin (x) \cos (x)+\frac{1}{3} \csc (x) (a \cos (x)+b)^2 \left (\left (3 a^2-2 b^2\right ) \cos (x)+a b\right )+a^4 x-\frac{1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x)) \]

[Out]

a^4*x + ((b + a*Cos[x])^2*(a*b + (3*a^2 - 2*b^2)*Cos[x])*Csc[x])/3 - ((b + a*Cos[x])^3*(a + b*Cos[x])*Csc[x]^3
)/3 + (4*a*b*(2*a^2 - b^2)*Sin[x])/3 + (a^2*(3*a^2 - 2*b^2)*Cos[x]*Sin[x])/3

________________________________________________________________________________________

Rubi [A]  time = 0.215116, antiderivative size = 101, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.364, Rules used = {4392, 2691, 2861, 2734} \[ \frac{4}{3} a b \left (2 a^2-b^2\right ) \sin (x)+\frac{1}{3} a^2 \left (3 a^2-2 b^2\right ) \sin (x) \cos (x)+\frac{1}{3} \csc (x) (a \cos (x)+b)^2 \left (\left (3 a^2-2 b^2\right ) \cos (x)+a b\right )+a^4 x-\frac{1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[(a*Cot[x] + b*Csc[x])^4,x]

[Out]

a^4*x + ((b + a*Cos[x])^2*(a*b + (3*a^2 - 2*b^2)*Cos[x])*Csc[x])/3 - ((b + a*Cos[x])^3*(a + b*Cos[x])*Csc[x]^3
)/3 + (4*a*b*(2*a^2 - b^2)*Sin[x])/3 + (a^2*(3*a^2 - 2*b^2)*Cos[x]*Sin[x])/3

Rule 4392

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rule 2691

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> -Simp[((g*C
os[e + f*x])^(p + 1)*(a + b*Sin[e + f*x])^(m - 1)*(b + a*Sin[e + f*x]))/(f*g*(p + 1)), x] + Dist[1/(g^2*(p + 1
)), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*x])^(m - 2)*(b^2*(m - 1) + a^2*(p + 2) + a*b*(m + p + 1)*Sin
[e + f*x]), x], x] /; FreeQ[{a, b, e, f, g}, x] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] && LtQ[p, -1] && (IntegersQ[
2*m, 2*p] || IntegerQ[m])

Rule 2861

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> -Simp[((g*Cos[e + f*x])^(p + 1)*(a + b*Sin[e + f*x])^m*(d + c*Sin[e + f*x]))/(f*
g*(p + 1)), x] + Dist[1/(g^2*(p + 1)), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*x])^(m - 1)*Simp[a*c*(p +
 2) + b*d*m + b*c*(m + p + 2)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] && NeQ[a^2 - b^2, 0]
 && GtQ[m, 0] && LtQ[p, -1] && IntegerQ[2*m] &&  !(EqQ[m, 1] && NeQ[c^2 - d^2, 0] && SimplerQ[c + d*x, a + b*x
])

Rule 2734

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((2*a*c
+ b*d)*x)/2, x] + (-Simp[((b*c + a*d)*Cos[e + f*x])/f, x] - Simp[(b*d*Cos[e + f*x]*Sin[e + f*x])/(2*f), x]) /;
 FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps

\begin{align*} \int (a \cot (x)+b \csc (x))^4 \, dx &=\int (b+a \cos (x))^4 \csc ^4(x) \, dx\\ &=-\frac{1}{3} (b+a \cos (x))^3 (a+b \cos (x)) \csc ^3(x)-\frac{1}{3} \int (b+a \cos (x))^2 \left (3 a^2-2 b^2+a b \cos (x)\right ) \csc ^2(x) \, dx\\ &=\frac{1}{3} (b+a \cos (x))^2 \left (a b+\left (3 a^2-2 b^2\right ) \cos (x)\right ) \csc (x)-\frac{1}{3} (b+a \cos (x))^3 (a+b \cos (x)) \csc ^3(x)+\frac{1}{3} \int (b+a \cos (x)) \left (2 a^2 b+2 a \left (3 a^2-2 b^2\right ) \cos (x)\right ) \, dx\\ &=a^4 x+\frac{1}{3} (b+a \cos (x))^2 \left (a b+\left (3 a^2-2 b^2\right ) \cos (x)\right ) \csc (x)-\frac{1}{3} (b+a \cos (x))^3 (a+b \cos (x)) \csc ^3(x)+\frac{4}{3} a b \left (2 a^2-b^2\right ) \sin (x)+\frac{1}{3} a^2 \left (3 a^2-2 b^2\right ) \cos (x) \sin (x)\\ \end{align*}

Mathematica [A]  time = 0.256534, size = 95, normalized size = 0.94 \[ -\frac{1}{12} \csc ^3(x) \left (6 a^2 b^2 \cos (3 x)+6 b^2 \left (3 a^2+b^2\right ) \cos (x)+24 a^3 b \cos (2 x)-8 a^3 b-9 a^4 x \sin (x)+3 a^4 x \sin (3 x)+4 a^4 \cos (3 x)+16 a b^3-2 b^4 \cos (3 x)\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(a*Cot[x] + b*Csc[x])^4,x]

[Out]

-(Csc[x]^3*(-8*a^3*b + 16*a*b^3 + 6*b^2*(3*a^2 + b^2)*Cos[x] + 24*a^3*b*Cos[2*x] + 4*a^4*Cos[3*x] + 6*a^2*b^2*
Cos[3*x] - 2*b^4*Cos[3*x] - 9*a^4*x*Sin[x] + 3*a^4*x*Sin[3*x]))/12

________________________________________________________________________________________

Maple [A]  time = 0.049, size = 93, normalized size = 0.9 \begin{align*}{a}^{4} \left ( -{\frac{ \left ( \cot \left ( x \right ) \right ) ^{3}}{3}}+\cot \left ( x \right ) +x \right ) +4\,{a}^{3}b \left ( -1/3\,{\frac{ \left ( \cos \left ( x \right ) \right ) ^{4}}{ \left ( \sin \left ( x \right ) \right ) ^{3}}}+1/3\,{\frac{ \left ( \cos \left ( x \right ) \right ) ^{4}}{\sin \left ( x \right ) }}+1/3\, \left ( 2+ \left ( \cos \left ( x \right ) \right ) ^{2} \right ) \sin \left ( x \right ) \right ) -2\,{\frac{{a}^{2}{b}^{2} \left ( \cos \left ( x \right ) \right ) ^{3}}{ \left ( \sin \left ( x \right ) \right ) ^{3}}}-{\frac{4\,a{b}^{3}}{3\, \left ( \sin \left ( x \right ) \right ) ^{3}}}+{b}^{4} \left ( -{\frac{2}{3}}-{\frac{ \left ( \csc \left ( x \right ) \right ) ^{2}}{3}} \right ) \cot \left ( x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a*cot(x)+b*csc(x))^4,x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.50357, size = 108, normalized size = 1.07 \begin{align*} -2 \, a^{2} b^{2} \cot \left (x\right )^{3} + \frac{1}{3} \, a^{4}{\left (3 \, x + \frac{3 \, \tan \left (x\right )^{2} - 1}{\tan \left (x\right )^{3}}\right )} + \frac{4 \,{\left (3 \, \sin \left (x\right )^{2} - 1\right )} a^{3} b}{3 \, \sin \left (x\right )^{3}} - \frac{{\left (3 \, \tan \left (x\right )^{2} + 1\right )} b^{4}}{3 \, \tan \left (x\right )^{3}} - \frac{4 \, a b^{3}}{3 \, \sin \left (x\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cot(x)+b*csc(x))^4,x, algorithm="maxima")

[Out]

-2*a^2*b^2*cot(x)^3 + 1/3*a^4*(3*x + (3*tan(x)^2 - 1)/tan(x)^3) + 4/3*(3*sin(x)^2 - 1)*a^3*b/sin(x)^3 - 1/3*(3
*tan(x)^2 + 1)*b^4/tan(x)^3 - 4/3*a*b^3/sin(x)^3

________________________________________________________________________________________

Fricas [A]  time = 1.92686, size = 225, normalized size = 2.23 \begin{align*} \frac{12 \, a^{3} b \cos \left (x\right )^{2} - 8 \, a^{3} b + 4 \, a b^{3} + 2 \,{\left (2 \, a^{4} + 3 \, a^{2} b^{2} - b^{4}\right )} \cos \left (x\right )^{3} - 3 \,{\left (a^{4} - b^{4}\right )} \cos \left (x\right ) + 3 \,{\left (a^{4} x \cos \left (x\right )^{2} - a^{4} x\right )} \sin \left (x\right )}{3 \,{\left (\cos \left (x\right )^{2} - 1\right )} \sin \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cot(x)+b*csc(x))^4,x, algorithm="fricas")

[Out]

1/3*(12*a^3*b*cos(x)^2 - 8*a^3*b + 4*a*b^3 + 2*(2*a^4 + 3*a^2*b^2 - b^4)*cos(x)^3 - 3*(a^4 - b^4)*cos(x) + 3*(
a^4*x*cos(x)^2 - a^4*x)*sin(x))/((cos(x)^2 - 1)*sin(x))

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cot(x)+b*csc(x))**4,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.11127, size = 290, normalized size = 2.87 \begin{align*} \frac{1}{24} \, a^{4} \tan \left (\frac{1}{2} \, x\right )^{3} - \frac{1}{6} \, a^{3} b \tan \left (\frac{1}{2} \, x\right )^{3} + \frac{1}{4} \, a^{2} b^{2} \tan \left (\frac{1}{2} \, x\right )^{3} - \frac{1}{6} \, a b^{3} \tan \left (\frac{1}{2} \, x\right )^{3} + \frac{1}{24} \, b^{4} \tan \left (\frac{1}{2} \, x\right )^{3} + a^{4} x - \frac{5}{8} \, a^{4} \tan \left (\frac{1}{2} \, x\right ) + \frac{3}{2} \, a^{3} b \tan \left (\frac{1}{2} \, x\right ) - \frac{3}{4} \, a^{2} b^{2} \tan \left (\frac{1}{2} \, x\right ) - \frac{1}{2} \, a b^{3} \tan \left (\frac{1}{2} \, x\right ) + \frac{3}{8} \, b^{4} \tan \left (\frac{1}{2} \, x\right ) + \frac{15 \, a^{4} \tan \left (\frac{1}{2} \, x\right )^{2} + 36 \, a^{3} b \tan \left (\frac{1}{2} \, x\right )^{2} + 18 \, a^{2} b^{2} \tan \left (\frac{1}{2} \, x\right )^{2} - 12 \, a b^{3} \tan \left (\frac{1}{2} \, x\right )^{2} - 9 \, b^{4} \tan \left (\frac{1}{2} \, x\right )^{2} - a^{4} - 4 \, a^{3} b - 6 \, a^{2} b^{2} - 4 \, a b^{3} - b^{4}}{24 \, \tan \left (\frac{1}{2} \, x\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cot(x)+b*csc(x))^4,x, algorithm="giac")

[Out]

1/24*a^4*tan(1/2*x)^3 - 1/6*a^3*b*tan(1/2*x)^3 + 1/4*a^2*b^2*tan(1/2*x)^3 - 1/6*a*b^3*tan(1/2*x)^3 + 1/24*b^4*
tan(1/2*x)^3 + a^4*x - 5/8*a^4*tan(1/2*x) + 3/2*a^3*b*tan(1/2*x) - 3/4*a^2*b^2*tan(1/2*x) - 1/2*a*b^3*tan(1/2*
x) + 3/8*b^4*tan(1/2*x) + 1/24*(15*a^4*tan(1/2*x)^2 + 36*a^3*b*tan(1/2*x)^2 + 18*a^2*b^2*tan(1/2*x)^2 - 12*a*b
^3*tan(1/2*x)^2 - 9*b^4*tan(1/2*x)^2 - a^4 - 4*a^3*b - 6*a^2*b^2 - 4*a*b^3 - b^4)/tan(1/2*x)^3