\(\int \tanh ^4(x) \, dx\) [578]

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

Optimal result

Integrand size = 4, antiderivative size = 14 \[ \int \tanh ^4(x) \, dx=x-\tanh (x)-\frac {\tanh ^3(x)}{3} \]

[Out]

x-tanh(x)-1/3*tanh(x)^3

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3554, 8} \[ \int \tanh ^4(x) \, dx=x-\frac {1}{3} \tanh ^3(x)-\tanh (x) \]

[In]

Int[Tanh[x]^4,x]

[Out]

x - Tanh[x] - Tanh[x]^3/3

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{align*} \text {integral}& = -\frac {1}{3} \tanh ^3(x)+\int \tanh ^2(x) \, dx \\ & = -\tanh (x)-\frac {\tanh ^3(x)}{3}+\int 1 \, dx \\ & = x-\tanh (x)-\frac {\tanh ^3(x)}{3} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.14 \[ \int \tanh ^4(x) \, dx=\text {arctanh}(\tanh (x))-\tanh (x)-\frac {\tanh ^3(x)}{3} \]

[In]

Integrate[Tanh[x]^4,x]

[Out]

ArcTanh[Tanh[x]] - Tanh[x] - Tanh[x]^3/3

Maple [A] (verified)

Time = 0.04 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.93

method result size
parallelrisch \(x -\tanh \left (x \right )-\frac {\left (\tanh ^{3}\left (x \right )\right )}{3}\) \(13\)
derivativedivides \(-\frac {\left (\tanh ^{3}\left (x \right )\right )}{3}-\tanh \left (x \right )-\frac {\ln \left (-1+\tanh \left (x \right )\right )}{2}+\frac {\ln \left (1+\tanh \left (x \right )\right )}{2}\) \(26\)
default \(-\frac {\left (\tanh ^{3}\left (x \right )\right )}{3}-\tanh \left (x \right )-\frac {\ln \left (-1+\tanh \left (x \right )\right )}{2}+\frac {\ln \left (1+\tanh \left (x \right )\right )}{2}\) \(26\)
risch \(x +\frac {4 \,{\mathrm e}^{4 x}+4 \,{\mathrm e}^{2 x}+\frac {8}{3}}{\left (1+{\mathrm e}^{2 x}\right )^{3}}\) \(27\)

[In]

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

[Out]

x-tanh(x)-1/3*tanh(x)^3

Fricas [B] (verification not implemented)

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

Time = 0.24 (sec) , antiderivative size = 68, normalized size of antiderivative = 4.86 \[ \int \tanh ^4(x) \, dx=\frac {{\left (3 \, x + 4\right )} \cosh \left (x\right )^{3} + 3 \, {\left (3 \, x + 4\right )} \cosh \left (x\right ) \sinh \left (x\right )^{2} - 12 \, \cosh \left (x\right )^{2} \sinh \left (x\right ) - 4 \, \sinh \left (x\right )^{3} + 3 \, {\left (3 \, x + 4\right )} \cosh \left (x\right )}{3 \, {\left (\cosh \left (x\right )^{3} + 3 \, \cosh \left (x\right ) \sinh \left (x\right )^{2} + 3 \, \cosh \left (x\right )\right )}} \]

[In]

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

[Out]

1/3*((3*x + 4)*cosh(x)^3 + 3*(3*x + 4)*cosh(x)*sinh(x)^2 - 12*cosh(x)^2*sinh(x) - 4*sinh(x)^3 + 3*(3*x + 4)*co
sh(x))/(cosh(x)^3 + 3*cosh(x)*sinh(x)^2 + 3*cosh(x))

Sympy [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.71 \[ \int \tanh ^4(x) \, dx=x - \frac {\tanh ^{3}{\left (x \right )}}{3} - \tanh {\left (x \right )} \]

[In]

integrate(tanh(x)**4,x)

[Out]

x - tanh(x)**3/3 - tanh(x)

Maxima [B] (verification not implemented)

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

Time = 0.22 (sec) , antiderivative size = 38, normalized size of antiderivative = 2.71 \[ \int \tanh ^4(x) \, dx=x - \frac {4 \, {\left (3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + 2\right )}}{3 \, {\left (3 \, e^{\left (-2 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} + e^{\left (-6 \, x\right )} + 1\right )}} \]

[In]

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

[Out]

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

Giac [B] (verification not implemented)

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

Time = 0.28 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.86 \[ \int \tanh ^4(x) \, dx=x + \frac {4 \, {\left (3 \, e^{\left (4 \, x\right )} + 3 \, e^{\left (2 \, x\right )} + 2\right )}}{3 \, {\left (e^{\left (2 \, x\right )} + 1\right )}^{3}} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.86 \[ \int \tanh ^4(x) \, dx=-\frac {{\mathrm {tanh}\left (x\right )}^3}{3}-\mathrm {tanh}\left (x\right )+x \]

[In]

int(tanh(x)^4,x)

[Out]

x - tanh(x) - tanh(x)^3/3