Integrand size = 11, antiderivative size = 101 \[ \int (a \cot (x)+b \csc (x))^4 \, 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) \] Output:
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)
Time = 0.29 (sec) , antiderivative size = 95, normalized size of antiderivative = 0.94 \[ \int (a \cot (x)+b \csc (x))^4 \, dx=-\frac {1}{12} \csc ^3(x) \left (-8 a^3 b+16 a b^3+6 b^2 \left (3 a^2+b^2\right ) \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)\right ) \] Input:
Integrate[(a*Cot[x] + b*Csc[x])^4,x]
Output:
-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]))
Time = 0.57 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.06, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.818, Rules used = {3042, 4892, 3042, 3170, 3042, 3340, 27, 3042, 3213}
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 (a \cot (x)+b \csc (x))^4 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a \cot (x)+b \csc (x))^4dx\) |
\(\Big \downarrow \) 4892 |
\(\displaystyle \int \csc ^4(x) (a \cos (x)+b)^4dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\left (b-a \sin \left (x-\frac {\pi }{2}\right )\right )^4}{\cos \left (x-\frac {\pi }{2}\right )^4}dx\) |
\(\Big \downarrow \) 3170 |
\(\displaystyle -\frac {1}{3} \int (b+a \cos (x))^2 \left (3 a^2+b \cos (x) a-2 b^2\right ) \csc ^2(x)dx-\frac {1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x))\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {1}{3} \int \frac {\left (b-a \sin \left (x-\frac {\pi }{2}\right )\right )^2 \left (3 a^2-b \sin \left (x-\frac {\pi }{2}\right ) a-2 b^2\right )}{\cos \left (x-\frac {\pi }{2}\right )^2}dx-\frac {1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x))\) |
\(\Big \downarrow \) 3340 |
\(\displaystyle \frac {1}{3} \left (\int 2 (b+a \cos (x)) \left (b a^2+\left (3 a^2-2 b^2\right ) \cos (x) a\right )dx+\csc (x) \left (\left (3 a^2-2 b^2\right ) \cos (x)+a b\right ) (a \cos (x)+b)^2\right )-\frac {1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x))\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {1}{3} \left (2 \int (b+a \cos (x)) \left (b a^2+\left (3 a^2-2 b^2\right ) \cos (x) a\right )dx+\csc (x) \left (\left (3 a^2-2 b^2\right ) \cos (x)+a b\right ) (a \cos (x)+b)^2\right )-\frac {1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x))\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{3} \left (2 \int \left (b+a \sin \left (x+\frac {\pi }{2}\right )\right ) \left (b a^2+\left (3 a^2-2 b^2\right ) \sin \left (x+\frac {\pi }{2}\right ) a\right )dx+\csc (x) \left (\left (3 a^2-2 b^2\right ) \cos (x)+a b\right ) (a \cos (x)+b)^2\right )-\frac {1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x))\) |
\(\Big \downarrow \) 3213 |
\(\displaystyle \frac {1}{3} \left (\csc (x) \left (\left (3 a^2-2 b^2\right ) \cos (x)+a b\right ) (a \cos (x)+b)^2+2 \left (\frac {3 a^4 x}{2}+2 a b \left (2 a^2-b^2\right ) \sin (x)+\frac {1}{2} a^2 \left (3 a^2-2 b^2\right ) \sin (x) \cos (x)\right )\right )-\frac {1}{3} \csc ^3(x) (a \cos (x)+b)^3 (a+b \cos (x))\) |
Input:
Int[(a*Cot[x] + b*Csc[x])^4,x]
Output:
-1/3*((b + a*Cos[x])^3*(a + b*Cos[x])*Csc[x]^3) + ((b + a*Cos[x])^2*(a*b + (3*a^2 - 2*b^2)*Cos[x])*Csc[x] + 2*((3*a^4*x)/2 + 2*a*b*(2*a^2 - b^2)*Sin [x] + (a^2*(3*a^2 - 2*b^2)*Cos[x]*Sin[x])/2))/3
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x _)])^(m_), x_Symbol] :> Simp[(-(g*Cos[e + f*x])^(p + 1))*(a + b*Sin[e + f*x ])^(m - 1)*((b + a*Sin[e + f*x])/(f*g*(p + 1))), x] + Simp[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])
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)*(Co s[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /; Free Q[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
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] + Simp[1/(g^2*(p + 1)) Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Si n[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])
Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b _.))^(p_)*(u_.), x_Symbol] :> Int[ActivateTrig[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]
Time = 10.51 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.71
method | result | size |
parts | \(a^{4} \left (-\frac {\cot \left (x \right )^{3}}{3}+\cot \left (x \right )-\frac {\pi }{2}+\operatorname {arccot}\left (\cot \left (x \right )\right )\right )+b^{4} \left (-\frac {2}{3}-\frac {\csc \left (x \right )^{2}}{3}\right ) \cot \left (x \right )+4 a^{3} b \left (-\frac {\csc \left (x \right )^{3}}{3}+\csc \left (x \right )\right )-2 a^{2} b^{2} \cot \left (x \right )^{3}-\frac {4 b^{3} \csc \left (x \right )^{3} a}{3}\) | \(72\) |
default | \(b^{4} \left (-\frac {2}{3}-\frac {\csc \left (x \right )^{2}}{3}\right ) \cot \left (x \right )-\frac {4 a \,b^{3}}{3 \sin \left (x \right )^{3}}-\frac {2 a^{2} b^{2} \cos \left (x \right )^{3}}{\sin \left (x \right )^{3}}+4 a^{3} b \left (-\frac {\cos \left (x \right )^{4}}{3 \sin \left (x \right )^{3}}+\frac {\cos \left (x \right )^{4}}{3 \sin \left (x \right )}+\frac {\left (2+\cos \left (x \right )^{2}\right ) \sin \left (x \right )}{3}\right )+a^{4} \left (-\frac {\cot \left (x \right )^{3}}{3}+\cot \left (x \right )+x \right )\) | \(93\) |
risch | \(a^{4} x +\frac {4 i \left (6 a^{3} b \,{\mathrm e}^{5 i x}+3 a^{4} {\mathrm e}^{4 i x}+9 a^{2} b^{2} {\mathrm e}^{4 i x}-4 a^{3} b \,{\mathrm e}^{3 i x}+8 a \,b^{3} {\mathrm e}^{3 i x}-3 a^{4} {\mathrm e}^{2 i x}+3 b^{4} {\mathrm e}^{2 i x}+6 a^{3} b \,{\mathrm e}^{i x}+2 a^{4}+3 a^{2} b^{2}-b^{4}\right )}{3 \left ({\mathrm e}^{2 i x}-1\right )^{3}}\) | \(125\) |
Input:
int((a*cot(x)+b*csc(x))^4,x,method=_RETURNVERBOSE)
Output:
a^4*(-1/3*cot(x)^3+cot(x)-1/2*Pi+arccot(cot(x)))+b^4*(-2/3-1/3*csc(x)^2)*c ot(x)+4*a^3*b*(-1/3*csc(x)^3+csc(x))-2*a^2*b^2*cot(x)^3-4/3*b^3*csc(x)^3*a
Time = 0.08 (sec) , antiderivative size = 95, normalized size of antiderivative = 0.94 \[ \int (a \cot (x)+b \csc (x))^4 \, dx=\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 )} \] Input:
integrate((a*cot(x)+b*csc(x))^4,x, algorithm="fricas")
Output:
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)*c os(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))
Time = 16.29 (sec) , antiderivative size = 97, normalized size of antiderivative = 0.96 \[ \int (a \cot (x)+b \csc (x))^4 \, dx=a^{4} x + \frac {a^{4} \cos {\left (x \right )}}{\sin {\left (x \right )}} - \frac {a^{4} \cos ^{3}{\left (x \right )}}{3 \sin ^{3}{\left (x \right )}} - \frac {4 a^{3} b \csc ^{3}{\left (x \right )}}{3} + 4 a^{3} b \csc {\left (x \right )} - 2 a^{2} b^{2} \cot ^{3}{\left (x \right )} - \frac {4 a b^{3} \csc ^{3}{\left (x \right )}}{3} - \frac {b^{4} \cot ^{3}{\left (x \right )}}{3} - b^{4} \cot {\left (x \right )} \] Input:
integrate((a*cot(x)+b*csc(x))**4,x)
Output:
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)
Time = 0.11 (sec) , antiderivative size = 80, normalized size of antiderivative = 0.79 \[ \int (a \cot (x)+b \csc (x))^4 \, dx=-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}} \] Input:
integrate((a*cot(x)+b*csc(x))^4,x, algorithm="maxima")
Output:
-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*s in(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
Leaf count of result is larger than twice the leaf count of optimal. 215 vs. \(2 (93) = 186\).
Time = 0.13 (sec) , antiderivative size = 215, normalized size of antiderivative = 2.13 \[ \int (a \cot (x)+b \csc (x))^4 \, dx=\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}} \] Input:
integrate((a*cot(x)+b*csc(x))^4,x, algorithm="giac")
Output:
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
Time = 15.27 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.26 \[ \int (a \cot (x)+b \csc (x))^4 \, dx=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} \] Input:
int((b/sin(x) + a*cot(x))^4,x)
Output:
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
Time = 0.21 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.04 \[ \int (a \cot (x)+b \csc (x))^4 \, dx=\frac {6 \cos \left (x \right ) \sin \left (x \right )^{2} a^{2} b^{2}-2 \cos \left (x \right ) \sin \left (x \right )^{2} b^{4}-6 \cos \left (x \right ) a^{2} b^{2}-\cos \left (x \right ) b^{4}-\cot \left (x \right )^{3} \sin \left (x \right )^{3} a^{4}+3 \cot \left (x \right ) \sin \left (x \right )^{3} a^{4}+3 \sin \left (x \right )^{3} a^{4} x +12 \sin \left (x \right )^{2} a^{3} b -4 a^{3} b -4 a \,b^{3}}{3 \sin \left (x \right )^{3}} \] Input:
int((a*cot(x)+b*csc(x))^4,x)
Output:
(6*cos(x)*sin(x)**2*a**2*b**2 - 2*cos(x)*sin(x)**2*b**4 - 6*cos(x)*a**2*b* *2 - cos(x)*b**4 - cot(x)**3*sin(x)**3*a**4 + 3*cot(x)*sin(x)**3*a**4 + 3* sin(x)**3*a**4*x + 12*sin(x)**2*a**3*b - 4*a**3*b - 4*a*b**3)/(3*sin(x)**3 )