3.6.77 \(\int \frac {1-\cosh ^2(x)}{1+\cosh ^2(x)} \, dx\) [577]

Optimal. Leaf size=19 \[ -x+\sqrt {2} \tanh ^{-1}\left (\frac {\tanh (x)}{\sqrt {2}}\right ) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3250, 3260, 212} \begin {gather*} \sqrt {2} \tanh ^{-1}\left (\frac {\tanh (x)}{\sqrt {2}}\right )-x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(1 - Cosh[x]^2)/(1 + Cosh[x]^2),x]

[Out]

-x + Sqrt[2]*ArcTanh[Tanh[x]/Sqrt[2]]

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])

Rule 3250

Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)]^2)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[B*(x
/b), x] + Dist[(A*b - a*B)/b, Int[1/(a + b*Sin[e + f*x]^2), x], x] /; FreeQ[{a, b, e, f, A, B}, x]

Rule 3260

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[1/(a + (a + b)*ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 24, normalized size = 1.26 \begin {gather*} -2 \left (\frac {x}{2}-\frac {\tanh ^{-1}\left (\frac {\tanh (x)}{\sqrt {2}}\right )}{\sqrt {2}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(1 - Cosh[x]^2)/(1 + Cosh[x]^2),x]

[Out]

-2*(x/2 - ArcTanh[Tanh[x]/Sqrt[2]]/Sqrt[2])

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(155\) vs. \(2(16)=32\).
time = 0.67, size = 156, normalized size = 8.21

method result size
risch \(-x +\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 x}+3-2 \sqrt {2}\right )}{2}-\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 x}+3+2 \sqrt {2}\right )}{2}\) \(39\)
default \(-\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )+\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )+\frac {\sqrt {2}\, \left (\ln \left (\frac {\tanh ^{2}\left (\frac {x}{2}\right )+\tanh \left (\frac {x}{2}\right ) \sqrt {2}+1}{\tanh ^{2}\left (\frac {x}{2}\right )-\tanh \left (\frac {x}{2}\right ) \sqrt {2}+1}\right )+2 \arctan \left (\tanh \left (\frac {x}{2}\right ) \sqrt {2}+1\right )+2 \arctan \left (\tanh \left (\frac {x}{2}\right ) \sqrt {2}-1\right )\right )}{4}-\frac {\sqrt {2}\, \left (\ln \left (\frac {\tanh ^{2}\left (\frac {x}{2}\right )-\tanh \left (\frac {x}{2}\right ) \sqrt {2}+1}{\tanh ^{2}\left (\frac {x}{2}\right )+\tanh \left (\frac {x}{2}\right ) \sqrt {2}+1}\right )+2 \arctan \left (\tanh \left (\frac {x}{2}\right ) \sqrt {2}+1\right )+2 \arctan \left (\tanh \left (\frac {x}{2}\right ) \sqrt {2}-1\right )\right )}{4}\) \(156\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((1-cosh(x)^2)/(cosh(x)^2+1),x,method=_RETURNVERBOSE)

[Out]

-ln(tanh(1/2*x)+1)+ln(tanh(1/2*x)-1)+1/4*2^(1/2)*(ln((tanh(1/2*x)^2+tanh(1/2*x)*2^(1/2)+1)/(tanh(1/2*x)^2-tanh
(1/2*x)*2^(1/2)+1))+2*arctan(tanh(1/2*x)*2^(1/2)+1)+2*arctan(tanh(1/2*x)*2^(1/2)-1))-1/4*2^(1/2)*(ln((tanh(1/2
*x)^2-tanh(1/2*x)*2^(1/2)+1)/(tanh(1/2*x)^2+tanh(1/2*x)*2^(1/2)+1))+2*arctan(tanh(1/2*x)*2^(1/2)+1)+2*arctan(t
anh(1/2*x)*2^(1/2)-1))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 102 vs. \(2 (16) = 32\).
time = 0.48, size = 102, normalized size = 5.37 \begin {gather*} \frac {3}{16} \, \sqrt {2} \log \left (-\frac {2 \, \sqrt {2} - e^{\left (2 \, x\right )} - 3}{2 \, \sqrt {2} + e^{\left (2 \, x\right )} + 3}\right ) - \frac {5}{16} \, \sqrt {2} \log \left (-\frac {2 \, \sqrt {2} - e^{\left (-2 \, x\right )} - 3}{2 \, \sqrt {2} + e^{\left (-2 \, x\right )} + 3}\right ) - 2 \, x + \frac {1}{4} \, \log \left (e^{\left (4 \, x\right )} + 6 \, e^{\left (2 \, x\right )} + 1\right ) - \frac {1}{4} \, \log \left (6 \, e^{\left (-2 \, x\right )} + e^{\left (-4 \, x\right )} + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-cosh(x)^2)/(1+cosh(x)^2),x, algorithm="maxima")

