\(\int \tanh ^2(a+b x) \, dx\) [366]

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

Optimal result

Integrand size = 8, antiderivative size = 13 \[ \int \tanh ^2(a+b x) \, dx=x-\frac {\tanh (a+b x)}{b} \]

[Out]

x-tanh(b*x+a)/b

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 13, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3554, 8} \[ \int \tanh ^2(a+b x) \, dx=x-\frac {\tanh (a+b x)}{b} \]

[In]

Int[Tanh[a + b*x]^2,x]

[Out]

x - Tanh[a + b*x]/b

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 {\tanh (a+b x)}{b}+\int 1 \, dx \\ & = x-\frac {\tanh (a+b x)}{b} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.77 \[ \int \tanh ^2(a+b x) \, dx=\frac {\text {arctanh}(\tanh (a+b x))}{b}-\frac {\tanh (a+b x)}{b} \]

[In]

Integrate[Tanh[a + b*x]^2,x]

[Out]

ArcTanh[Tanh[a + b*x]]/b - Tanh[a + b*x]/b

Maple [A] (verified)

Time = 0.27 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.31

method result size
parallelrisch \(\frac {b x -\tanh \left (b x +a \right )}{b}\) \(17\)
derivativedivides \(\frac {b x +a -\tanh \left (b x +a \right )}{b}\) \(18\)
default \(\frac {b x +a -\tanh \left (b x +a \right )}{b}\) \(18\)
risch \(x +\frac {2}{b \left (1+{\mathrm e}^{2 b x +2 a}\right )}\) \(21\)

[In]

int(sech(b*x+a)^2*sinh(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

(b*x-tanh(b*x+a))/b

Fricas [B] (verification not implemented)

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

Time = 0.26 (sec) , antiderivative size = 33, normalized size of antiderivative = 2.54 \[ \int \tanh ^2(a+b x) \, dx=\frac {{\left (b x + 1\right )} \cosh \left (b x + a\right ) - \sinh \left (b x + a\right )}{b \cosh \left (b x + a\right )} \]

[In]

integrate(sech(b*x+a)^2*sinh(b*x+a)^2,x, algorithm="fricas")

[Out]

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

Sympy [F]

\[ \int \tanh ^2(a+b x) \, dx=\int \sinh ^{2}{\left (a + b x \right )} \operatorname {sech}^{2}{\left (a + b x \right )}\, dx \]

[In]

integrate(sech(b*x+a)**2*sinh(b*x+a)**2,x)

[Out]

Integral(sinh(a + b*x)**2*sech(a + b*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.92 \[ \int \tanh ^2(a+b x) \, dx=x + \frac {a}{b} - \frac {2}{b {\left (e^{\left (-2 \, b x - 2 \, a\right )} + 1\right )}} \]

[In]

integrate(sech(b*x+a)^2*sinh(b*x+a)^2,x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.85 \[ \int \tanh ^2(a+b x) \, dx=\frac {b x + a + \frac {2}{e^{\left (2 \, b x + 2 \, a\right )} + 1}}{b} \]

[In]

integrate(sech(b*x+a)^2*sinh(b*x+a)^2,x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.54 \[ \int \tanh ^2(a+b x) \, dx=x+\frac {2}{b\,\left ({\mathrm {e}}^{2\,a+2\,b\,x}+1\right )} \]

[In]

int(sinh(a + b*x)^2/cosh(a + b*x)^2,x)

[Out]

x + 2/(b*(exp(2*a + 2*b*x) + 1))