3.5 \(\int \tanh ^2(a+b x) \, dx\)

Optimal. Leaf size=13 \[ x-\frac{\tanh (a+b x)}{b} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0085303, antiderivative size = 13, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 8, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.25, Rules used = {3473, 8} \[ x-\frac{\tanh (a+b x)}{b} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 3473

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]

Rule 8

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

Rubi steps

\begin{align*} \int \tanh ^2(a+b x) \, dx &=-\frac{\tanh (a+b x)}{b}+\int 1 \, dx\\ &=x-\frac{\tanh (a+b x)}{b}\\ \end{align*}

Mathematica [A]  time = 0.0070453, size = 23, normalized size = 1.77 \[ \frac{\tanh ^{-1}(\tanh (a+b x))}{b}-\frac{\tanh (a+b x)}{b} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B]  time = 0.003, size = 41, normalized size = 3.2 \begin{align*} -{\frac{\tanh \left ( bx+a \right ) }{b}}-{\frac{\ln \left ( -1+\tanh \left ( bx+a \right ) \right ) }{2\,b}}+{\frac{\ln \left ( 1+\tanh \left ( bx+a \right ) \right ) }{2\,b}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(b*x+a)^2,x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.03595, size = 34, normalized size = 2.62 \begin{align*} x + \frac{a}{b} - \frac{2}{b{\left (e^{\left (-2 \, b x - 2 \, a\right )} + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 2.32793, size = 82, normalized size = 6.31 \begin{align*} \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 )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(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 [A]  time = 0.180094, size = 15, normalized size = 1.15 \begin{align*} \begin{cases} x - \frac{\tanh{\left (a + b x \right )}}{b} & \text{for}\: b \neq 0 \\x \tanh ^{2}{\left (a \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(b*x+a)**2,x)

[Out]

Piecewise((x - tanh(a + b*x)/b, Ne(b, 0)), (x*tanh(a)**2, True))

________________________________________________________________________________________

Giac [B]  time = 1.17928, size = 38, normalized size = 2.92 \begin{align*} \frac{b x + a}{b} + \frac{2}{b{\left (e^{\left (2 \, b x + 2 \, a\right )} + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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