[Out]

3/16*sqrt(2)*log(-(2*sqrt(2) - e^(2*x) - 3)/(2*sqrt(2) + e^(2*x) + 3)) - 5/16*sqrt(2)*log(-(2*sqrt(2) - e^(-2*
x) - 3)/(2*sqrt(2) + e^(-2*x) + 3)) - 2*x + 1/4*log(e^(4*x) + 6*e^(2*x) + 1) - 1/4*log(6*e^(-2*x) + e^(-4*x) +
 1)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 70 vs. \(2 (16) = 32\).
time = 0.44, size = 70, normalized size = 3.68 \begin {gather*} \frac {1}{2} \, \sqrt {2} \log \left (-\frac {3 \, {\left (2 \, \sqrt {2} - 3\right )} \cosh \left (x\right )^{2} - 4 \, {\left (3 \, \sqrt {2} - 4\right )} \cosh \left (x\right ) \sinh \left (x\right ) + 3 \, {\left (2 \, \sqrt {2} - 3\right )} \sinh \left (x\right )^{2} + 2 \, \sqrt {2} - 3}{\cosh \left (x\right )^{2} + \sinh \left (x\right )^{2} + 3}\right ) - x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-cosh(x)^2)/(1+cosh(x)^2),x, algorithm="fricas")

[Out]

1/2*sqrt(2)*log(-(3*(2*sqrt(2) - 3)*cosh(x)^2 - 4*(3*sqrt(2) - 4)*cosh(x)*sinh(x) + 3*(2*sqrt(2) - 3)*sinh(x)^
2 + 2*sqrt(2) - 3)/(cosh(x)^2 + sinh(x)^2 + 3)) - x

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 61 vs. \(2 (17) = 34\).
time = 1.11, size = 61, normalized size = 3.21 \begin {gather*} - x - \frac {\sqrt {2} \log {\left (4 \tanh ^{2}{\left (\frac {x}{2} \right )} - 4 \sqrt {2} \tanh {\left (\frac {x}{2} \right )} + 4 \right )}}{2} + \frac {\sqrt {2} \log {\left (4 \tanh ^{2}{\left (\frac {x}{2} \right )} + 4 \sqrt {2} \tanh {\left (\frac {x}{2} \right )} + 4 \right )}}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-cosh(x)**2)/(1+cosh(x)**2),x)

[Out]

-x - sqrt(2)*log(4*tanh(x/2)**2 - 4*sqrt(2)*tanh(x/2) + 4)/2 + sqrt(2)*log(4*tanh(x/2)**2 + 4*sqrt(2)*tanh(x/2
) + 4)/2

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 38 vs. \(2 (16) = 32\).
time = 0.42, size = 38, normalized size = 2.00 \begin {gather*} \frac {1}{2} \, \sqrt {2} \log \left (-\frac {2 \, \sqrt {2} - e^{\left (2 \, x\right )} - 3}{2 \, \sqrt {2} + e^{\left (2 \, x\right )} + 3}\right ) - x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-cosh(x)^2)/(1+cosh(x)^2),x, algorithm="giac")

[Out]

1/2*sqrt(2)*log(-(2*sqrt(2) - e^(2*x) - 3)/(2*sqrt(2) + e^(2*x) + 3)) - x

________________________________________________________________________________________

Mupad [B]
time = 0.11, size = 56, normalized size = 2.95 \begin {gather*} \frac {\sqrt {2}\,\ln \left (-8\,{\mathrm {e}}^{2\,x}-\frac {\sqrt {2}\,\left (12\,{\mathrm {e}}^{2\,x}+4\right )}{2}\right )}{2}-x-\frac {\sqrt {2}\,\ln \left (\frac {\sqrt {2}\,\left (12\,{\mathrm {e}}^{2\,x}+4\right )}{2}-8\,{\mathrm {e}}^{2\,x}\right )}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(2^(1/2)*log(- 8*exp(2*x) - (2^(1/2)*(12*exp(2*x) + 4))/2))/2 - x - (2^(1/2)*log((2^(1/2)*(12*exp(2*x) + 4))/2
 - 8*exp(2*x)))/2

________________________________________________________________________________________