\(\int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx\) [16]

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

Optimal result

Integrand size = 13, antiderivative size = 126 \[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=\frac {a \left (3 a^4-6 a^2 b^2-b^4\right ) x}{8 \left (a^2+b^2\right )^3}-\frac {a^4 b \log (b \cos (x)+a \sin (x))}{\left (a^2+b^2\right )^3}+\frac {\left (4 b \left (2 a^2+b^2\right )+a \left (5 a^2+b^2\right ) \cot (x)\right ) \sin ^2(x)}{8 \left (a^2+b^2\right )^2}-\frac {(b+a \cot (x)) \sin ^4(x)}{4 \left (a^2+b^2\right )} \] Output:

1/8*a*(3*a^4-6*a^2*b^2-b^4)*x/(a^2+b^2)^3-a^4*b*ln(b*cos(x)+a*sin(x))/(a^2 
+b^2)^3+1/8*(4*b*(2*a^2+b^2)+a*(5*a^2+b^2)*cot(x))*sin(x)^2/(a^2+b^2)^2-(b 
+a*cot(x))*sin(x)^4/(4*a^2+4*b^2)
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.58 (sec) , antiderivative size = 179, normalized size of antiderivative = 1.42 \[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=\frac {12 a^5 x-32 i a^4 b x-24 a^3 b^2 x-4 a b^4 x+32 i a^4 b \arctan (\tan (x))-4 b \left (3 a^4+4 a^2 b^2+b^4\right ) \cos (2 x)-a^4 b \cos (4 x)-2 a^2 b^3 \cos (4 x)-b^5 \cos (4 x)-16 a^4 b \log \left ((b \cos (x)+a \sin (x))^2\right )+8 a^5 \sin (2 x)+8 a^3 b^2 \sin (2 x)+a^5 \sin (4 x)+2 a^3 b^2 \sin (4 x)+a b^4 \sin (4 x)}{32 \left (a^2+b^2\right )^3} \] Input:

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

Output:

(12*a^5*x - (32*I)*a^4*b*x - 24*a^3*b^2*x - 4*a*b^4*x + (32*I)*a^4*b*ArcTa 
n[Tan[x]] - 4*b*(3*a^4 + 4*a^2*b^2 + b^4)*Cos[2*x] - a^4*b*Cos[4*x] - 2*a^ 
2*b^3*Cos[4*x] - b^5*Cos[4*x] - 16*a^4*b*Log[(b*Cos[x] + a*Sin[x])^2] + 8* 
a^5*Sin[2*x] + 8*a^3*b^2*Sin[2*x] + a^5*Sin[4*x] + 2*a^3*b^2*Sin[4*x] + a* 
b^4*Sin[4*x])/(32*(a^2 + b^2)^3)
 

Rubi [A] (verified)

