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]

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

________________________________________________________________________________________

Rubi [A]  time = 0.05, antiderivative size = 12, normalized size of antiderivative = 1.00, 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 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])

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]

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.02, size = 12, normalized size = 1.00 \[ \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

________________________________________________________________________________________

fricas [A]  time = 1.09, size = 13, normalized size = 1.08 \[ \frac {x \cos \relax (x) + \sin \relax (x)}{2 \, \cos \relax (x)} \]

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)

________________________________________________________________________________________

giac [A]  time = 0.15, size = 8, normalized size = 0.67 \[ \frac {1}{2} \, x + \frac {1}{2} \, \tan \relax (x) \]

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)

________________________________________________________________________________________

maple [A]  time = 0.12, size = 9, normalized size = 0.75 \[ \frac {x}{2}+\frac {\tan \relax (x )}{2} \]

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.31, size = 18, normalized size = 1.50 \[ \frac {1}{2} \, x + \frac {\sin \left (2 \, x\right )}{2 \, {\left (\cos \left (2 \, x\right ) + 1\right )}} \]

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)

________________________________________________________________________________________

mupad [B]  time = 2.93, size = 8, normalized size = 0.67 \[ \frac {x}{2}+\frac {\mathrm {tan}\relax (x)}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x/2 + tan(x)/2

________________________________________________________________________________________

sympy [A]  time = 1.41, size = 7, normalized size = 0.58 \[ \frac {x}{2} + \frac {\tan {\relax (x )}}{2} \]

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

________________________________________________________________________________________