\(\int \sec (2 x) \sin (x) \, dx\) [85]

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

Optimal result

Integrand size = 7, antiderivative size = 15 \[ \int \sec (2 x) \sin (x) \, dx=\frac {\text {arctanh}\left (\sqrt {2} \cos (x)\right )}{\sqrt {2}} \]

[Out]

1/2*arctanh(cos(x)*2^(1/2))*2^(1/2)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {4442, 213} \[ \int \sec (2 x) \sin (x) \, dx=\frac {\text {arctanh}\left (\sqrt {2} \cos (x)\right )}{\sqrt {2}} \]

[In]

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

[Out]

ArcTanh[Sqrt[2]*Cos[x]]/Sqrt[2]

Rule 213

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

Rule 4442

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))], x_Symbol] :> With[{d = FreeFactors[Cos[c*(a + b*x)], x]}, Dist[-d/(
b*c), Subst[Int[SubstFor[1, Cos[c*(a + b*x)]/d, u, x], x], x, Cos[c*(a + b*x)]/d], x] /; FunctionOfQ[Cos[c*(a
+ b*x)]/d, u, x]] /; FreeQ[{a, b, c}, x] && (EqQ[F, Sin] || EqQ[F, sin])

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(35\) vs. \(2(15)=30\).

Time = 0.06 (sec) , antiderivative size = 35, normalized size of antiderivative = 2.33 \[ \int \sec (2 x) \sin (x) \, dx=\frac {\text {arctanh}\left (\sqrt {2}-\tan \left (\frac {x}{2}\right )\right )+\text {arctanh}\left (\sqrt {2}+\tan \left (\frac {x}{2}\right )\right )}{\sqrt {2}} \]

[In]

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

[Out]

(ArcTanh[Sqrt[2] - Tan[x/2]] + ArcTanh[Sqrt[2] + Tan[x/2]])/Sqrt[2]

Maple [A] (verified)

Time = 1.57 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.87

method result size
default \(\frac {\operatorname {arctanh}\left (\cos \left (x \right ) \sqrt {2}\right ) \sqrt {2}}{2}\) \(13\)
risch \(\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 i x}+\sqrt {2}\, {\mathrm e}^{i x}+1\right )}{4}-\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 i x}-\sqrt {2}\, {\mathrm e}^{i x}+1\right )}{4}\) \(47\)

[In]

int(sec(2*x)*sin(x),x,method=_RETURNVERBOSE)

[Out]

1/2*arctanh(cos(x)*2^(1/2))*2^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 33 vs. \(2 (12) = 24\).

Time = 0.24 (sec) , antiderivative size = 33, normalized size of antiderivative = 2.20 \[ \int \sec (2 x) \sin (x) \, dx=\frac {1}{4} \, \sqrt {2} \log \left (-\frac {2 \, \cos \left (x\right )^{2} + 2 \, \sqrt {2} \cos \left (x\right ) + 1}{2 \, \cos \left (x\right )^{2} - 1}\right ) \]

[In]

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

[Out]

1/4*sqrt(2)*log(-(2*cos(x)^2 + 2*sqrt(2)*cos(x) + 1)/(2*cos(x)^2 - 1))

Sympy [F]

\[ \int \sec (2 x) \sin (x) \, dx=\int \sin {\left (x \right )} \sec {\left (2 x \right )}\, dx \]

[In]

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

[Out]

Integral(sin(x)*sec(2*x), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 129 vs. \(2 (12) = 24\).

Time = 0.28 (sec) , antiderivative size = 129, normalized size of antiderivative = 8.60 \[ \int \sec (2 x) \sin (x) \, dx=\frac {1}{8} \, \sqrt {2} \log \left (2 \, \sqrt {2} \sin \left (2 \, x\right ) \sin \left (x\right ) + 2 \, {\left (\sqrt {2} \cos \left (x\right ) + 1\right )} \cos \left (2 \, x\right ) + \cos \left (2 \, x\right )^{2} + 2 \, \cos \left (x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \sin \left (x\right )^{2} + 2 \, \sqrt {2} \cos \left (x\right ) + 1\right ) - \frac {1}{8} \, \sqrt {2} \log \left (-2 \, \sqrt {2} \sin \left (2 \, x\right ) \sin \left (x\right ) - 2 \, {\left (\sqrt {2} \cos \left (x\right ) - 1\right )} \cos \left (2 \, x\right ) + \cos \left (2 \, x\right )^{2} + 2 \, \cos \left (x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \sin \left (x\right )^{2} - 2 \, \sqrt {2} \cos \left (x\right ) + 1\right ) \]

[In]

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

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 49 vs. \(2 (12) = 24\).

Time = 0.28 (sec) , antiderivative size = 49, normalized size of antiderivative = 3.27 \[ \int \sec (2 x) \sin (x) \, dx=\frac {1}{4} \, \sqrt {2} \log \left (\frac {{\left | -4 \, \sqrt {2} - \frac {2 \, {\left (\cos \left (x\right ) - 1\right )}}{\cos \left (x\right ) + 1} - 6 \right |}}{{\left | 4 \, \sqrt {2} - \frac {2 \, {\left (\cos \left (x\right ) - 1\right )}}{\cos \left (x\right ) + 1} - 6 \right |}}\right ) \]

[In]

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

[Out]

1/4*sqrt(2)*log(abs(-4*sqrt(2) - 2*(cos(x) - 1)/(cos(x) + 1) - 6)/abs(4*sqrt(2) - 2*(cos(x) - 1)/(cos(x) + 1)
- 6))

Mupad [B] (verification not implemented)

Time = 0.23 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.80 \[ \int \sec (2 x) \sin (x) \, dx=\frac {\sqrt {2}\,\mathrm {atanh}\left (\sqrt {2}\,\cos \left (x\right )\right )}{2} \]

[In]

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

[Out]

(2^(1/2)*atanh(2^(1/2)*cos(x)))/2