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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, integrand size = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {212} \begin {gather*} \frac {1}{2} \tanh ^{-1}(2 \sin (x)) \end {gather*}

Antiderivative was successfully verified.

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

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 9, normalized size = 1.00 \begin {gather*} \frac {1}{2} \tanh ^{-1}(2 \sin (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

ArcTanh[2*Sin[x]]/2

________________________________________________________________________________________

Mathics [B] Leaf count is larger than twice the leaf count of optimal. \(85\) vs. \(2(9)=18\).
time = 4.79, size = 69, normalized size = 7.67 \begin {gather*} -\frac {\text {Log}\left [-1+\text {Tan}\left [\frac {x}{2}\right ]\right ]}{6}-\frac {\text {Log}\left [-1+\text {Sin}\left [3 x\right ]\right ]}{12}-\frac {\text {Log}\left [\frac {1-2 \text {Sin}\left [x\right ]}{1+\text {Cos}\left [x\right ]}\right ]}{12}+\frac {\text {Log}\left [1+\text {Sin}\left [3 x\right ]\right ]}{12}+\frac {\text {Log}\left [\frac {1+2 \text {Sin}\left [x\right ]}{1+\text {Cos}\left [x\right ]}\right ]}{12}+\frac {\text {Log}\left [1+\text {Tan}\left [\frac {x}{2}\right ]\right ]}{6} \end {gather*}

Antiderivative was successfully verified.

[In]

mathics('Integrate[Cos[x]^2/Cos[3*x],x]')

[Out]

-Log[-1 + Tan[x / 2]] / 6 - Log[-1 + Sin[3 x]] / 12 - Log[(1 - 2 Sin[x]) / (1 + Cos[x])] / 12 + Log[1 + Sin[3
x]] / 12 + Log[(1 + 2 Sin[x]) / (1 + Cos[x])] / 12 + Log[1 + Tan[x / 2]] / 6

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(19\) vs. \(2(7)=14\).
time = 0.08, size = 20, normalized size = 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\)

Verification of antiderivative is not currently implemented for this CAS.

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

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 19 vs. \(2 (7) = 14\).
time = 0.32, size = 19, normalized size = 2.11 \begin {gather*} \frac {1}{4} \, \log \left (2 \, \sin \left (x\right ) + 1\right ) - \frac {1}{4} \, \log \left (-2 \, \sin \left (x\right ) + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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] Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (7) = 14\)
time = 2.17, size = 76, normalized size = 8.44 \begin {gather*} - \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} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 21 vs. \(2 (7) = 14\).
time = 0.00, size = 26, normalized size = 2.89 \begin {gather*} 2 \left (-\frac {\ln \left |2 \sin x-1\right |}{8}+\frac {\ln \left |2 \sin x+1\right |}{8}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.36, size = 7, normalized size = 0.78 \begin {gather*} \frac {\mathrm {atanh}\left (2\,\sin \left (x\right )\right )}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

atanh(2*sin(x))/2

________________________________________________________________________________________