\(\int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx\) [19]

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

Optimal result

Integrand size = 17, antiderivative size = 11 \[ \int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx=-\log \left (1+\frac {\cos (x)}{x}\right ) \]

[Out]

-ln(1+cos(x)/x)

Rubi [A] (verified)

Time = 0.26 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {6844, 31} \[ \int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx=-\log \left (\frac {\cos (x)}{x}+1\right ) \]

[In]

Int[(Cos[x] + x*Sin[x])/(x*(x + Cos[x])),x]

[Out]

-Log[1 + Cos[x]/x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 6844

Int[(u_)*(v_)^(r_.)*((a_.)*(v_)^(p_.) + (b_.)*(w_)^(q_.))^(m_.), x_Symbol] :> With[{c = Simplify[u/(p*w*D[v, x
] - q*v*D[w, x])]}, Dist[(-c)*q, Subst[Int[(a + b*x^q)^m, x], x, v^(m*p + r + 1)*w], x] /; FreeQ[c, x]] /; Fre
eQ[{a, b, m, p, q, r}, x] && EqQ[p + q*(m*p + r + 1), 0] && IntegerQ[q] && IntegerQ[m]

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

Mathematica [A] (verified)

Time = 0.16 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.91 \[ \int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx=\log (x)-\log (x+\cos (x)) \]

[In]

Integrate[(Cos[x] + x*Sin[x])/(x*(x + Cos[x])),x]

[Out]

Log[x] - Log[x + Cos[x]]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(24\) vs. \(2(11)=22\).

Time = 0.21 (sec) , antiderivative size = 25, normalized size of antiderivative = 2.27

method result size
parallelrisch \(-\ln \left (\frac {x +\cos \left (x \right )}{1+\cos \left (x \right )}\right )+\ln \left (x \right )+\ln \left (\frac {1}{1+\cos \left (x \right )}\right )\) \(25\)
risch \(i x +\ln \left (x \right )-\ln \left (2 x \,{\mathrm e}^{i x}+{\mathrm e}^{2 i x}+1\right )\) \(26\)
norman \(-\ln \left (x \tan \left (\frac {x}{2}\right )^{2}-\tan \left (\frac {x}{2}\right )^{2}+x +1\right )+\ln \left (x \right )+\ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )\) \(35\)

[In]

int((cos(x)+x*sin(x))/x/(x+cos(x)),x,method=_RETURNVERBOSE)

[Out]

-ln((x+cos(x))/(1+cos(x)))+ln(x)+ln(1/(1+cos(x)))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.91 \[ \int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx=-\log \left (x + \cos \left (x\right )\right ) + \log \left (x\right ) \]

[In]

integrate((cos(x)+x*sin(x))/x/(x+cos(x)),x, algorithm="fricas")

[Out]

-log(x + cos(x)) + log(x)

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.73 \[ \int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx=\log {\left (x \right )} - \log {\left (x + \cos {\left (x \right )} \right )} \]

[In]

integrate((cos(x)+x*sin(x))/x/(x+cos(x)),x)

[Out]

log(x) - log(x + cos(x))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 65 vs. \(2 (11) = 22\).

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

[In]

integrate((cos(x)+x*sin(x))/x/(x+cos(x)),x, algorithm="maxima")

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 79 vs. \(2 (11) = 22\).

Time = 0.29 (sec) , antiderivative size = 79, normalized size of antiderivative = 7.18 \[ \int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx=-\frac {1}{2} \, \log \left (\frac {4 \, {\left (x^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, x \tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, x^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + \tan \left (\frac {1}{2} \, x\right )^{4} + x^{2} - 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, x + 1\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) + \log \left ({\left | x \right |}\right ) \]

[In]

integrate((cos(x)+x*sin(x))/x/(x+cos(x)),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.91 \[ \int \frac {\cos (x)+x \sin (x)}{x (x+\cos (x))} \, dx=\ln \left (x\right )-\ln \left (x+\cos \left (x\right )\right ) \]

[In]

int((cos(x) + x*sin(x))/(x*(x + cos(x))),x)

[Out]

log(x) - log(x + cos(x))