3.887 \(\int \frac{1+\cos ^2(x)}{1+\cos (2 x)} \, dx\)

Optimal. Leaf size=12 \[ \frac{x}{2}+\frac{\tan (x)}{2} \]

[Out]

x/2 + Tan[x]/2

________________________________________________________________________________________

Rubi [A]  time = 0.0468899, antiderivative size = 12, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.133, Rules used = {388, 203} \[ \frac{x}{2}+\frac{\tan (x)}{2} \]

Antiderivative was successfully verified.

[In]

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

[Out]

x/2 + Tan[x]/2

Rule 388

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(d*x*(a + b*x^n)^(p + 1))/(b*(n*
(p + 1) + 1)), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

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

Mathematica [A]  time = 0.0157699, size = 12, normalized size = 1. \[ \frac{x}{2}+\frac{\tan (x)}{2} \]

Antiderivative was successfully verified.

[In]

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

[Out]

x/2 + Tan[x]/2

________________________________________________________________________________________

Maple [A]  time = 0.047, size = 9, normalized size = 0.8 \begin{align*}{\frac{x}{2}}+{\frac{\tan \left ( x \right ) }{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [B]  time = 0.945971, size = 24, normalized size = 2. \begin{align*} \frac{1}{2} \, x + \frac{\sin \left (2 \, x\right )}{2 \,{\left (\cos \left (2 \, x\right ) + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.30898, size = 43, normalized size = 3.58 \begin{align*} \frac{x \cos \left (x\right ) + \sin \left (x\right )}{2 \, \cos \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 1.68321, size = 7, normalized size = 0.58 \begin{align*} \frac{x}{2} + \frac{\tan{\left (x \right )}}{2} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x/2 + tan(x)/2

________________________________________________________________________________________

Giac [A]  time = 1.0669, size = 11, normalized size = 0.92 \begin{align*} \frac{1}{2} \, x + \frac{1}{2} \, \tan \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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