\(\int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx\) [492]

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

Optimal result

Integrand size = 18, antiderivative size = 12 \[ \int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx=\frac {2}{1+\frac {\cot (x)}{x}} \]

[Out]

2/(1+cot(x)/x)

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 12, 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.111, Rules used = {6843, 32} \[ \int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx=\frac {2}{\frac {\cot (x)}{x}+1} \]

[In]

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

[Out]

2/(1 + Cot[x]/x)

Rule 32

Int[((a_.) + (b_.)*(x_))^(m_), x_Symbol] :> Simp[(a + b*x)^(m + 1)/(b*(m + 1)), x] /; FreeQ[{a, b, m}, x] && N
eQ[m, -1]

Rule 6843

Int[(u_)*((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*p, Subst[Int[(b + a*x^p)^m, x], x, v*w^(m*q + 1)], x] /; FreeQ[c, x]] /; FreeQ[{a, b, m, p, q}
, x] && EqQ[p + q*(m*p + 1), 0] && IntegerQ[p] && IntegerQ[m]

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

Mathematica [A] (verified)

Time = 0.23 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.17 \[ \int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx=\frac {2 x \sin (x)}{\cos (x)+x \sin (x)} \]

[In]

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

[Out]

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

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 3.05 (sec) , antiderivative size = 44, normalized size of antiderivative = 3.67

method result size
risch \(-\frac {2 i}{x +i}-\frac {4 i x}{\left (x +i\right ) \left (x \,{\mathrm e}^{2 i x}-x +i {\mathrm e}^{2 i x}+i\right )}\) \(44\)

[In]

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

[Out]

-2*I/(x+I)-4*I*x/(x+I)/(x*exp(2*I*x)-x+I*exp(2*I*x)+I)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 13, normalized size of antiderivative = 1.08 \[ \int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx=-\frac {2 \, \cos \left (x\right )}{x \sin \left (x\right ) + \cos \left (x\right )} \]

[In]

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

[Out]

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

Sympy [F]

\[ \int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx=\int \frac {2 x + \sin {\left (2 x \right )}}{\left (x \sin {\left (x \right )} + \cos {\left (x \right )}\right )^{2}}\, dx \]

[In]

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

[Out]

Integral((2*x + sin(2*x))/(x*sin(x) + cos(x))**2, x)

Maxima [B] (verification not implemented)

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

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.83 \[ \int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx=-\frac {2}{x \tan \left (x\right ) + 1} \]

[In]

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

[Out]

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

Mupad [F(-1)]

Timed out. \[ \int \frac {2 x+\sin (2 x)}{(\cos (x)+x \sin (x))^2} \, dx=\int \frac {2\,x+\sin \left (2\,x\right )}{{\left (\cos \left (x\right )+x\,\sin \left (x\right )\right )}^2} \,d x \]

[In]

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

[Out]

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