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

Optimal. Leaf size=101 \[ a^4 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 ) \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 )-\frac {1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x)) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.22, antiderivative size = 101, normalized size of antiderivative = 1.00, 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 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 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]

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 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]

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.26, size = 95, normalized size = 0.94 \[ -\frac {1}{12} \csc ^3(x) \left (-9 a^4 x \sin (x)+3 a^4 x \sin (3 x)+4 a^4 \cos (3 x)+24 a^3 b \cos (2 x)-8 a^3 b+6 a^2 b^2 \cos (3 x)+6 b^2 \left (3 a^2+b^2\right ) \cos (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]

-1/12*(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]))

________________________________________________________________________________________

fricas [A]  time = 0.95, size = 95, normalized size = 0.94 \[ \frac {12 \, a^{3} b \cos \relax (x)^{2} - 8 \, a^{3} b + 4 \, a b^{3} + 2 \, {\left (2 \, a^{4} + 3 \, a^{2} b^{2} - b^{4}\right )} \cos \relax (x)^{3} - 3 \, {\left (a^{4} - b^{4}\right )} \cos \relax (x) + 3 \, {\left (a^{4} x \cos \relax (x)^{2} - a^{4} x\right )} \sin \relax (x)}{3 \, {\left (\cos \relax (x)^{2} - 1\right )} \sin \relax (x)} \]

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))

________________________________________________________________________________________

giac [B]  time = 0.16, size = 215, normalized size = 2.13 \[ \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}} \]

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

________________________________________________________________________________________

maple [A]  time = 0.07, size = 93, normalized size = 0.92 \[ a^{4} \left (-\frac {\left (\cot ^{3}\relax (x )\right )}{3}+\cot \relax (x )+x \right )+4 a^{3} b \left (-\frac {\cos ^{4}\relax (x )}{3 \sin \relax (x )^{3}}+\frac {\cos ^{4}\relax (x )}{3 \sin \relax (x )}+\frac {\left (2+\cos ^{2}\relax (x )\right ) \sin \relax (x )}{3}\right )-\frac {2 a^{2} b^{2} \left (\cos ^{3}\relax (x )\right )}{\sin \relax (x )^{3}}-\frac {4 a \,b^{3}}{3 \sin \relax (x )^{3}}+b^{4} \left (-\frac {2}{3}-\frac {\left (\csc ^{2}\relax (x )\right )}{3}\right ) \cot \relax (x ) \]

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 = 0.41, size = 80, normalized size = 0.79 \[ -2 \, a^{2} b^{2} \cot \relax (x)^{3} + \frac {1}{3} \, a^{4} {\left (3 \, x + \frac {3 \, \tan \relax (x)^{2} - 1}{\tan \relax (x)^{3}}\right )} + \frac {4 \, {\left (3 \, \sin \relax (x)^{2} - 1\right )} a^{3} b}{3 \, \sin \relax (x)^{3}} - \frac {{\left (3 \, \tan \relax (x)^{2} + 1\right )} b^{4}}{3 \, \tan \relax (x)^{3}} - \frac {4 \, a b^{3}}{3 \, \sin \relax (x)^{3}} \]

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

________________________________________________________________________________________

mupad [B]  time = 2.53, size = 127, normalized size = 1.26 \[ a^4\,x-\frac {\frac {4\,a\,b^3}{3}+\frac {4\,a^3\,b}{3}-{\mathrm {tan}\left (\frac {x}{2}\right )}^2\,\left (5\,a^4+12\,a^3\,b+6\,a^2\,b^2-4\,a\,b^3-3\,b^4\right )+\frac {a^4}{3}+\frac {b^4}{3}+2\,a^2\,b^2}{8\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3}-\mathrm {tan}\left (\frac {x}{2}\right )\,\left (\frac {\left (a+b\right )\,{\left (a-b\right )}^3}{2}+\frac {{\left (a-b\right )}^4}{8}\right )+\frac {{\mathrm {tan}\left (\frac {x}{2}\right )}^3\,{\left (a-b\right )}^4}{24} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

a^4*x - ((4*a*b^3)/3 + (4*a^3*b)/3 - tan(x/2)^2*(12*a^3*b - 4*a*b^3 + 5*a^4 - 3*b^4 + 6*a^2*b^2) + a^4/3 + b^4
/3 + 2*a^2*b^2)/(8*tan(x/2)^3) - tan(x/2)*(((a + b)*(a - b)^3)/2 + (a - b)^4/8) + (tan(x/2)^3*(a - b)^4)/24

________________________________________________________________________________________

sympy [A]  time = 33.02, size = 97, normalized size = 0.96 \[ a^{4} x + \frac {a^{4} \cos {\relax (x )}}{\sin {\relax (x )}} - \frac {a^{4} \cos ^{3}{\relax (x )}}{3 \sin ^{3}{\relax (x )}} - \frac {4 a^{3} b \csc ^{3}{\relax (x )}}{3} + 4 a^{3} b \csc {\relax (x )} - 2 a^{2} b^{2} \cot ^{3}{\relax (x )} - \frac {4 a b^{3} \csc ^{3}{\relax (x )}}{3} - \frac {b^{4} \cot ^{3}{\relax (x )}}{3} - b^{4} \cot {\relax (x )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________