\(\int \frac {\tanh (x)}{a+b \text {sech}(x)} \, dx\) [119]

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

Optimal result

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

[Out]

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

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.364, Rules used = {3970, 36, 29, 31} \[ \int \frac {\tanh (x)}{a+b \text {sech}(x)} \, dx=\frac {\log (a+b \text {sech}(x))}{a}+\frac {\log (\cosh (x))}{a} \]

[In]

Int[Tanh[x]/(a + b*Sech[x]),x]

[Out]

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

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 36

Int[1/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[b/(b*c - a*d), Int[1/(a + b*x), x], x] -
Dist[d/(b*c - a*d), Int[1/(c + d*x), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0]

Rule 3970

Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n_), x_Symbol] :> Dist[-(-1)^((m - 1
)/2)/(d*b^(m - 1)), Subst[Int[(b^2 - x^2)^((m - 1)/2)*((a + x)^n/x), x], x, b*Csc[c + d*x]], x] /; FreeQ[{a, b
, c, d, n}, x] && IntegerQ[(m - 1)/2] && NeQ[a^2 - b^2, 0]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {1}{x (a+x)} \, dx,x,b \text {sech}(x)\right ) \\ & = -\frac {\text {Subst}\left (\int \frac {1}{x} \, dx,x,b \text {sech}(x)\right )}{a}+\frac {\text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \text {sech}(x)\right )}{a} \\ & = \frac {\log (\cosh (x))}{a}+\frac {\log (a+b \text {sech}(x))}{a} \\ \end{align*}

Mathematica [A] (verified)

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

[In]

Integrate[Tanh[x]/(a + b*Sech[x]),x]

[Out]

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

Maple [A] (verified)

Time = 0.18 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.11

method result size
derivativedivides \(-\frac {\ln \left (\operatorname {sech}\left (x \right )\right )}{a}+\frac {\ln \left (a +b \,\operatorname {sech}\left (x \right )\right )}{a}\) \(21\)
default \(-\frac {\ln \left (\operatorname {sech}\left (x \right )\right )}{a}+\frac {\ln \left (a +b \,\operatorname {sech}\left (x \right )\right )}{a}\) \(21\)
risch \(-\frac {x}{a}+\frac {\ln \left ({\mathrm e}^{2 x}+\frac {2 b \,{\mathrm e}^{x}}{a}+1\right )}{a}\) \(27\)

[In]

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

[Out]

-1/a*ln(sech(x))+ln(a+b*sech(x))/a

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.42 \[ \int \frac {\tanh (x)}{a+b \text {sech}(x)} \, dx=-\frac {x - \log \left (\frac {2 \, {\left (a \cosh \left (x\right ) + b\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a} \]

[In]

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

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 41 vs. \(2 (15) = 30\).

Time = 0.16 (sec) , antiderivative size = 41, normalized size of antiderivative = 2.16 \[ \int \frac {\tanh (x)}{a+b \text {sech}(x)} \, dx=\begin {cases} \frac {\tilde {\infty }}{\operatorname {sech}{\left (x \right )}} & \text {for}\: a = 0 \wedge b = 0 \\\frac {1}{b \operatorname {sech}{\left (x \right )}} & \text {for}\: a = 0 \\\frac {x - \log {\left (\tanh {\left (x \right )} + 1 \right )}}{a} & \text {for}\: b = 0 \\\frac {x}{a} + \frac {\log {\left (\frac {a}{b} + \operatorname {sech}{\left (x \right )} \right )}}{a} - \frac {\log {\left (\tanh {\left (x \right )} + 1 \right )}}{a} & \text {otherwise} \end {cases} \]

[In]

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

[Out]

Piecewise((zoo/sech(x), Eq(a, 0) & Eq(b, 0)), (1/(b*sech(x)), Eq(a, 0)), ((x - log(tanh(x) + 1))/a, Eq(b, 0)),
 (x/a + log(a/b + sech(x))/a - log(tanh(x) + 1)/a, True))

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.37 \[ \int \frac {\tanh (x)}{a+b \text {sech}(x)} \, dx=\frac {x}{a} + \frac {\log \left (2 \, b e^{\left (-x\right )} + a e^{\left (-2 \, x\right )} + a\right )}{a} \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00 \[ \int \frac {\tanh (x)}{a+b \text {sech}(x)} \, dx=\frac {\log \left ({\left | a {\left (e^{\left (-x\right )} + e^{x}\right )} + 2 \, b \right |}\right )}{a} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.21 \[ \int \frac {\tanh (x)}{a+b \text {sech}(x)} \, dx=-\frac {x-\ln \left (a+2\,b\,{\mathrm {e}}^x+a\,{\mathrm {e}}^{2\,x}\right )}{a} \]

[In]

int(tanh(x)/(a + b/cosh(x)),x)

[Out]

-(x - log(a + 2*b*exp(x) + a*exp(2*x)))/a