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

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (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 = 17, antiderivative size = 8 \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=-x+2 \coth (x) \]

[Out]

-x+2*coth(x)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 8, 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.235, Rules used = {3250, 3254, 3852, 8} \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=2 \coth (x)-x \]

[In]

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

[Out]

-x + 2*Coth[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

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 3254

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 3852

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]

Rubi steps \begin{align*} \text {integral}& = -x+2 \int \frac {1}{1-\cosh ^2(x)} \, dx \\ & = -x-2 \int \text {csch}^2(x) \, dx \\ & = -x+2 i \text {Subst}(\int 1 \, dx,x,-i \coth (x)) \\ & = -x+2 \coth (x) \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.04 (sec) , antiderivative size = 18, normalized size of antiderivative = 2.25 \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=\coth (x)+\coth (x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},\tanh ^2(x)\right ) \]

[In]

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

[Out]

Coth[x] + Coth[x]*Hypergeometric2F1[-1/2, 1, 1/2, Tanh[x]^2]

Maple [A] (verified)

Time = 0.24 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.12

method result size
parallelrisch \(-x +2 \coth \left (x \right )\) \(9\)
risch \(-x +\frac {4}{{\mathrm e}^{2 x}-1}\) \(15\)
default \(\tanh \left (\frac {x}{2}\right )-\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )+\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )+\frac {1}{\tanh \left (\frac {x}{2}\right )}\) \(28\)

[In]

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

[Out]

-x+2*coth(x)

Fricas [B] (verification not implemented)

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

Time = 0.26 (sec) , antiderivative size = 17, normalized size of antiderivative = 2.12 \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=-\frac {{\left (x + 2\right )} \sinh \left (x\right ) - 2 \, \cosh \left (x\right )}{\sinh \left (x\right )} \]

[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] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 12 vs. \(2 (5) = 10\).

Time = 0.37 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.50 \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=- x + \tanh {\left (\frac {x}{2} \right )} + \frac {1}{\tanh {\left (\frac {x}{2} \right )}} \]

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.75 \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=-x - \frac {4}{e^{\left (-2 \, x\right )} - 1} \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.75 \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=-x + \frac {4}{e^{\left (2 \, x\right )} - 1} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.75 \[ \int \frac {1+\cosh ^2(x)}{1-\cosh ^2(x)} \, dx=\frac {4}{{\mathrm {e}}^{2\,x}-1}-x \]

[In]

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

[Out]

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