\(\int \cos ^2(x) \sec (3 x) \, dx\) [383]

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

Optimal result

Integrand size = 9, antiderivative size = 9 \[ \int \cos ^2(x) \sec (3 x) \, dx=\frac {1}{2} \text {arctanh}(2 \sin (x)) \]

[Out]

1/2*arctanh(2*sin(x))

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {212} \[ \int \cos ^2(x) \sec (3 x) \, dx=\frac {1}{2} \text {arctanh}(2 \sin (x)) \]

[In]

Int[Cos[x]^2*Sec[3*x],x]

[Out]

ArcTanh[2*Sin[x]]/2

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])

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

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00 \[ \int \cos ^2(x) \sec (3 x) \, dx=\frac {1}{2} \text {arctanh}(2 \sin (x)) \]

[In]

Integrate[Cos[x]^2*Sec[3*x],x]

[Out]

ArcTanh[2*Sin[x]]/2

Maple [B] (verified)

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

Time = 0.90 (sec) , antiderivative size = 20, normalized size of antiderivative = 2.22

method result size
default \(\frac {\ln \left (1+2 \sin \left (x \right )\right )}{4}-\frac {\ln \left (2 \sin \left (x \right )-1\right )}{4}\) \(20\)
risch \(-\frac {\ln \left (-i {\mathrm e}^{i x}+{\mathrm e}^{2 i x}-1\right )}{4}+\frac {\ln \left (i {\mathrm e}^{i x}+{\mathrm e}^{2 i x}-1\right )}{4}\) \(38\)

[In]

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

[Out]

1/4*ln(1+2*sin(x))-1/4*ln(2*sin(x)-1)

Fricas [B] (verification not implemented)

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

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

[In]

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

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (7) = 14\).

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

[In]

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

[Out]

-log(sin(3*x) - 1)/12 + log(sin(3*x) + 1)/12 - log(tan(x/2) - 1)/6 + log(tan(x/2) + 1)/6 - log(tan(x/2)**2 - 4
*tan(x/2) + 1)/12 + log(tan(x/2)**2 + 4*tan(x/2) + 1)/12

Maxima [F]

\[ \int \cos ^2(x) \sec (3 x) \, dx=\int { \frac {\cos \left (x\right )^{2}}{\cos \left (3 \, x\right )} \,d x } \]

[In]

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

[Out]

integrate(cos(x)^2/cos(3*x), x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 21 vs. \(2 (7) = 14\).

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.40 (sec) , antiderivative size = 7, normalized size of antiderivative = 0.78 \[ \int \cos ^2(x) \sec (3 x) \, dx=\frac {\mathrm {atanh}\left (2\,\sin \left (x\right )\right )}{2} \]

[In]

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

[Out]

atanh(2*sin(x))/2