3.1.40 \(\int \frac {\log (\sin (x))}{1+\sin (x)} \, dx\) [40]

Optimal. Leaf size=22 \[ -x-\tanh ^{-1}(\cos (x))-\frac {\cos (x) \log (\sin (x))}{1+\sin (x)} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 22, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 5, integrand size = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {2727, 2634, 2918, 3855, 8} \begin {gather*} -x-\tanh ^{-1}(\cos (x))-\frac {\cos (x) \log (\sin (x))}{\sin (x)+1} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Log[Sin[x]]/(1 + Sin[x]),x]

[Out]

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

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, 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 2918

Int[((cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.))/((a_) + (b_.)*sin[(e_.) + (f_
.)*(x_)]), x_Symbol] :> Dist[g^2/a, Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^n, x], x] - Dist[g^2/(b*d),
Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && EqQ[a^2
 - b^2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \frac {\log (\sin (x))}{1+\sin (x)} \, dx &=-\frac {\cos (x) \log (\sin (x))}{1+\sin (x)}+\int \frac {\cos (x) \cot (x)}{1+\sin (x)} \, dx\\ &=-\frac {\cos (x) \log (\sin (x))}{1+\sin (x)}-\int 1 \, dx+\int \csc (x) \, dx\\ &=-x-\tanh ^{-1}(\cos (x))-\frac {\cos (x) \log (\sin (x))}{1+\sin (x)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.03, size = 39, normalized size = 1.77 \begin {gather*} -x-2 \log \left (\cos \left (\frac {x}{2}\right )\right )+\frac {2 \log (\sin (x)) \sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Log[Sin[x]]/(1 + Sin[x]),x]

[Out]

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

________________________________________________________________________________________

Mathics [B] Leaf count is larger than twice the leaf count of optimal. \(73\) vs. \(2(22)=44\).
time = 3.53, size = 61, normalized size = 2.77 \begin {gather*} \frac {-x-x \text {Tan}\left [\frac {x}{2}\right ]+\text {Log}\left [\frac {2}{1+\text {Cos}\left [x\right ]}\right ]+2 \text {Log}\left [\frac {\text {Sin}\left [x\right ]}{2}\right ] \text {Tan}\left [\frac {x}{2}\right ]+\text {Log}\left [4\right ] \text {Tan}\left [\frac {x}{2}\right ]+\text {Log}\left [\frac {2}{1+\text {Cos}\left [x\right ]}\right ] \text {Tan}\left [\frac {x}{2}\right ]}{1+\text {Tan}\left [\frac {x}{2}\right ]} \end {gather*}

Antiderivative was successfully verified.

[In]

mathics('Integrate[Log[Sin[x]]/(1 + Sin[x]),x]')

[Out]

(-x - x Tan[x / 2] + Log[2 / (1 + Cos[x])] + 2 Log[Sin[x] / 2] Tan[x / 2] + Log[4] Tan[x / 2] + Log[2 / (1 + C
os[x])] Tan[x / 2]) / (1 + Tan[x / 2])

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(53\) vs. \(2(22)=44\).
time = 0.21, size = 54, normalized size = 2.45

method result size
norman \(\frac {-x -x \tan \left (\frac {x}{2}\right )+2 \tan \left (\frac {x}{2}\right ) \ln \left (\frac {2 \tan \left (\frac {x}{2}\right )}{1+\tan ^{2}\left (\frac {x}{2}\right )}\right )}{1+\tan \left (\frac {x}{2}\right )}+\ln \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )\) \(54\)
risch \(\frac {2 \ln \left ({\mathrm e}^{i x}\right )}{{\mathrm e}^{i x}+i}+\frac {-2 \ln \left ({\mathrm e}^{2 i x}-1\right )+\ln \left (1+{\mathrm e}^{i x}\right )+\ln \left ({\mathrm e}^{i x}-1\right )+i \pi -i \ln \left (1+{\mathrm e}^{i x}\right ) {\mathrm e}^{i x}-2 i x +i \pi \,\mathrm {csgn}\left (\sin \left (x \right )\right ) \mathrm {csgn}\left (i \sin \left (x \right )\right )^{2}-i \pi \mathrm {csgn}\left (\sin \left (x \right )\right )^{3}-\ln \left (1+{\mathrm e}^{i x}\right ) {\mathrm e}^{i x}+\ln \left ({\mathrm e}^{i x}-1\right ) {\mathrm e}^{i x}-2 x \,{\mathrm e}^{i x}-i \pi \,\mathrm {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) \mathrm {csgn}\left (i {\mathrm e}^{-i x}\right ) \mathrm {csgn}\left (\sin \left (x \right )\right )-i \pi \,\mathrm {csgn}\left (i {\mathrm e}^{-i x}\right ) \mathrm {csgn}\left (\sin \left (x \right )\right )^{2}-i \ln \left (1+{\mathrm e}^{i x}\right )+i \pi \mathrm {csgn}\left (i \sin \left (x \right )\right )^{3}-i \pi \mathrm {csgn}\left (i \sin \left (x \right )\right )^{2}-i \pi \,\mathrm {csgn}\left (\sin \left (x \right )\right ) \mathrm {csgn}\left (i \sin \left (x \right )\right )+i \ln \left ({\mathrm e}^{i x}-1\right )-i \pi \,\mathrm {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) \mathrm {csgn}\left (\sin \left (x \right )\right )^{2}-i \ln \left ({\mathrm e}^{i x}-1\right ) {\mathrm e}^{i x}+2 \ln \left (2\right )}{{\mathrm e}^{i x}+i}\) \(287\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(ln(sin(x))/(sin(x)+1),x,method=_RETURNVERBOSE)

[Out]

(-x-x*tan(1/2*x)+2*tan(1/2*x)*ln(2*tan(1/2*x)/(1+tan(1/2*x)^2)))/(1+tan(1/2*x))+ln(1+tan(1/2*x)^2)

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 82 vs. \(2 (22) = 44\).
time = 0.38, size = 82, normalized size = 3.73 \begin {gather*} -\frac {2 \, \log \left (\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 )}}\right )}{\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1} - 2 \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) + 2 \, \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) - \log \left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(log(sin(x))/(1+sin(x)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(log(sin(x))/(1+sin(x)),x, algorithm="fricas")

[Out]

-1/2*(4*(cos(x) + sin(x) + 1)*arctan(-(cos(x) + sin(x) + 1)/(cos(x) - sin(x) + 1)) + 4*x*cos(x) + (cos(x) + si
n(x) + 1)*log(1/2*cos(x) + 1/2) - (cos(x) + sin(x) + 1)*log(-1/2*cos(x) + 1/2) + 2*(cos(x) - sin(x) + 1)*log(s
in(x)) + 4*x*sin(x) + 4*x)/(cos(x) + sin(x) + 1)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 105 vs. \(2 (20) = 40\)
time = 0.67, size = 105, normalized size = 4.77 \begin {gather*} - \frac {x \tan {\left (\frac {x}{2} \right )}}{\tan {\left (\frac {x}{2} \right )} + 1} - \frac {x}{\tan {\left (\frac {x}{2} \right )} + 1} + \frac {2 \log {\left (\frac {\tan {\left (\frac {x}{2} \right )}}{\tan ^{2}{\left (\frac {x}{2} \right )} + 1} \right )} \tan {\left (\frac {x}{2} \right )}}{\tan {\left (\frac {x}{2} \right )} + 1} + \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )} \tan {\left (\frac {x}{2} \right )}}{\tan {\left (\frac {x}{2} \right )} + 1} + \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{\tan {\left (\frac {x}{2} \right )} + 1} + \frac {2 \log {\left (2 \right )} \tan {\left (\frac {x}{2} \right )}}{\tan {\left (\frac {x}{2} \right )} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(ln(sin(x))/(1+sin(x)),x)

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.01, size = 55, normalized size = 2.50 \begin {gather*} -\frac {2 \ln \left (\sin x\right )}{\tan \left (\frac {x}{2}\right )+1}+2\cdot 2\cdot 2 \left (\frac {\ln \left |\tan \left (\frac {x}{2\cdot 2}\right )\right |}{4}-\frac {\ln \left (\tan ^{2}\left (\frac {x}{2\cdot 2}\right )+1\right )}{4}-\frac {x}{4\cdot 2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(log(sin(x))/(1+sin(x)),x)

[Out]

-x - 2*log(sin(x))/(tan(1/2*x) + 1) - 2*log(tan(1/4*x)^2 + 1) + 2*log(abs(tan(1/4*x)))

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(log(sin(x))/(sin(x) + 1),x)

[Out]

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

________________________________________________________________________________________