3.7.43 \(\int \frac {\log (\cos (\frac {x}{2}))}{1+\cos (x)} \, dx\) [643]

Optimal. Leaf size=28 \[ -\frac {x}{2}+\frac {\log \left (\cos \left (\frac {x}{2}\right )\right ) \sin (x)}{1+\cos (x)}+\tan \left (\frac {x}{2}\right ) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 5, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {2727, 2634, 12, 3554, 8} \begin {gather*} -\frac {x}{2}+\tan \left (\frac {x}{2}\right )+\frac {\sin (x) \log \left (\cos \left (\frac {x}{2}\right )\right )}{\cos (x)+1} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Log[Cos[x/2]]/(1 + Cos[x]),x]

[Out]

-1/2*x + (Log[Cos[x/2]]*Sin[x])/(1 + Cos[x]) + Tan[x/2]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, 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 2727

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

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.05, size = 32, normalized size = 1.14 \begin {gather*} -\frac {\left (x \cot \left (\frac {x}{2}\right )-2 \left (1+\log \left (\cos \left (\frac {x}{2}\right )\right )\right )\right ) \sin (x)}{2 (1+\cos (x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Log[Cos[x/2]]/(1 + Cos[x]),x]

[Out]

-1/2*((x*Cot[x/2] - 2*(1 + Log[Cos[x/2]]))*Sin[x])/(1 + Cos[x])

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 9 vs. order 3.
time = 0.15, size = 164, normalized size = 5.86

method result size
risch \(-\frac {2 i \ln \left ({\mathrm e}^{\frac {i x}{2}}\right )}{1+{\mathrm e}^{i x}}+\frac {\pi \,\mathrm {csgn}\left (i \left (1+{\mathrm e}^{i x}\right )\right ) \mathrm {csgn}\left (i {\mathrm e}^{-\frac {i x}{2}}\right ) \mathrm {csgn}\left (i \cos \left (\frac {x}{2}\right )\right )-\pi \,\mathrm {csgn}\left (i \left (1+{\mathrm e}^{i x}\right )\right ) \mathrm {csgn}\left (i \cos \left (\frac {x}{2}\right )\right )^{2}-\pi \,\mathrm {csgn}\left (i {\mathrm e}^{-\frac {i x}{2}}\right ) \mathrm {csgn}\left (i \cos \left (\frac {x}{2}\right )\right )^{2}+\pi \mathrm {csgn}\left (i \cos \left (\frac {x}{2}\right )\right )^{3}-i \ln \left (1+{\mathrm e}^{i x}\right ) {\mathrm e}^{i x}-x \,{\mathrm e}^{i x}-2 i \ln \left (2\right )+i \ln \left (1+{\mathrm e}^{i x}\right )+2 i-x}{1+{\mathrm e}^{i x}}\) \(164\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(ln(cos(1/2*x))/(1+cos(x)),x,method=_RETURNVERBOSE)

[Out]

-2*I/(1+exp(I*x))*ln(exp(1/2*I*x))+(Pi*csgn(I*(1+exp(I*x)))*csgn(I*exp(-1/2*I*x))*csgn(I*cos(1/2*x))-Pi*csgn(I
*(1+exp(I*x)))*csgn(I*cos(1/2*x))^2-Pi*csgn(I*exp(-1/2*I*x))*csgn(I*cos(1/2*x))^2+Pi*csgn(I*cos(1/2*x))^3-I*ln
(1+exp(I*x))*exp(I*x)-x*exp(I*x)-2*I*ln(2)+I*ln(1+exp(I*x))+2*I-x)/(1+exp(I*x))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 56 vs. \(2 (22) = 44\).
time = 2.34, size = 56, normalized size = 2.00 \begin {gather*} \frac {\log \left (\cos \left (\frac {1}{2} \, x\right )\right ) \sin \left (x\right )}{\cos \left (x\right ) + 1} - \frac {x \cos \left (x\right )^{2} + x \sin \left (x\right )^{2} + 2 \, x \cos \left (x\right ) + x - 4 \, \sin \left (x\right )}{2 \, {\left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \cos \left (x\right ) + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(log(cos(1/2*x))/(1+cos(x)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.49, size = 32, normalized size = 1.14 \begin {gather*} -\frac {x \cos \left (\frac {1}{2} \, x\right ) - 2 \, \log \left (\cos \left (\frac {1}{2} \, x\right )\right ) \sin \left (\frac {1}{2} \, x\right ) - 2 \, \sin \left (\frac {1}{2} \, x\right )}{2 \, \cos \left (\frac {1}{2} \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(log(cos(1/2*x))/(1+cos(x)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\log {\left (\cos {\left (\frac {x}{2} \right )} \right )}}{\cos {\left (x \right )} + 1}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(ln(cos(1/2*x))/(1+cos(x)),x)

[Out]

Integral(log(cos(x/2))/(cos(x) + 1), x)

________________________________________________________________________________________

Giac [A]
time = 1.25, size = 43, normalized size = 1.54 \begin {gather*} -\frac {1}{2} \, x - \frac {2 \, \log \left (\cos \left (\frac {1}{2} \, x\right )\right ) \tan \left (\frac {1}{2} \, x\right )}{{\left (x^{2} + 1\right )} {\left (\frac {x^{2} - 1}{x^{2} + 1} - 1\right )}} + \tan \left (\frac {1}{2} \, x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(log(cos(1/2*x))/(1+cos(x)),x, algorithm="giac")

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.58, size = 39, normalized size = 1.39 \begin {gather*} \mathrm {tan}\left (\frac {x}{2}\right )-x+\mathrm {tan}\left (\frac {x}{2}\right )\,\ln \left (\cos \left (\frac {x}{2}\right )\right )+\ln \left (\cos \left (\frac {x}{2}\right )\right )\,1{}\mathrm {i}-\ln \left (\cos \left (x\right )+1+\sin \left (x\right )\,1{}\mathrm {i}\right )\,1{}\mathrm {i} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(log(cos(x/2))/(cos(x) + 1),x)

[Out]

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

________________________________________________________________________________________