Time = 0.57 (sec) , antiderivative size = 211, normalized size of antiderivative = 1.67, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.538, Rules used = {3042, 3999, 601, 2178, 27, 657, 2009}

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 {\cos ^4(x)}{a+b \cot (x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\sin \left (x+\frac {\pi }{2}\right )^4}{a-b \tan \left (x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 3999

\(\displaystyle -b \int \frac {b^4 \cot ^4(x)}{(a+b \cot (x)) \left (\cot ^2(x) b^2+b^2\right )^3}d(b \cot (x))\)

\(\Big \downarrow \) 601

\(\displaystyle -b \left (\frac {b^2 \left (a b \cot (x)+b^2\right )}{4 \left (a^2+b^2\right ) \left (b^2 \cot ^2(x)+b^2\right )^2}-\frac {\int \frac {-\frac {3 a \cot (x) b^5}{a^2+b^2}-4 \cot ^2(x) b^4+\frac {a^2 b^4}{a^2+b^2}}{(a+b \cot (x)) \left (\cot ^2(x) b^2+b^2\right )^2}d(b \cot (x))}{4 b^2}\right )\)

\(\Big \downarrow \) 2178

\(\displaystyle -b \left (\frac {b^2 \left (a b \cot (x)+b^2\right )}{4 \left (a^2+b^2\right ) \left (b^2 \cot ^2(x)+b^2\right )^2}-\frac {\frac {b^2 \left (a b \left (5 a^2+b^2\right ) \cot (x)+4 b^2 \left (2 a^2+b^2\right )\right )}{2 \left (a^2+b^2\right )^2 \left (b^2 \cot ^2(x)+b^2\right )}-\frac {\int \frac {a b^4 \left (a \left (3 a^2-b^2\right )-b \left (5 a^2+b^2\right ) \cot (x)\right )}{\left (a^2+b^2\right )^2 (a+b \cot (x)) \left (\cot ^2(x) b^2+b^2\right )}d(b \cot (x))}{2 b^2}}{4 b^2}\right )\)

\(\Big \downarrow \) 27

\(\displaystyle -b \left (\frac {b^2 \left (a b \cot (x)+b^2\right )}{4 \left (a^2+b^2\right ) \left (b^2 \cot ^2(x)+b^2\right )^2}-\frac {\frac {b^2 \left (a b \left (5 a^2+b^2\right ) \cot (x)+4 b^2 \left (2 a^2+b^2\right )\right )}{2 \left (a^2+b^2\right )^2 \left (b^2 \cot ^2(x)+b^2\right )}-\frac {a b^2 \int \frac {a \left (3 a^2-b^2\right )-b \left (5 a^2+b^2\right ) \cot (x)}{(a+b \cot (x)) \left (\cot ^2(x) b^2+b^2\right )}d(b \cot (x))}{2 \left (a^2+b^2\right )^2}}{4 b^2}\right )\)

\(\Big \downarrow \) 657

\(\displaystyle -b \left (\frac {b^2 \left (a b \cot (x)+b^2\right )}{4 \left (a^2+b^2\right ) \left (b^2 \cot ^2(x)+b^2\right )^2}-\frac {\frac {b^2 \left (a b \left (5 a^2+b^2\right ) \cot (x)+4 b^2 \left (2 a^2+b^2\right )\right )}{2 \left (a^2+b^2\right )^2 \left (b^2 \cot ^2(x)+b^2\right )}-\frac {a b^2 \int \left (\frac {8 a^3}{\left (a^2+b^2\right ) (a+b \cot (x))}+\frac {3 a^4-8 b \cot (x) a^3-6 b^2 a^2-b^4}{\left (a^2+b^2\right ) \left (\cot ^2(x) b^2+b^2\right )}\right )d(b \cot (x))}{2 \left (a^2+b^2\right )^2}}{4 b^2}\right )\)

\(\Big \downarrow \) 2009

\(\displaystyle -b \left (\frac {b^2 \left (a b \cot (x)+b^2\right )}{4 \left (a^2+b^2\right ) \left (b^2 \cot ^2(x)+b^2\right )^2}-\frac {\frac {b^2 \left (a b \left (5 a^2+b^2\right ) \cot (x)+4 b^2 \left (2 a^2+b^2\right )\right )}{2 \left (a^2+b^2\right )^2 \left (b^2 \cot ^2(x)+b^2\right )}-\frac {a b^2 \left (\frac {\left (3 a^4-6 a^2 b^2-b^4\right ) \arctan (\cot (x))}{b \left (a^2+b^2\right )}-\frac {4 a^3 \log \left (b^2 \cot ^2(x)+b^2\right )}{a^2+b^2}+\frac {8 a^3 \log (a+b \cot (x))}{a^2+b^2}\right )}{2 \left (a^2+b^2\right )^2}}{4 b^2}\right )\)

Input:

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

Output:

-(b*((b^2*(b^2 + a*b*Cot[x]))/(4*(a^2 + b^2)*(b^2 + b^2*Cot[x]^2)^2) - ((b 
^2*(4*b^2*(2*a^2 + b^2) + a*b*(5*a^2 + b^2)*Cot[x]))/(2*(a^2 + b^2)^2*(b^2 
 + b^2*Cot[x]^2)) - (a*b^2*(((3*a^4 - 6*a^2*b^2 - b^4)*ArcTan[Cot[x]])/(b* 
(a^2 + b^2)) + (8*a^3*Log[a + b*Cot[x]])/(a^2 + b^2) - (4*a^3*Log[b^2 + b^ 
2*Cot[x]^2])/(a^2 + b^2)))/(2*(a^2 + b^2)^2))/(4*b^2)))
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 601
Int[(x_)^(m_)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbo 
l] :> With[{Qx = PolynomialQuotient[x^m*(c + d*x)^n, a + b*x^2, x], e = Coe 
ff[PolynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 0], f = Coeff[Pol 
ynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 1]}, Simp[(a*f - b*e*x) 
*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Simp[1/(2*a*(p + 1))   Int[(c 
+ d*x)^n*(a + b*x^2)^(p + 1)*ExpandToSum[(2*a*(p + 1)*Qx)/(c + d*x)^n + (e* 
(2*p + 3))/(c + d*x)^n, x], x], x]] /; FreeQ[{a, b, c, d}, x] && IGtQ[m, 1] 
 && LtQ[p, -1] && ILtQ[n, 0] && NeQ[b*c^2 + a*d^2, 0]
 

rule 657
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_) + (c_.)*( 
x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g*x)^n/(a + c*x^ 
2)), x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IntegersQ[n]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2178
Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] : 
> With[{Qx = PolynomialQuotient[(d + e*x)^m*Pq, a + b*x^2, x], R = Coeff[Po 
lynomialRemainder[(d + e*x)^m*Pq, a + b*x^2, x], x, 0], S = Coeff[Polynomia 
lRemainder[(d + e*x)^m*Pq, a + b*x^2, x], x, 1]}, Simp[(a*S - b*R*x)*((a + 
b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Simp[1/(2*a*b*(p + 1))   Int[(d + e*x 
)^m*(a + b*x^2)^(p + 1)*ExpandToSum[(2*a*b*(p + 1)*Qx)/(d + e*x)^m + (b*R*( 
2*p + 3))/(d + e*x)^m, x], x], x]] /; FreeQ[{a, b, d, e}, x] && PolyQ[Pq, x 
] && NeQ[b*d^2 + a*e^2, 0] && LtQ[p, -1] && ILtQ[m, 0]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3999
Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_ 
), x_Symbol] :> Simp[b/f   Subst[Int[x^m*((a + x)^n/(b^2 + x^2)^(m/2 + 1)), 
 x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[m/2]
 
Maple [A] (verified)

Time = 4.65 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.37

method result size
default \(\frac {\frac {\left (\frac {3}{8} a^{5}+\frac {1}{4} b^{2} a^{3}-\frac {1}{8} a \,b^{4}\right ) \tan \left (x \right )^{3}+\left (-\frac {1}{2} a^{4} b -\frac {1}{2} a^{2} b^{3}\right ) \tan \left (x \right )^{2}+\left (\frac {5}{8} a^{5}+\frac {3}{4} b^{2} a^{3}+\frac {1}{8} a \,b^{4}\right ) \tan \left (x \right )-\frac {3 a^{4} b}{4}-a^{2} b^{3}-\frac {b^{5}}{4}}{\left (\tan \left (x \right )^{2}+1\right )^{2}}+\frac {a \left (4 b \,a^{3} \ln \left (\tan \left (x \right )^{2}+1\right )+\left (3 a^{4}-6 a^{2} b^{2}-b^{4}\right ) \arctan \left (\tan \left (x \right )\right )\right )}{8}}{\left (a^{2}+b^{2}\right )^{3}}-\frac {a^{4} b \ln \left (\tan \left (x \right ) a +b \right )}{\left (a^{2}+b^{2}\right )^{3}}\) \(172\)
risch \(\frac {i a x b}{24 i a^{2} b -8 i b^{3}+8 a^{3}-24 a \,b^{2}}+\frac {3 a^{2} x}{24 i a^{2} b -8 i b^{3}+8 a^{3}-24 a \,b^{2}}+\frac {b \,{\mathrm e}^{2 i x}}{32 i a b +16 a^{2}-16 b^{2}}-\frac {i {\mathrm e}^{2 i x} a}{8 \left (2 i a b +a^{2}-b^{2}\right )}+\frac {{\mathrm e}^{-2 i x} b}{16 \left (-i b +a \right )^{2}}+\frac {i {\mathrm e}^{-2 i x} a}{8 \left (-i b +a \right )^{2}}+\frac {2 i a^{4} b x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {a^{4} b \ln \left ({\mathrm e}^{2 i x}+\frac {i b -a}{i b +a}\right )}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {b \cos \left (4 x \right )}{-32 a^{2}-32 b^{2}}-\frac {a \sin \left (4 x \right )}{32 \left (-a^{2}-b^{2}\right )}\) \(278\)

Input:

int(cos(x)^4/(a+b*cot(x)),x,method=_RETURNVERBOSE)
 

Output:

1/(a^2+b^2)^3*(((3/8*a^5+1/4*b^2*a^3-1/8*a*b^4)*tan(x)^3+(-1/2*a^4*b-1/2*a 
^2*b^3)*tan(x)^2+(5/8*a^5+3/4*b^2*a^3+1/8*a*b^4)*tan(x)-3/4*a^4*b-a^2*b^3- 
1/4*b^5)/(tan(x)^2+1)^2+1/8*a*(4*b*a^3*ln(tan(x)^2+1)+(3*a^4-6*a^2*b^2-b^4 
)*arctan(tan(x))))-a^4*b/(a^2+b^2)^3*ln(tan(x)*a+b)
 

Fricas [A] (verification not implemented)

Time = 0.14 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.41 \[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=-\frac {4 \, a^{4} b \log \left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) - {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + a^{2}\right ) + 2 \, {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (x\right )^{4} + 4 \, {\left (a^{4} b + a^{2} b^{3}\right )} \cos \left (x\right )^{2} - {\left (3 \, a^{5} - 6 \, a^{3} b^{2} - a b^{4}\right )} x - {\left (2 \, {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (x\right )^{3} + {\left (3 \, a^{5} + 2 \, a^{3} b^{2} - a b^{4}\right )} \cos \left (x\right )\right )} \sin \left (x\right )}{8 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} \] Input:

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

Output:

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

Sympy [F]

\[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=\int \frac {\cos ^{4}{\left (x \right )}}{a + b \cot {\left (x \right )}}\, dx \] Input:

integrate(cos(x)**4/(a+b*cot(x)),x)
 

Output:

Integral(cos(x)**4/(a + b*cot(x)), x)
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 240, normalized size of antiderivative = 1.90 \[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=-\frac {a^{4} b \log \left (a \tan \left (x\right ) + b\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {a^{4} b \log \left (\tan \left (x\right )^{2} + 1\right )}{2 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} + \frac {{\left (3 \, a^{5} - 6 \, a^{3} b^{2} - a b^{4}\right )} x}{8 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} - \frac {4 \, a^{2} b \tan \left (x\right )^{2} - {\left (3 \, a^{3} - a b^{2}\right )} \tan \left (x\right )^{3} + 6 \, a^{2} b + 2 \, b^{3} - {\left (5 \, a^{3} + a b^{2}\right )} \tan \left (x\right )}{8 \, {\left ({\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \tan \left (x\right )^{4} + a^{4} + 2 \, a^{2} b^{2} + b^{4} + 2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \tan \left (x\right )^{2}\right )}} \] Input:

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

Output:

-a^4*b*log(a*tan(x) + b)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 1/2*a^4*b*l 
og(tan(x)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 1/8*(3*a^5 - 6*a^3* 
b^2 - a*b^4)*x/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - 1/8*(4*a^2*b*tan(x)^2 
 - (3*a^3 - a*b^2)*tan(x)^3 + 6*a^2*b + 2*b^3 - (5*a^3 + a*b^2)*tan(x))/(( 
a^4 + 2*a^2*b^2 + b^4)*tan(x)^4 + a^4 + 2*a^2*b^2 + b^4 + 2*(a^4 + 2*a^2*b 
^2 + b^4)*tan(x)^2)
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 270 vs. \(2 (120) = 240\).

Time = 0.15 (sec) , antiderivative size = 270, normalized size of antiderivative = 2.14 \[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=-\frac {a^{5} b \log \left ({\left | a \tan \left (x\right ) + b \right |}\right )}{a^{7} + 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} + a b^{6}} + \frac {a^{4} b \log \left (\tan \left (x\right )^{2} + 1\right )}{2 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} + \frac {{\left (3 \, a^{5} - 6 \, a^{3} b^{2} - a b^{4}\right )} x}{8 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )}} - \frac {6 \, a^{4} b \tan \left (x\right )^{4} - 3 \, a^{5} \tan \left (x\right )^{3} - 2 \, a^{3} b^{2} \tan \left (x\right )^{3} + a b^{4} \tan \left (x\right )^{3} + 16 \, a^{4} b \tan \left (x\right )^{2} + 4 \, a^{2} b^{3} \tan \left (x\right )^{2} - 5 \, a^{5} \tan \left (x\right ) - 6 \, a^{3} b^{2} \tan \left (x\right ) - a b^{4} \tan \left (x\right ) + 12 \, a^{4} b + 8 \, a^{2} b^{3} + 2 \, b^{5}}{8 \, {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} {\left (\tan \left (x\right )^{2} + 1\right )}^{2}} \] Input:

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

Output:

-a^5*b*log(abs(a*tan(x) + b))/(a^7 + 3*a^5*b^2 + 3*a^3*b^4 + a*b^6) + 1/2* 
a^4*b*log(tan(x)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 1/8*(3*a^5 - 
 6*a^3*b^2 - a*b^4)*x/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - 1/8*(6*a^4*b*t 
an(x)^4 - 3*a^5*tan(x)^3 - 2*a^3*b^2*tan(x)^3 + a*b^4*tan(x)^3 + 16*a^4*b* 
tan(x)^2 + 4*a^2*b^3*tan(x)^2 - 5*a^5*tan(x) - 6*a^3*b^2*tan(x) - a*b^4*ta 
n(x) + 12*a^4*b + 8*a^2*b^3 + 2*b^5)/((a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6)* 
(tan(x)^2 + 1)^2)
 

Mupad [B] (verification not implemented)

Time = 9.48 (sec) , antiderivative size = 279, normalized size of antiderivative = 2.21 \[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=-\frac {\frac {3\,a^2\,b+b^3}{4\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {{\mathrm {tan}\left (x\right )}^3\,\left (a\,b^2-3\,a^3\right )}{8\,\left (a^4+2\,a^2\,b^2+b^4\right )}-\frac {a\,\mathrm {tan}\left (x\right )\,\left (5\,a^2+b^2\right )}{8\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {a^2\,b\,{\mathrm {tan}\left (x\right )}^2}{2\,\left (a^4+2\,a^2\,b^2+b^4\right )}}{{\mathrm {tan}\left (x\right )}^4+2\,{\mathrm {tan}\left (x\right )}^2+1}+\frac {\ln \left (\mathrm {tan}\left (x\right )-\mathrm {i}\right )\,\left (-3\,a^2+a\,b\,1{}\mathrm {i}\right )}{16\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )}+\frac {\ln \left (\mathrm {tan}\left (x\right )+1{}\mathrm {i}\right )\,\left (a\,b-a^2\,3{}\mathrm {i}\right )}{16\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}-\frac {a^4\,b\,\ln \left (b+a\,\mathrm {tan}\left (x\right )\right )}{a^6+3\,a^4\,b^2+3\,a^2\,b^4+b^6} \] Input:

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

Output:

(log(tan(x) - 1i)*(a*b*1i - 3*a^2))/(16*(a*b^2*3i - 3*a^2*b - a^3*1i + b^3 
)) - ((3*a^2*b + b^3)/(4*(a^4 + b^4 + 2*a^2*b^2)) + (tan(x)^3*(a*b^2 - 3*a 
^3))/(8*(a^4 + b^4 + 2*a^2*b^2)) - (a*tan(x)*(5*a^2 + b^2))/(8*(a^4 + b^4 
+ 2*a^2*b^2)) + (a^2*b*tan(x)^2)/(2*(a^4 + b^4 + 2*a^2*b^2)))/(2*tan(x)^2 
+ tan(x)^4 + 1) + (log(tan(x) + 1i)*(a*b - a^2*3i))/(16*(3*a*b^2 - a^2*b*3 
i - a^3 + b^3*1i)) - (a^4*b*log(b + a*tan(x)))/(a^6 + b^6 + 3*a^2*b^4 + 3* 
a^4*b^2)
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 242, normalized size of antiderivative = 1.92 \[ \int \frac {\cos ^4(x)}{a+b \cot (x)} \, dx=\frac {-2 \cos \left (x \right ) \sin \left (x \right )^{3} a^{5}-4 \cos \left (x \right ) \sin \left (x \right )^{3} a^{3} b^{2}-2 \cos \left (x \right ) \sin \left (x \right )^{3} a \,b^{4}+5 \cos \left (x \right ) \sin \left (x \right ) a^{5}+6 \cos \left (x \right ) \sin \left (x \right ) a^{3} b^{2}+\cos \left (x \right ) \sin \left (x \right ) a \,b^{4}+8 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )^{2}+1\right ) a^{4} b -8 \,\mathrm {log}\left (\tan \left (\frac {x}{2}\right )^{2} b -2 \tan \left (\frac {x}{2}\right ) a -b \right ) a^{4} b -2 \sin \left (x \right )^{4} a^{4} b -4 \sin \left (x \right )^{4} a^{2} b^{3}-2 \sin \left (x \right )^{4} b^{5}+8 \sin \left (x \right )^{2} a^{4} b +12 \sin \left (x \right )^{2} a^{2} b^{3}+4 \sin \left (x \right )^{2} b^{5}+3 a^{5} x -8 a^{4} b -6 a^{3} b^{2} x -12 a^{2} b^{3}-a \,b^{4} x -4 b^{5}}{8 a^{6}+24 a^{4} b^{2}+24 a^{2} b^{4}+8 b^{6}} \] Input:

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

Output:

( - 2*cos(x)*sin(x)**3*a**5 - 4*cos(x)*sin(x)**3*a**3*b**2 - 2*cos(x)*sin( 
x)**3*a*b**4 + 5*cos(x)*sin(x)*a**5 + 6*cos(x)*sin(x)*a**3*b**2 + cos(x)*s 
in(x)*a*b**4 + 8*log(tan(x/2)**2 + 1)*a**4*b - 8*log(tan(x/2)**2*b - 2*tan 
(x/2)*a - b)*a**4*b - 2*sin(x)**4*a**4*b - 4*sin(x)**4*a**2*b**3 - 2*sin(x 
)**4*b**5 + 8*sin(x)**2*a**4*b + 12*sin(x)**2*a**2*b**3 + 4*sin(x)**2*b**5 
 + 3*a**5*x - 8*a**4*b - 6*a**3*b**2*x - 12*a**2*b**3 - a*b**4*x - 4*b**5) 
/(8*(a**6 + 3*a**4*b**2 + 3*a**2*b**4 + b**6))