3.4.85 \(\int \sec (2 x) \sin ^2(x) \, dx\) [385]

Optimal. Leaf size=17 \[ -\frac {x}{2}+\frac {1}{4} \tanh ^{-1}(2 \cos (x) \sin (x)) \]

[Out]

-1/2*x+1/4*arctanh(2*cos(x)*sin(x))

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {304, 209, 212} \begin {gather*} \frac {1}{4} \tanh ^{-1}(2 \sin (x) \cos (x))-\frac {x}{2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-1/2*x + ArcTanh[2*Cos[x]*Sin[x]]/4

Rule 209

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

Rule 212

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

Rule 304

Int[(x_)^2/((a_) + (b_.)*(x_)^4), x_Symbol] :> With[{r = Numerator[Rt[-a/b, 2]], s = Denominator[Rt[-a/b, 2]]}
, Dist[s/(2*b), Int[1/(r + s*x^2), x], x] - Dist[s/(2*b), Int[1/(r - s*x^2), x], x]] /; FreeQ[{a, b}, x] &&  !
GtQ[a/b, 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 28, normalized size = 1.65 \begin {gather*} -\frac {x}{2}-\frac {1}{4} \log (\cos (x)-\sin (x))+\frac {1}{4} \log (\cos (x)+\sin (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-1/2*x - Log[Cos[x] - Sin[x]]/4 + Log[Cos[x] + Sin[x]]/4

________________________________________________________________________________________

Maple [A]
time = 0.07, size = 21, normalized size = 1.24

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 128 vs. \(2 (13) = 26\).
time = 1.47, size = 128, normalized size = 7.53 \begin {gather*} -\frac {1}{2} \, x - \frac {1}{8} \, \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} + 2 \, \sqrt {2} \cos \left (x\right ) + 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) + \frac {1}{8} \, \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} + 2 \, \sqrt {2} \cos \left (x\right ) - 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) + \frac {1}{8} \, \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} - 2 \, \sqrt {2} \cos \left (x\right ) + 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) - \frac {1}{8} \, \log \left (2 \, \cos \left (x\right )^{2} + 2 \, \sin \left (x\right )^{2} - 2 \, \sqrt {2} \cos \left (x\right ) - 2 \, \sqrt {2} \sin \left (x\right ) + 2\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/2*x - 1/8*log(2*cos(x)^2 + 2*sin(x)^2 + 2*sqrt(2)*cos(x) + 2*sqrt(2)*sin(x) + 2) + 1/8*log(2*cos(x)^2 + 2*s
in(x)^2 + 2*sqrt(2)*cos(x) - 2*sqrt(2)*sin(x) + 2) + 1/8*log(2*cos(x)^2 + 2*sin(x)^2 - 2*sqrt(2)*cos(x) + 2*sq
rt(2)*sin(x) + 2) - 1/8*log(2*cos(x)^2 + 2*sin(x)^2 - 2*sqrt(2)*cos(x) - 2*sqrt(2)*sin(x) + 2)

________________________________________________________________________________________

Fricas [A]
time = 1.09, size = 26, normalized size = 1.53 \begin {gather*} -\frac {1}{2} \, x + \frac {1}{8} \, \log \left (2 \, \cos \left (x\right ) \sin \left (x\right ) + 1\right ) - \frac {1}{8} \, \log \left (-2 \, \cos \left (x\right ) \sin \left (x\right ) + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/2*x + 1/8*log(2*cos(x)*sin(x) + 1) - 1/8*log(-2*cos(x)*sin(x) + 1)

________________________________________________________________________________________

Sympy [A]
time = 0.52, size = 22, normalized size = 1.29 \begin {gather*} - \frac {x}{2} - \frac {\log {\left (\sin {\left (2 x \right )} - 1 \right )}}{8} + \frac {\log {\left (\sin {\left (2 x \right )} + 1 \right )}}{8} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)**2/cos(2*x),x)

[Out]

-x/2 - log(sin(2*x) - 1)/8 + log(sin(2*x) + 1)/8

________________________________________________________________________________________

Giac [A]
time = 1.04, size = 20, normalized size = 1.18 \begin {gather*} -\frac {1}{2} \, x + \frac {1}{4} \, \log \left ({\left | \tan \left (x\right ) + 1 \right |}\right ) - \frac {1}{4} \, \log \left ({\left | \tan \left (x\right ) - 1 \right |}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.24, size = 9, normalized size = 0.53 \begin {gather*} \frac {\mathrm {atanh}\left (\mathrm {tan}\left (x\right )\right )}{2}-\frac {x}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/cos(2*x),x)

[Out]

atanh(tan(x))/2 - x/2

________________________________________________________________________________________