\(\int \sin (x) \tan ^2(x) \, dx\) [135]

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

Optimal result

Integrand size = 7, antiderivative size = 5 \[ \int \sin (x) \tan ^2(x) \, dx=\cos (x)+\sec (x) \]

[Out]

cos(x)+sec(x)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {2670, 14} \[ \int \sin (x) \tan ^2(x) \, dx=\cos (x)+\sec (x) \]

[In]

Int[Sin[x]*Tan[x]^2,x]

[Out]

Cos[x] + Sec[x]

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2670

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-f^(-1), Subst[Int[(1 - x^2
)^((m + n - 1)/2)/x^n, x], x, Cos[e + f*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n - 1)/2]

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

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.00 \[ \int \sin (x) \tan ^2(x) \, dx=\cos (x)+\sec (x) \]

[In]

Integrate[Sin[x]*Tan[x]^2,x]

[Out]

Cos[x] + Sec[x]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(19\) vs. \(2(5)=10\).

Time = 0.22 (sec) , antiderivative size = 20, normalized size of antiderivative = 4.00

method result size
default \(\frac {\sin \left (x \right )^{4}}{\cos \left (x \right )}+\left (2+\sin \left (x \right )^{2}\right ) \cos \left (x \right )\) \(20\)
risch \(\frac {{\mathrm e}^{3 i x}+7 \cos \left (x \right )+5 i \sin \left (x \right )}{2 \,{\mathrm e}^{2 i x}+2}\) \(27\)

[In]

int(sin(x)*tan(x)^2,x,method=_RETURNVERBOSE)

[Out]

sin(x)^4/cos(x)+(2+sin(x)^2)*cos(x)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 11 vs. \(2 (5) = 10\).

Time = 0.26 (sec) , antiderivative size = 11, normalized size of antiderivative = 2.20 \[ \int \sin (x) \tan ^2(x) \, dx=\frac {\cos \left (x\right )^{2} + 1}{\cos \left (x\right )} \]

[In]

integrate(sin(x)*tan(x)^2,x, algorithm="fricas")

[Out]

(cos(x)^2 + 1)/cos(x)

Sympy [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.40 \[ \int \sin (x) \tan ^2(x) \, dx=\cos {\left (x \right )} + \frac {1}{\cos {\left (x \right )}} \]

[In]

integrate(sin(x)*tan(x)**2,x)

[Out]

cos(x) + 1/cos(x)

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.40 \[ \int \sin (x) \tan ^2(x) \, dx=\frac {1}{\cos \left (x\right )} + \cos \left (x\right ) \]

[In]

integrate(sin(x)*tan(x)^2,x, algorithm="maxima")

[Out]

1/cos(x) + cos(x)

Giac [A] (verification not implemented)

none

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

[In]

integrate(sin(x)*tan(x)^2,x, algorithm="giac")

[Out]

1/cos(x) + cos(x)

Mupad [B] (verification not implemented)

Time = 15.42 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.40 \[ \int \sin (x) \tan ^2(x) \, dx=\cos \left (x\right )+\frac {1}{\cos \left (x\right )} \]

[In]

int(sin(x)*tan(x)^2,x)

[Out]

cos(x) + 1/cos(x)