### 3.576 $$\int \frac{1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx$$

Optimal. Leaf size=8 $2 \coth (x)-x$

[Out]

-x + 2*Coth[x]

________________________________________________________________________________________

Rubi [A]  time = 0.0433169, antiderivative size = 8, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 17, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.235, Rules used = {3171, 3175, 3767, 8} $2 \coth (x)-x$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

-x + 2*Coth[x]

Rule 3171

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 3175

Int[(u_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Dist[a^p, Int[ActivateTrig[u*cos[e + f*x
]^(2*p)], x], x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a + b, 0] && IntegerQ[p]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, 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 \int \text{csch}^2(x) \, dx\\ &=-x+2 i \operatorname{Subst}(\int 1 \, dx,x,-i \coth (x))\\ &=-x+2 \coth (x)\\ \end{align*}

Mathematica [A]  time = 0.0061044, size = 8, normalized size = 1. $2 \coth (x)-x$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

-x + 2*Coth[x]

________________________________________________________________________________________

Maple [B]  time = 0.022, size = 28, normalized size = 3.5 \begin{align*} \tanh \left ({\frac{x}{2}} \right ) -\ln \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) + \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{-1}+\ln \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.07999, size = 19, normalized size = 2.38 \begin{align*} -x - \frac{4}{e^{\left (-2 \, x\right )} - 1} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B]  time = 2.37461, size = 54, normalized size = 6.75 \begin{align*} -\frac{{\left (x + 2\right )} \sinh \left (x\right ) - 2 \, \cosh \left (x\right )}{\sinh \left (x\right )} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [B]  time = 1.58885, size = 12, normalized size = 1.5 \begin{align*} - x + \tanh{\left (\frac{x}{2} \right )} + \frac{1}{\tanh{\left (\frac{x}{2} \right )}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x + tanh(x/2) + 1/tanh(x/2)

________________________________________________________________________________________

Giac [A]  time = 1.16469, size = 19, normalized size = 2.38 \begin{align*} -x + \frac{4}{e^{\left (2 \, x\right )} - 1} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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