\(\int \cos (x) \log (\cos (x)) \, dx\) [189]

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

Optimal result

Integrand size = 6, antiderivative size = 14 \[ \int \cos (x) \log (\cos (x)) \, dx=\text {arctanh}(\sin (x))-\sin (x)+\log (\cos (x)) \sin (x) \]

[Out]

arctanh(sin(x))-sin(x)+ln(cos(x))*sin(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.833, Rules used = {2717, 2634, 2672, 327, 212} \[ \int \cos (x) \log (\cos (x)) \, dx=\text {arctanh}(\sin (x))-\sin (x)+\sin (x) \log (\cos (x)) \]

[In]

Int[Cos[x]*Log[Cos[x]],x]

[Out]

ArcTanh[Sin[x]] - Sin[x] + Log[Cos[x]]*Sin[x]

Rule 212

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

Rule 327

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

Rule 2634

Int[Log[u_]*(v_), x_Symbol] :> With[{w = IntHide[v, x]}, Dist[Log[u], w, x] - Int[SimplifyIntegrand[w*(D[u, x]
/u), x], x] /; InverseFunctionFreeQ[w, x]] /; InverseFunctionFreeQ[u, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \log (\cos (x)) \sin (x)+\int \sin (x) \tan (x) \, dx \\ & = \log (\cos (x)) \sin (x)+\text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\sin (x)\right ) \\ & = -\sin (x)+\log (\cos (x)) \sin (x)+\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (x)\right ) \\ & = \tanh ^{-1}(\sin (x))-\sin (x)+\log (\cos (x)) \sin (x) \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(43\) vs. \(2(14)=28\).

Time = 0.01 (sec) , antiderivative size = 43, normalized size of antiderivative = 3.07 \[ \int \cos (x) \log (\cos (x)) \, dx=-\log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )+\log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )-\sin (x)+\log (\cos (x)) \sin (x) \]

[In]

Integrate[Cos[x]*Log[Cos[x]],x]

[Out]

-Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + Sin[x/2]] - Sin[x] + Log[Cos[x]]*Sin[x]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(34\) vs. \(2(14)=28\).

Time = 1.14 (sec) , antiderivative size = 35, normalized size of antiderivative = 2.50

method result size
parallelrisch \(\ln \left (\cos \left (x \right )\right ) \sin \left (x \right )+\ln \left (\frac {2}{\cos \left (x \right )+1}\right )+\ln \left (\cos \left (x \right )\right )-\sin \left (x \right )-2 \ln \left (-\cot \left (x \right )+\csc \left (x \right )-1\right )\) \(35\)
default \(-\frac {i \left ({\mathrm e}^{i x} \ln \left (\left (1+{\mathrm e}^{2 i x}\right ) {\mathrm e}^{-i x}\right )-{\mathrm e}^{i x}+4 \arctan \left ({\mathrm e}^{i x}\right )-{\mathrm e}^{-i x} \ln \left (\left (1+{\mathrm e}^{2 i x}\right ) {\mathrm e}^{-i x}\right )+{\mathrm e}^{-i x}-\ln \left (2\right ) \left ({\mathrm e}^{i x}-{\mathrm e}^{-i x}\right )\right )}{2}\) \(93\)
risch \(-\ln \left ({\mathrm e}^{i x}\right ) \sin \left (x \right )-\frac {{\mathrm e}^{i x} \pi \,\operatorname {csgn}\left (i {\mathrm e}^{-i x}\right ) \operatorname {csgn}\left (i+i {\mathrm e}^{2 i x}\right ) \operatorname {csgn}\left (i \cos \left (x \right )\right )}{4}+\frac {{\mathrm e}^{i x} \pi \,\operatorname {csgn}\left (i {\mathrm e}^{-i x}\right ) \operatorname {csgn}\left (i \cos \left (x \right )\right )^{2}}{4}+\frac {{\mathrm e}^{i x} \pi \,\operatorname {csgn}\left (i+i {\mathrm e}^{2 i x}\right ) \operatorname {csgn}\left (i \cos \left (x \right )\right )^{2}}{4}-\frac {{\mathrm e}^{i x} \pi \operatorname {csgn}\left (i \cos \left (x \right )\right )^{3}}{4}+\frac {{\mathrm e}^{-i x} \pi \,\operatorname {csgn}\left (i {\mathrm e}^{-i x}\right ) \operatorname {csgn}\left (i+i {\mathrm e}^{2 i x}\right ) \operatorname {csgn}\left (i \cos \left (x \right )\right )}{4}-\frac {{\mathrm e}^{-i x} \pi \,\operatorname {csgn}\left (i {\mathrm e}^{-i x}\right ) \operatorname {csgn}\left (i \cos \left (x \right )\right )^{2}}{4}-\frac {{\mathrm e}^{-i x} \pi \,\operatorname {csgn}\left (i+i {\mathrm e}^{2 i x}\right ) \operatorname {csgn}\left (i \cos \left (x \right )\right )^{2}}{4}+\frac {{\mathrm e}^{-i x} \pi \operatorname {csgn}\left (i \cos \left (x \right )\right )^{3}}{4}+\frac {i {\mathrm e}^{-i x} \ln \left (1+{\mathrm e}^{2 i x}\right )}{2}-\frac {i {\mathrm e}^{-i x}}{2}-\frac {i {\mathrm e}^{i x} \ln \left (1+{\mathrm e}^{2 i x}\right )}{2}+\frac {i {\mathrm e}^{i x}}{2}+\ln \left ({\mathrm e}^{i x}+i\right )-\ln \left ({\mathrm e}^{i x}-i\right )-\frac {i {\mathrm e}^{-i x} \ln \left (2\right )}{2}+\frac {i {\mathrm e}^{i x} \ln \left (2\right )}{2}\) \(308\)

