\(\int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx\) [191]

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

Optimal result

Integrand size = 13, antiderivative size = 15 \[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=\frac {\arctan (\sinh (x))}{a}-\frac {\tanh (x)}{a} \]

[Out]

arctan(sinh(x))/a-tanh(x)/a

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 15, 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.308, Rules used = {2785, 3852, 8, 3855} \[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=\frac {\arctan (\sinh (x))}{a}-\frac {\tanh (x)}{a} \]

[In]

Int[Tanh[x]^2/(a + a*Cosh[x]),x]

[Out]

ArcTan[Sinh[x]]/a - Tanh[x]/a

Rule 8

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

Rule 2785

Int[((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/a, Int[S
ec[e + f*x]^2*(g*Tan[e + f*x])^p, x], x] - Dist[1/(b*g), Int[Sec[e + f*x]*(g*Tan[e + f*x])^(p + 1), x], x] /;
FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && NeQ[p, -1]

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]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {\int \text {sech}(x) \, dx}{a}-\frac {\int \text {sech}^2(x) \, dx}{a} \\ & = \frac {\arctan (\sinh (x))}{a}-\frac {i \text {Subst}(\int 1 \, dx,x,-i \tanh (x))}{a} \\ & = \frac {\arctan (\sinh (x))}{a}-\frac {\tanh (x)}{a} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.17 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.20 \[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=\frac {2 \arctan \left (\tanh \left (\frac {x}{2}\right )\right )-\tanh (x)}{a} \]

[In]

Integrate[Tanh[x]^2/(a + a*Cosh[x]),x]

[Out]

(2*ArcTan[Tanh[x/2]] - Tanh[x])/a

Maple [A] (verified)

Time = 0.13 (sec) , antiderivative size = 30, normalized size of antiderivative = 2.00

method result size
default \(\frac {-\frac {2 \tanh \left (\frac {x}{2}\right )}{1+\tanh \left (\frac {x}{2}\right )^{2}}+2 \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{a}\) \(30\)
risch \(\frac {2}{a \left (1+{\mathrm e}^{2 x}\right )}+\frac {i \ln \left ({\mathrm e}^{x}+i\right )}{a}-\frac {i \ln \left ({\mathrm e}^{x}-i\right )}{a}\) \(39\)

[In]

int(tanh(x)^2/(a+a*cosh(x)),x,method=_RETURNVERBOSE)

[Out]

4/a*(-1/2*tanh(1/2*x)/(1+tanh(1/2*x)^2)+1/2*arctan(tanh(1/2*x)))

Fricas [B] (verification not implemented)

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

Time = 0.25 (sec) , antiderivative size = 50, normalized size of antiderivative = 3.33 \[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=\frac {2 \, {\left ({\left (\cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right ) \sinh \left (x\right ) + \sinh \left (x\right )^{2} + 1\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) + 1\right )}}{a \cosh \left (x\right )^{2} + 2 \, a \cosh \left (x\right ) \sinh \left (x\right ) + a \sinh \left (x\right )^{2} + a} \]

[In]

integrate(tanh(x)^2/(a+a*cosh(x)),x, algorithm="fricas")

[Out]

2*((cosh(x)^2 + 2*cosh(x)*sinh(x) + sinh(x)^2 + 1)*arctan(cosh(x) + sinh(x)) + 1)/(a*cosh(x)^2 + 2*a*cosh(x)*s
inh(x) + a*sinh(x)^2 + a)

Sympy [F]

\[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=\frac {\int \frac {\tanh ^{2}{\left (x \right )}}{\cosh {\left (x \right )} + 1}\, dx}{a} \]

[In]

integrate(tanh(x)**2/(a+a*cosh(x)),x)

[Out]

Integral(tanh(x)**2/(cosh(x) + 1), x)/a

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.53 \[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=-\frac {2 \, \arctan \left (e^{\left (-x\right )}\right )}{a} - \frac {2}{a e^{\left (-2 \, x\right )} + a} \]

[In]

integrate(tanh(x)^2/(a+a*cosh(x)),x, algorithm="maxima")

[Out]

-2*arctan(e^(-x))/a - 2/(a*e^(-2*x) + a)

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.47 \[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=\frac {2 \, \arctan \left (e^{x}\right )}{a} + \frac {2}{a {\left (e^{\left (2 \, x\right )} + 1\right )}} \]

[In]

integrate(tanh(x)^2/(a+a*cosh(x)),x, algorithm="giac")

[Out]

2*arctan(e^x)/a + 2/(a*(e^(2*x) + 1))

Mupad [B] (verification not implemented)

Time = 1.65 (sec) , antiderivative size = 33, normalized size of antiderivative = 2.20 \[ \int \frac {\tanh ^2(x)}{a+a \cosh (x)} \, dx=\frac {2}{a\,\left ({\mathrm {e}}^{2\,x}+1\right )}+\frac {2\,\mathrm {atan}\left (\frac {{\mathrm {e}}^x\,\sqrt {a^2}}{a}\right )}{\sqrt {a^2}} \]

[In]

int(tanh(x)^2/(a + a*cosh(x)),x)

[Out]

2/(a*(exp(2*x) + 1)) + (2*atan((exp(x)*(a^2)^(1/2))/a))/(a^2)^(1/2)