\(\int \sec (3 x) \sin (x) \, dx\) [86]

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

Optimal result

Integrand size = 7, antiderivative size = 21 \[ \int \sec (3 x) \sin (x) \, dx=\frac {1}{3} \log (\cos (x))-\frac {1}{6} \log \left (3-4 \cos ^2(x)\right ) \]

[Out]

1/3*ln(cos(x))-1/6*ln(3-4*cos(x)^2)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.714, Rules used = {4442, 272, 36, 29, 31} \[ \int \sec (3 x) \sin (x) \, dx=\frac {1}{3} \log (\cos (x))-\frac {1}{6} \log \left (3-4 \cos ^2(x)\right ) \]

[In]

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

[Out]

Log[Cos[x]]/3 - Log[3 - 4*Cos[x]^2]/6

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 36

Int[1/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[b/(b*c - a*d), Int[1/(a + b*x), x], x] -
Dist[d/(b*c - a*d), Int[1/(c + d*x), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0]

Rule 272

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplify[(m + 1)/n] - 1)*(a
+ b*x)^p, x], x, x^n], x] /; FreeQ[{a, b, m, n, p}, x] && IntegerQ[Simplify[(m + 1)/n]]

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}{x \left (-3+4 x^2\right )} \, dx,x,\cos (x)\right ) \\ & = -\left (\frac {1}{2} \text {Subst}\left (\int \frac {1}{x (-3+4 x)} \, dx,x,\cos ^2(x)\right )\right ) \\ & = \frac {1}{6} \text {Subst}\left (\int \frac {1}{x} \, dx,x,\cos ^2(x)\right )-\frac {2}{3} \text {Subst}\left (\int \frac {1}{-3+4 x} \, dx,x,\cos ^2(x)\right ) \\ & = \frac {1}{3} \log (\cos (x))-\frac {1}{6} \log \left (3-4 \cos ^2(x)\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.81 \[ \int \sec (3 x) \sin (x) \, dx=-\frac {1}{3} \text {arctanh}\left (\frac {1}{3} \left (-5+8 \sin ^2(x)\right )\right ) \]

[In]

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

[Out]

-1/3*ArcTanh[(-5 + 8*Sin[x]^2)/3]

Maple [A] (verified)

Time = 1.55 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.86

method result size
default \(\frac {\ln \left (\cos \left (x \right )\right )}{3}-\frac {\ln \left (4 \cos \left (x \right )^{2}-3\right )}{6}\) \(18\)
risch \(\frac {\ln \left ({\mathrm e}^{2 i x}+1\right )}{3}-\frac {\ln \left ({\mathrm e}^{4 i x}-{\mathrm e}^{2 i x}+1\right )}{6}\) \(29\)

[In]

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

[Out]

1/3*ln(cos(x))-1/6*ln(4*cos(x)^2-3)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.90 \[ \int \sec (3 x) \sin (x) \, dx=-\frac {1}{6} \, \log \left (4 \, \cos \left (x\right )^{2} - 3\right ) + \frac {1}{3} \, \log \left (-\cos \left (x\right )\right ) \]

[In]

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

[Out]

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

Sympy [F]

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

[In]

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

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 81 vs. \(2 (17) = 34\).

Time = 0.28 (sec) , antiderivative size = 81, normalized size of antiderivative = 3.86 \[ \int \sec (3 x) \sin (x) \, dx=-\frac {1}{12} \, \log \left (-2 \, {\left (\cos \left (2 \, x\right ) - 1\right )} \cos \left (4 \, x\right ) + \cos \left (4 \, x\right )^{2} + \cos \left (2 \, x\right )^{2} + \sin \left (4 \, x\right )^{2} - 2 \, \sin \left (4 \, x\right ) \sin \left (2 \, x\right ) + \sin \left (2 \, x\right )^{2} - 2 \, \cos \left (2 \, x\right ) + 1\right ) + \frac {1}{6} \, \log \left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right ) \]

[In]

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

[Out]

-1/12*log(-2*(cos(2*x) - 1)*cos(4*x) + cos(4*x)^2 + cos(2*x)^2 + sin(4*x)^2 - 2*sin(4*x)*sin(2*x) + sin(2*x)^2
 - 2*cos(2*x) + 1) + 1/6*log(cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.14 \[ \int \sec (3 x) \sin (x) \, dx=\frac {1}{6} \, \log \left (-\sin \left (x\right )^{2} + 1\right ) - \frac {1}{6} \, \log \left ({\left | 4 \, \sin \left (x\right )^{2} - 1 \right |}\right ) \]

[In]

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

[Out]

1/6*log(-sin(x)^2 + 1) - 1/6*log(abs(4*sin(x)^2 - 1))

Mupad [B] (verification not implemented)

Time = 27.30 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.71 \[ \int \sec (3 x) \sin (x) \, dx=\frac {\ln \left (\cos \left (x\right )\right )}{3}-\frac {\ln \left ({\cos \left (x\right )}^2-\frac {3}{4}\right )}{6} \]

[In]

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

[Out]

log(cos(x))/3 - log(cos(x)^2 - 3/4)/6