[In]

int(cos(x)*ln(cos(x)),x,method=_RETURNVERBOSE)

[Out]

ln(cos(x))*sin(x)+ln(2/(cos(x)+1))+ln(cos(x))-sin(x)-2*ln(-cot(x)+csc(x)-1)

Fricas [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.93 \[ \int \cos (x) \log (\cos (x)) \, dx=\log \left (\cos \left (x\right )\right ) \sin \left (x\right ) + \frac {1}{2} \, \log \left (\sin \left (x\right ) + 1\right ) - \frac {1}{2} \, \log \left (-\sin \left (x\right ) + 1\right ) - \sin \left (x\right ) \]

[In]

integrate(cos(x)*log(cos(x)),x, algorithm="fricas")

[Out]

log(cos(x))*sin(x) + 1/2*log(sin(x) + 1) - 1/2*log(-sin(x) + 1) - sin(x)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 223 vs. \(2 (15) = 30\).

Time = 0.82 (sec) , antiderivative size = 223, normalized size of antiderivative = 15.93 \[ \int \cos (x) \log (\cos (x)) \, dx=- \frac {\log {\left (- \frac {\tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} + \frac {1}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} \right )} \tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} + \frac {2 \log {\left (- \frac {\tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} + \frac {1}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} \right )} \tan {\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} - \frac {\log {\left (- \frac {\tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} + \frac {1}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} + \frac {2 \log {\left (\tan {\left (\frac {x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} + \frac {2 \log {\left (\tan {\left (\frac {x}{2} \right )} + 1 \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} - \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} - \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} - \frac {2 \tan {\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} \]

[In]

integrate(cos(x)*ln(cos(x)),x)

[Out]

-log(-tan(x/2)**2/(tan(x/2)**2 + 1) + 1/(tan(x/2)**2 + 1))*tan(x/2)**2/(tan(x/2)**2 + 1) + 2*log(-tan(x/2)**2/
(tan(x/2)**2 + 1) + 1/(tan(x/2)**2 + 1))*tan(x/2)/(tan(x/2)**2 + 1) - log(-tan(x/2)**2/(tan(x/2)**2 + 1) + 1/(
tan(x/2)**2 + 1))/(tan(x/2)**2 + 1) + 2*log(tan(x/2) + 1)*tan(x/2)**2/(tan(x/2)**2 + 1) + 2*log(tan(x/2) + 1)/
(tan(x/2)**2 + 1) - log(tan(x/2)**2 + 1)*tan(x/2)**2/(tan(x/2)**2 + 1) - log(tan(x/2)**2 + 1)/(tan(x/2)**2 + 1
) - 2*tan(x/2)/(tan(x/2)**2 + 1)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 108 vs. \(2 (14) = 28\).

Time = 0.20 (sec) , antiderivative size = 108, normalized size of antiderivative = 7.71 \[ \int \cos (x) \log (\cos (x)) \, dx=\frac {2 \, \log \left (-\frac {\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} - 1}{\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1}\right ) \sin \left (x\right )}{{\left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right )} {\left (\cos \left (x\right ) + 1\right )}} - \frac {2 \, \sin \left (x\right )}{{\left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right )} {\left (\cos \left (x\right ) + 1\right )}} + \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1\right ) - \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} - 1\right ) \]

[In]

integrate(cos(x)*log(cos(x)),x, algorithm="maxima")

[Out]

2*log(-(sin(x)^2/(cos(x) + 1)^2 - 1)/(sin(x)^2/(cos(x) + 1)^2 + 1))*sin(x)/((sin(x)^2/(cos(x) + 1)^2 + 1)*(cos
(x) + 1)) - 2*sin(x)/((sin(x)^2/(cos(x) + 1)^2 + 1)*(cos(x) + 1)) + log(sin(x)/(cos(x) + 1) + 1) - log(sin(x)/
(cos(x) + 1) - 1)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.93 \[ \int \cos (x) \log (\cos (x)) \, dx=\log \left (\cos \left (x\right )\right ) \sin \left (x\right ) + \frac {1}{2} \, \log \left (\sin \left (x\right ) + 1\right ) - \frac {1}{2} \, \log \left (-\sin \left (x\right ) + 1\right ) - \sin \left (x\right ) \]

[In]

integrate(cos(x)*log(cos(x)),x, algorithm="giac")

[Out]

log(cos(x))*sin(x) + 1/2*log(sin(x) + 1) - 1/2*log(-sin(x) + 1) - sin(x)

Mupad [F(-1)]

Timed out. \[ \int \cos (x) \log (\cos (x)) \, dx=\int \ln \left (\cos \left (x\right )\right )\,\cos \left (x\right ) \,d x \]

[In]

int(log(cos(x))*cos(x),x)

[Out]

int(log(cos(x))*cos(x), x)