3.201 \(\int \frac{1+\sin ^2(x)}{1-\sin ^2(x)} \, dx\)

Optimal. Leaf size=8 \[ 2 \tan (x)-x \]

[Out]

-x + 2*Tan[x]

________________________________________________________________________________________

Rubi [A]  time = 0.0414272, antiderivative size = 8, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 17, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.235, Rules used = {3171, 3175, 3767, 8} \[ 2 \tan (x)-x \]

Antiderivative was successfully verified.

[In]

Int[(1 + Sin[x]^2)/(1 - Sin[x]^2),x]

[Out]

-x + 2*Tan[x]

Rule 3171

Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)]^2)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(B*x
)/b, x] + Dist[(A*b - a*B)/b, Int[1/(a + b*Sin[e + f*x]^2), x], x] /; FreeQ[{a, b, e, f, A, B}, x]

Rule 3175

Int[(u_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Dist[a^p, Int[ActivateTrig[u*cos[e + f*x
]^(2*p)], x], x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a + b, 0] && IntegerQ[p]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \frac{1+\sin ^2(x)}{1-\sin ^2(x)} \, dx &=-x+2 \int \frac{1}{1-\sin ^2(x)} \, dx\\ &=-x+2 \int \sec ^2(x) \, dx\\ &=-x-2 \operatorname{Subst}(\int 1 \, dx,x,-\tan (x))\\ &=-x+2 \tan (x)\\ \end{align*}

Mathematica [A]  time = 0.0079257, size = 8, normalized size = 1. \[ 2 \tan (x)-x \]

Antiderivative was successfully verified.

[In]

Integrate[(1 + Sin[x]^2)/(1 - Sin[x]^2),x]

[Out]

-x + 2*Tan[x]

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((1+sin(x)^2)/(1-sin(x)^2),x)

[Out]

-x+2*tan(x)

________________________________________________________________________________________

Maxima [A]  time = 1.49172, size = 11, normalized size = 1.38 \begin{align*} -x + 2 \, \tan \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+sin(x)^2)/(1-sin(x)^2),x, algorithm="maxima")

[Out]

-x + 2*tan(x)

________________________________________________________________________________________

Fricas [A]  time = 2.21415, size = 42, normalized size = 5.25 \begin{align*} -\frac{x \cos \left (x\right ) - 2 \, \sin \left (x\right )}{\cos \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+sin(x)^2)/(1-sin(x)^2),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [B]  time = 1.50302, size = 41, normalized size = 5.12 \begin{align*} - \frac{x \tan ^{2}{\left (\frac{x}{2} \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} + \frac{x}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} - \frac{4 \tan{\left (\frac{x}{2} \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+sin(x)**2)/(1-sin(x)**2),x)

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.11664, size = 11, normalized size = 1.38 \begin{align*} -x + 2 \, \tan \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+sin(x)^2)/(1-sin(x)^2),x, algorithm="giac")

[Out]

-x + 2*tan(x)