\(\int \tanh (a+b x) \, dx\) [6]

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

Optimal result

Integrand size = 6, antiderivative size = 11 \[ \int \tanh (a+b x) \, dx=\frac {\log (\cosh (a+b x))}{b} \]

[Out]

ln(cosh(b*x+a))/b

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3556} \[ \int \tanh (a+b x) \, dx=\frac {\log (\cosh (a+b x))}{b} \]

[In]

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

[Out]

Log[Cosh[a + b*x]]/b

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {\log (\cosh (a+b x))}{b} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \tanh (a+b x) \, dx=\frac {\log (\cosh (a+b x))}{b} \]

[In]

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

[Out]

Log[Cosh[a + b*x]]/b

Maple [A] (verified)

Time = 0.03 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.09

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

[In]

int(tanh(b*x+a),x,method=_RETURNVERBOSE)

[Out]

ln(cosh(b*x+a))/b

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 37 vs. \(2 (11) = 22\).

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

[In]

integrate(tanh(b*x+a),x, algorithm="fricas")

[Out]

-(b*x - log(2*cosh(b*x + a)/(cosh(b*x + a) - sinh(b*x + a))))/b

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 17 vs. \(2 (8) = 16\).

Time = 0.07 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.55 \[ \int \tanh (a+b x) \, dx=\begin {cases} x - \frac {\log {\left (\tanh {\left (a + b x \right )} + 1 \right )}}{b} & \text {for}\: b \neq 0 \\x \tanh {\left (a \right )} & \text {otherwise} \end {cases} \]

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \tanh (a+b x) \, dx=\frac {\log \left (\cosh \left (b x + a\right )\right )}{b} \]

[In]

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

[Out]

log(cosh(b*x + a))/b

Giac [B] (verification not implemented)

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

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 1.69 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.45 \[ \int \tanh (a+b x) \, dx=x-\frac {\ln \left (\mathrm {tanh}\left (a+b\,x\right )+1\right )}{b} \]

[In]

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

[Out]

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