3.2.86 \(\int \tanh ^2(x) \, dx\) [186]

Optimal. Leaf size=6 \[ x-\tanh (x) \]

[Out]

x-tanh(x)

________________________________________________________________________________________

Rubi [A]
time = 0.00, antiderivative size = 6, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3554, 8} \begin {gather*} x-\tanh (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tanh[x]^2,x]

[Out]

x - Tanh[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps

\begin {gather*} \begin {aligned} \text {Integral} &=-\tanh (x)+\int 1 \, dx\\ &=x-\tanh (x)\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.00, size = 6, normalized size = 1.00 \begin {gather*} x-\tanh (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tanh[x]^2,x]

[Out]

x - Tanh[x]

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(19\) vs. \(2(6)=12\).
time = 0.02, size = 20, normalized size = 3.33

method result size
parallelrisch \(x -\tanh \left (x \right )\) \(7\)
risch \(x +\frac {2}{1+{\mathrm e}^{2 x}}\) \(13\)
derivativedivides \(-\tanh \left (x \right )-\frac {\ln \left (\tanh \left (x \right )-1\right )}{2}+\frac {\ln \left (\tanh \left (x \right )+1\right )}{2}\) \(20\)
default \(-\tanh \left (x \right )-\frac {\ln \left (\tanh \left (x \right )-1\right )}{2}+\frac {\ln \left (\tanh \left (x \right )+1\right )}{2}\) \(20\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(x)^2,x,method=_RETURNVERBOSE)

[Out]

-tanh(x)-1/2*ln(tanh(x)-1)+1/2*ln(tanh(x)+1)

________________________________________________________________________________________

Maxima [A]
time = 0.37, size = 12, normalized size = 2.00 \begin {gather*} x - \frac {2}{e^{\left (-2 \, x\right )} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(x)^2,x, algorithm="maxima")

[Out]

x - 2/(e^(-2*x) + 1)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 16 vs. \(2 (6) = 12\).
time = 0.57, size = 16, normalized size = 2.67 \begin {gather*} \frac {{\left (x + 1\right )} \cosh \left (x\right ) - \sinh \left (x\right )}{\cosh \left (x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(x)^2,x, algorithm="fricas")

[Out]

((x + 1)*cosh(x) - sinh(x))/cosh(x)

________________________________________________________________________________________

Sympy [A]
time = 0.06, size = 3, normalized size = 0.50 \begin {gather*} x - \tanh {\left (x \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(x)**2,x)

[Out]

x - tanh(x)

________________________________________________________________________________________

Giac [A]
time = 0.49, size = 12, normalized size = 2.00 \begin {gather*} x + \frac {2}{e^{\left (2 \, x\right )} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(x)^2,x, algorithm="giac")

[Out]

x + 2/(e^(2*x) + 1)

________________________________________________________________________________________

Mupad [B]
time = 0.05, size = 6, normalized size = 1.00 \begin {gather*} x-\mathrm {tanh}\left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(x)^2,x)

[Out]

x - tanh(x)

________________________________________________________________________________________

Chatgpt [A]
time = 1.00, size = 6, normalized size = 1.00 \begin {gather*} x -\tanh \left (x \right ) \end {gather*}

Antiderivative was successfully verified.

[In]

int(tanh(x)^2,x)

[Out]

x-tanh(x)

________________________________________________________________________________________