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

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

Optimal result

Integrand size = 11, antiderivative size = 8 \[ \int \frac {x+\sin (x)}{1+\cos (x)} \, dx=x \tan \left (\frac {x}{2}\right ) \]

[Out]

x*tan(1/2*x)

Rubi [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(25\) vs. \(2(8)=16\).

Time = 0.07 (sec) , antiderivative size = 25, normalized size of antiderivative = 3.12, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.545, Rules used = {4462, 3399, 4269, 3556, 2746, 31} \[ \int \frac {x+\sin (x)}{1+\cos (x)} \, dx=x \tan \left (\frac {x}{2}\right )+2 \log \left (\cos \left (\frac {x}{2}\right )\right )-\log (\cos (x)+1) \]

[In]

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

[Out]

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

Rule 31

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

Rule 2746

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^(m + (p - 1)/2)*(a - x)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& IntegerQ[(p - 1)/2] && EqQ[a^2 - b^2, 0] && (GeQ[p, -1] ||  !IntegerQ[m + 1/2])

Rule 3399

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(2*a)^n, Int[(c
 + d*x)^m*Sin[(1/2)*(e + Pi*(a/(2*b))) + f*(x/2)]^(2*n), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && EqQ[a^2
- b^2, 0] && IntegerQ[n] && (GtQ[n, 0] || IGtQ[m, 0])

Rule 3556

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

Rule 4269

Int[csc[(e_.) + (f_.)*(x_)]^2*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(-(c + d*x)^m)*(Cot[e + f*x]/f), x
] + Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cot[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 4462

Int[(u_)*((v_) + (d_.)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^(n_.)), x_Symbol] :> With[{e = FreeFactors[Cos[c*(a +
b*x)], x]}, Int[ActivateTrig[u*v], x] + Dist[d, Int[ActivateTrig[u]*Sin[c*(a + b*x)]^n, x], x] /; FunctionOfQ[
Cos[c*(a + b*x)]/e, u, x]] /; FreeQ[{a, b, c, d}, x] &&  !FreeQ[v, x] && IntegerQ[(n - 1)/2] && NonsumQ[u] &&
(EqQ[F, Sin] || EqQ[F, sin])

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

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.00 \[ \int \frac {x+\sin (x)}{1+\cos (x)} \, dx=x \tan \left (\frac {x}{2}\right ) \]

[In]

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

[Out]

x*Tan[x/2]

Maple [A] (verified)

Time = 0.07 (sec) , antiderivative size = 7, normalized size of antiderivative = 0.88

method result size
lookup \(x \tan \left (\frac {x}{2}\right )\) \(7\)
default \(x \tan \left (\frac {x}{2}\right )\) \(7\)
norman \(x \tan \left (\frac {x}{2}\right )\) \(7\)
parallelrisch \(x \tan \left (\frac {x}{2}\right )\) \(7\)
risch \(-i x +\frac {2 i x}{{\mathrm e}^{i x}+1}\) \(19\)

[In]

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

[Out]

x*tan(1/2*x)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.25 \[ \int \frac {x+\sin (x)}{1+\cos (x)} \, dx=\frac {x \sin \left (x\right )}{\cos \left (x\right ) + 1} \]

[In]

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

[Out]

x*sin(x)/(cos(x) + 1)

Sympy [A] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 5, normalized size of antiderivative = 0.62 \[ \int \frac {x+\sin (x)}{1+\cos (x)} \, dx=x \tan {\left (\frac {x}{2} \right )} \]

[In]

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

[Out]

x*tan(x/2)

Maxima [B] (verification not implemented)

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

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 6, normalized size of antiderivative = 0.75 \[ \int \frac {x+\sin (x)}{1+\cos (x)} \, dx=x \tan \left (\frac {1}{2} \, x\right ) \]

[In]

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

[Out]

x*tan(1/2*x)

Mupad [B] (verification not implemented)

Time = 14.73 (sec) , antiderivative size = 6, normalized size of antiderivative = 0.75 \[ \int \frac {x+\sin (x)}{1+\cos (x)} \, dx=x\,\mathrm {tan}\left (\frac {x}{2}\right ) \]

[In]

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

[Out]

x*tan(x/2)