3.10.83 \(\int \text {sech}^2(x) (1+\frac {1}{1-\tanh ^2(x)}) \, dx\) [983]

Optimal. Leaf size=4 \[ x+\tanh (x) \]

[Out]

x+tanh(x)

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 4, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 1, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.059, Rules used = {212} \begin {gather*} x+\tanh (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sech[x]^2*(1 + (1 - Tanh[x]^2)^(-1)),x]

[Out]

x + Tanh[x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin {align*} \int \text {sech}^2(x) \left (1+\frac {1}{1-\tanh ^2(x)}\right ) \, dx &=\text {Subst}\left (\int \left (1+\frac {1}{1-x^2}\right ) \, dx,x,\tanh (x)\right )\\ &=\tanh (x)+\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\tanh (x)\right )\\ &=x+\tanh (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 4, normalized size = 1.00 \begin {gather*} x+\tanh (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sech[x]^2*(1 + (1 - Tanh[x]^2)^(-1)),x]

[Out]

x + Tanh[x]

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(33\) vs. \(2(4)=8\).
time = 0.88, size = 34, normalized size = 8.50

method result size
risch \(x -\frac {2}{1+{\mathrm e}^{2 x}}\) \(13\)
default \(\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )-\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )+\frac {2 \tanh \left (\frac {x}{2}\right )}{\tanh ^{2}\left (\frac {x}{2}\right )+1}\) \(34\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sech(x)^2*(1+1/(1-tanh(x)^2)),x,method=_RETURNVERBOSE)

[Out]

ln(tanh(1/2*x)+1)-ln(tanh(1/2*x)-1)+2*tanh(1/2*x)/(tanh(1/2*x)^2+1)

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 12 vs. \(2 (4) = 8\).
time = 0.26, size = 12, normalized size = 3.00 \begin {gather*} x + \frac {2}{e^{\left (-2 \, x\right )} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)^2*(1+1/(1-tanh(x)^2)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 14 vs. \(2 (4) = 8\).
time = 0.36, size = 14, normalized size = 3.50 \begin {gather*} \frac {{\left (x - 1\right )} \cosh \left (x\right ) + \sinh \left (x\right )}{\cosh \left (x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)^2*(1+1/(1-tanh(x)^2)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 29 vs. \(2 (3) = 6\).
time = 0.30, size = 29, normalized size = 7.25 \begin {gather*} - \frac {x \operatorname {sech}^{2}{\left (x \right )}}{\tanh ^{2}{\left (x \right )} - 1} - \frac {\tanh {\left (x \right )} \operatorname {sech}^{2}{\left (x \right )}}{\tanh ^{2}{\left (x \right )} - 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)**2*(1+1/(1-tanh(x)**2)),x)

[Out]

-x*sech(x)**2/(tanh(x)**2 - 1) - tanh(x)*sech(x)**2/(tanh(x)**2 - 1)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 12 vs. \(2 (4) = 8\).
time = 0.42, size = 12, normalized size = 3.00 \begin {gather*} x - \frac {2}{e^{\left (2 \, x\right )} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)^2*(1+1/(1-tanh(x)^2)),x, algorithm="giac")

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 1.72, size = 12, normalized size = 3.00 \begin {gather*} x-\frac {2}{{\mathrm {e}}^{2\,x}+1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(1/(tanh(x)^2 - 1) - 1)/cosh(x)^2,x)

[Out]

x - 2/(exp(2*x) + 1)

________________________________________________________________________________________