\(\int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx\) [696]

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

Optimal result

Integrand size = 17, antiderivative size = 33 \[ \int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx=x-\arctan \left (\frac {1-2 \cos ^2(x)+\cos (x) \sin (x)}{2+\cos ^2(x)+2 \cos (x) \sin (x)}\right ) \]

[Out]

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

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {4427, 631, 210} \[ \int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx=x-\arctan \left (\frac {-2 \cos ^2(x)+\sin (x) \cos (x)+1}{\cos ^2(x)+2 \sin (x) \cos (x)+2}\right ) \]

[In]

Int[Sec[x]^2/(2 + 2*Tan[x] + Tan[x]^2),x]

[Out]

x - ArcTan[(1 - 2*Cos[x]^2 + Cos[x]*Sin[x])/(2 + Cos[x]^2 + 2*Cos[x]*Sin[x])]

Rule 210

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

Rule 631

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = 1 - 4*Simplify[a*(c/b^2)]}, Dist[-2/b, Sub
st[Int[1/(q - x^2), x], x, 1 + 2*c*(x/b)], x] /; RationalQ[q] && (EqQ[q^2, 1] ||  !RationalQ[b^2 - 4*a*c])] /;
 FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 4427

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Tan[c*(a + b*x)], x]}, Dist[d/
(b*c), Subst[Int[SubstFor[1, Tan[c*(a + b*x)]/d, u, x], x], x, Tan[c*(a + b*x)]/d], x] /; FunctionOfQ[Tan[c*(a
 + b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Sec] || EqQ[F, sec])

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

Mathematica [A] (verified)

Time = 0.08 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.94 \[ \int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx=2 \left (-\frac {1}{4} \arctan \left (\frac {\cos (x)}{\cos (x)+\sin (x)}\right )+\frac {1}{4} \arctan (\sec (x) (\cos (x)+\sin (x)))\right ) \]

[In]

Integrate[Sec[x]^2/(2 + 2*Tan[x] + Tan[x]^2),x]

[Out]

2*(-1/4*ArcTan[Cos[x]/(Cos[x] + Sin[x])] + ArcTan[Sec[x]*(Cos[x] + Sin[x])]/4)

Maple [A] (verified)

Time = 8.09 (sec) , antiderivative size = 6, normalized size of antiderivative = 0.18

method result size
default \(\arctan \left (1+\tan \left (x \right )\right )\) \(6\)
risch \(-\frac {i \ln \left ({\mathrm e}^{2 i x}+\frac {1}{5}+\frac {2 i}{5}\right )}{2}+\frac {i \ln \left ({\mathrm e}^{2 i x}+1+2 i\right )}{2}\) \(28\)

[In]

int(sec(x)^2/(2+2*tan(x)+tan(x)^2),x,method=_RETURNVERBOSE)

[Out]

arctan(1+tan(x))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.06 \[ \int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx=-\frac {1}{2} \, \arctan \left (-\frac {3 \, \cos \left (x\right )^{2} + 6 \, \cos \left (x\right ) \sin \left (x\right ) + 1}{2 \, {\left (2 \, \cos \left (x\right )^{2} - \cos \left (x\right ) \sin \left (x\right ) - 1\right )}}\right ) \]

[In]

integrate(sec(x)^2/(2+2*tan(x)+tan(x)^2),x, algorithm="fricas")

[Out]

-1/2*arctan(-1/2*(3*cos(x)^2 + 6*cos(x)*sin(x) + 1)/(2*cos(x)^2 - cos(x)*sin(x) - 1))

Sympy [F]

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

[In]

integrate(sec(x)**2/(2+2*tan(x)+tan(x)**2),x)

[Out]

Integral(sec(x)**2/(tan(x)**2 + 2*tan(x) + 2), x)

Maxima [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 5, normalized size of antiderivative = 0.15 \[ \int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx=\arctan \left (\tan \left (x\right ) + 1\right ) \]

[In]

integrate(sec(x)^2/(2+2*tan(x)+tan(x)^2),x, algorithm="maxima")

[Out]

arctan(tan(x) + 1)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 5, normalized size of antiderivative = 0.15 \[ \int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx=\arctan \left (\tan \left (x\right ) + 1\right ) \]

[In]

integrate(sec(x)^2/(2+2*tan(x)+tan(x)^2),x, algorithm="giac")

[Out]

arctan(tan(x) + 1)

Mupad [B] (verification not implemented)

Time = 26.79 (sec) , antiderivative size = 5, normalized size of antiderivative = 0.15 \[ \int \frac {\sec ^2(x)}{2+2 \tan (x)+\tan ^2(x)} \, dx=\mathrm {atan}\left (\mathrm {tan}\left (x\right )+1\right ) \]

[In]

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

[Out]

atan(tan(x) + 1)