\(\int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx\) [239]

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

Optimal result

Integrand size = 11, antiderivative size = 85 \[ \int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx=\frac {2 a b \arctan (\sinh (x))}{\left (a^2+b^2\right )^2}+\frac {\left (a^2-b^2\right ) \log (\cosh (x))}{\left (a^2+b^2\right )^2}-\frac {\left (a^2-b^2\right ) \log (a+b \sinh (x))}{\left (a^2+b^2\right )^2}+\frac {a}{\left (a^2+b^2\right ) (a+b \sinh (x))} \]

[Out]

2*a*b*arctan(sinh(x))/(a^2+b^2)^2+(a^2-b^2)*ln(cosh(x))/(a^2+b^2)^2-(a^2-b^2)*ln(a+b*sinh(x))/(a^2+b^2)^2+a/(a
^2+b^2)/(a+b*sinh(x))

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.455, Rules used = {2800, 815, 649, 209, 266} \[ \int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx=\frac {2 a b \arctan (\sinh (x))}{\left (a^2+b^2\right )^2}+\frac {a}{\left (a^2+b^2\right ) (a+b \sinh (x))}-\frac {\left (a^2-b^2\right ) \log (a+b \sinh (x))}{\left (a^2+b^2\right )^2}+\frac {\left (a^2-b^2\right ) \log (\cosh (x))}{\left (a^2+b^2\right )^2} \]

[In]

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

[Out]

(2*a*b*ArcTan[Sinh[x]])/(a^2 + b^2)^2 + ((a^2 - b^2)*Log[Cosh[x]])/(a^2 + b^2)^2 - ((a^2 - b^2)*Log[a + b*Sinh
[x]])/(a^2 + b^2)^2 + a/((a^2 + b^2)*(a + b*Sinh[x]))

Rule 209

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

Rule 266

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 649

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[(-a)*c]

Rule 815

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(
d + e*x)^m*((f + g*x)/(a + c*x^2)), x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[c*d^2 + a*e^2, 0] && Integer
Q[m]

Rule 2800

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/f, Subst[I
nt[(x^p*(a + x)^m)/(b^2 - x^2)^((p + 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && NeQ[a^2
 - b^2, 0] && IntegerQ[(p + 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {x}{(a+x)^2 \left (-b^2-x^2\right )} \, dx,x,b \sinh (x)\right ) \\ & = -\text {Subst}\left (\int \left (\frac {a}{\left (a^2+b^2\right ) (a+x)^2}+\frac {a^2-b^2}{\left (a^2+b^2\right )^2 (a+x)}+\frac {-2 a b^2-\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2 \left (b^2+x^2\right )}\right ) \, dx,x,b \sinh (x)\right ) \\ & = -\frac {\left (a^2-b^2\right ) \log (a+b \sinh (x))}{\left (a^2+b^2\right )^2}+\frac {a}{\left (a^2+b^2\right ) (a+b \sinh (x))}-\frac {\text {Subst}\left (\int \frac {-2 a b^2-\left (a^2-b^2\right ) x}{b^2+x^2} \, dx,x,b \sinh (x)\right )}{\left (a^2+b^2\right )^2} \\ & = -\frac {\left (a^2-b^2\right ) \log (a+b \sinh (x))}{\left (a^2+b^2\right )^2}+\frac {a}{\left (a^2+b^2\right ) (a+b \sinh (x))}+\frac {\left (2 a b^2\right ) \text {Subst}\left (\int \frac {1}{b^2+x^2} \, dx,x,b \sinh (x)\right )}{\left (a^2+b^2\right )^2}+\frac {\left (a^2-b^2\right ) \text {Subst}\left (\int \frac {x}{b^2+x^2} \, dx,x,b \sinh (x)\right )}{\left (a^2+b^2\right )^2} \\ & = \frac {2 a b \arctan (\sinh (x))}{\left (a^2+b^2\right )^2}+\frac {\left (a^2-b^2\right ) \log (\cosh (x))}{\left (a^2+b^2\right )^2}-\frac {\left (a^2-b^2\right ) \log (a+b \sinh (x))}{\left (a^2+b^2\right )^2}+\frac {a}{\left (a^2+b^2\right ) (a+b \sinh (x))} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.18 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.72 \[ \int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx=\frac {a \left ((a-i b)^2 \log (i-\sinh (x))+(a+i b)^2 \log (i+\sinh (x))+2 \left (a^2+b^2+\left (-a^2+b^2\right ) \log (a+b \sinh (x))\right )\right )+b \left ((a-i b)^2 \log (i-\sinh (x))+(a+i b)^2 \log (i+\sinh (x))+2 \left (-a^2+b^2\right ) \log (a+b \sinh (x))\right ) \sinh (x)}{2 \left (a^2+b^2\right )^2 (a+b \sinh (x))} \]

[In]

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

[Out]

(a*((a - I*b)^2*Log[I - Sinh[x]] + (a + I*b)^2*Log[I + Sinh[x]] + 2*(a^2 + b^2 + (-a^2 + b^2)*Log[a + b*Sinh[x
]])) + b*((a - I*b)^2*Log[I - Sinh[x]] + (a + I*b)^2*Log[I + Sinh[x]] + 2*(-a^2 + b^2)*Log[a + b*Sinh[x]])*Sin
h[x])/(2*(a^2 + b^2)^2*(a + b*Sinh[x]))

Maple [A] (verified)

Time = 0.68 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.60

method result size
default \(-\frac {2 \left (\frac {\left (-a^{2} b -b^{3}\right ) \tanh \left (\frac {x}{2}\right )}{\tanh \left (\frac {x}{2}\right )^{2} a -2 b \tanh \left (\frac {x}{2}\right )-a}+\frac {\left (a^{2}-b^{2}\right ) \ln \left (\tanh \left (\frac {x}{2}\right )^{2} a -2 b \tanh \left (\frac {x}{2}\right )-a \right )}{2}\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {2 \left (a^{2}-b^{2}\right ) \ln \left (1+\tanh \left (\frac {x}{2}\right )^{2}\right )+8 a b \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{2 a^{4}+4 a^{2} b^{2}+2 b^{4}}\) \(136\)
risch \(\frac {2 a \,{\mathrm e}^{x}}{\left (a^{2}+b^{2}\right ) \left (b \,{\mathrm e}^{2 x}+2 \,{\mathrm e}^{x} a -b \right )}+\frac {2 i \ln \left ({\mathrm e}^{x}+i\right ) a b}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {\ln \left ({\mathrm e}^{x}+i\right ) a^{2}}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {\ln \left ({\mathrm e}^{x}+i\right ) b^{2}}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {2 i \ln \left ({\mathrm e}^{x}-i\right ) a b}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {\ln \left ({\mathrm e}^{x}-i\right ) a^{2}}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {\ln \left ({\mathrm e}^{x}-i\right ) b^{2}}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {\ln \left ({\mathrm e}^{2 x}+\frac {2 a \,{\mathrm e}^{x}}{b}-1\right ) a^{2}}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {\ln \left ({\mathrm e}^{2 x}+\frac {2 a \,{\mathrm e}^{x}}{b}-1\right ) b^{2}}{a^{4}+2 a^{2} b^{2}+b^{4}}\) \(272\)

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 423 vs. \(2 (85) = 170\).

Time = 0.29 (sec) , antiderivative size = 423, normalized size of antiderivative = 4.98 \[ \int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx=-\frac {4 \, {\left (a b^{2} \cosh \left (x\right )^{2} + a b^{2} \sinh \left (x\right )^{2} + 2 \, a^{2} b \cosh \left (x\right ) - a b^{2} + 2 \, {\left (a b^{2} \cosh \left (x\right ) + a^{2} b\right )} \sinh \left (x\right )\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) + 2 \, {\left (a^{3} + a b^{2}\right )} \cosh \left (x\right ) + {\left (a^{2} b - b^{3} - {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right )^{2} - {\left (a^{2} b - b^{3}\right )} \sinh \left (x\right )^{2} - 2 \, {\left (a^{3} - a b^{2}\right )} \cosh \left (x\right ) - 2 \, {\left (a^{3} - a b^{2} + {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \log \left (\frac {2 \, {\left (b \sinh \left (x\right ) + a\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) - {\left (a^{2} b - b^{3} - {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right )^{2} - {\left (a^{2} b - b^{3}\right )} \sinh \left (x\right )^{2} - 2 \, {\left (a^{3} - a b^{2}\right )} \cosh \left (x\right ) - 2 \, {\left (a^{3} - a b^{2} + {\left (a^{2} b - b^{3}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 2 \, {\left (a^{3} + a b^{2}\right )} \sinh \left (x\right )}{a^{4} b + 2 \, a^{2} b^{3} + b^{5} - {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \cosh \left (x\right )^{2} - {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \sinh \left (x\right )^{2} - 2 \, {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} \cosh \left (x\right ) - 2 \, {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4} + {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )} \]

[In]

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

[Out]

-(4*(a*b^2*cosh(x)^2 + a*b^2*sinh(x)^2 + 2*a^2*b*cosh(x) - a*b^2 + 2*(a*b^2*cosh(x) + a^2*b)*sinh(x))*arctan(c
osh(x) + sinh(x)) + 2*(a^3 + a*b^2)*cosh(x) + (a^2*b - b^3 - (a^2*b - b^3)*cosh(x)^2 - (a^2*b - b^3)*sinh(x)^2
 - 2*(a^3 - a*b^2)*cosh(x) - 2*(a^3 - a*b^2 + (a^2*b - b^3)*cosh(x))*sinh(x))*log(2*(b*sinh(x) + a)/(cosh(x) -
 sinh(x))) - (a^2*b - b^3 - (a^2*b - b^3)*cosh(x)^2 - (a^2*b - b^3)*sinh(x)^2 - 2*(a^3 - a*b^2)*cosh(x) - 2*(a
^3 - a*b^2 + (a^2*b - b^3)*cosh(x))*sinh(x))*log(2*cosh(x)/(cosh(x) - sinh(x))) + 2*(a^3 + a*b^2)*sinh(x))/(a^
4*b + 2*a^2*b^3 + b^5 - (a^4*b + 2*a^2*b^3 + b^5)*cosh(x)^2 - (a^4*b + 2*a^2*b^3 + b^5)*sinh(x)^2 - 2*(a^5 + 2
*a^3*b^2 + a*b^4)*cosh(x) - 2*(a^5 + 2*a^3*b^2 + a*b^4 + (a^4*b + 2*a^2*b^3 + b^5)*cosh(x))*sinh(x))

Sympy [F]

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

[In]

integrate(tanh(x)/(a+b*sinh(x))**2,x)

[Out]

Integral(tanh(x)/(a + b*sinh(x))**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.34 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.82 \[ \int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx=-\frac {4 \, a b \arctan \left (e^{\left (-x\right )}\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, a e^{\left (-x\right )}}{a^{2} b + b^{3} + 2 \, {\left (a^{3} + a b^{2}\right )} e^{\left (-x\right )} - {\left (a^{2} b + b^{3}\right )} e^{\left (-2 \, x\right )}} - \frac {{\left (a^{2} - b^{2}\right )} \log \left (-2 \, a e^{\left (-x\right )} + b e^{\left (-2 \, x\right )} - b\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {{\left (a^{2} - b^{2}\right )} \log \left (e^{\left (-2 \, x\right )} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} \]

[In]

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

[Out]

-4*a*b*arctan(e^(-x))/(a^4 + 2*a^2*b^2 + b^4) + 2*a*e^(-x)/(a^2*b + b^3 + 2*(a^3 + a*b^2)*e^(-x) - (a^2*b + b^
3)*e^(-2*x)) - (a^2 - b^2)*log(-2*a*e^(-x) + b*e^(-2*x) - b)/(a^4 + 2*a^2*b^2 + b^4) + (a^2 - b^2)*log(e^(-2*x
) + 1)/(a^4 + 2*a^2*b^2 + b^4)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 199 vs. \(2 (85) = 170\).

Time = 0.29 (sec) , antiderivative size = 199, normalized size of antiderivative = 2.34 \[ \int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx=\frac {{\left (\pi + 2 \, \arctan \left (\frac {1}{2} \, {\left (e^{\left (2 \, x\right )} - 1\right )} e^{\left (-x\right )}\right )\right )} a b}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {{\left (a^{2} - b^{2}\right )} \log \left ({\left (e^{\left (-x\right )} - e^{x}\right )}^{2} + 4\right )}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} - \frac {{\left (a^{2} b - b^{3}\right )} \log \left ({\left | -b {\left (e^{\left (-x\right )} - e^{x}\right )} + 2 \, a \right |}\right )}{a^{4} b + 2 \, a^{2} b^{3} + b^{5}} + \frac {a^{2} b {\left (e^{\left (-x\right )} - e^{x}\right )} - b^{3} {\left (e^{\left (-x\right )} - e^{x}\right )} - 4 \, a^{3}}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} {\left (b {\left (e^{\left (-x\right )} - e^{x}\right )} - 2 \, a\right )}} \]

[In]

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

[Out]

(pi + 2*arctan(1/2*(e^(2*x) - 1)*e^(-x)))*a*b/(a^4 + 2*a^2*b^2 + b^4) + 1/2*(a^2 - b^2)*log((e^(-x) - e^x)^2 +
 4)/(a^4 + 2*a^2*b^2 + b^4) - (a^2*b - b^3)*log(abs(-b*(e^(-x) - e^x) + 2*a))/(a^4*b + 2*a^2*b^3 + b^5) + (a^2
*b*(e^(-x) - e^x) - b^3*(e^(-x) - e^x) - 4*a^3)/((a^4 + 2*a^2*b^2 + b^4)*(b*(e^(-x) - e^x) - 2*a))

Mupad [B] (verification not implemented)

Time = 2.55 (sec) , antiderivative size = 190, normalized size of antiderivative = 2.24 \[ \int \frac {\tanh (x)}{(a+b \sinh (x))^2} \, dx=\frac {\ln \left (1+{\mathrm {e}}^x\,1{}\mathrm {i}\right )}{a^2+a\,b\,2{}\mathrm {i}-b^2}-\frac {\ln \left (b^5\,{\mathrm {e}}^{2\,x}-a^4\,b-b^5+a^2\,b^3+2\,a^5\,{\mathrm {e}}^x-a^2\,b^3\,{\mathrm {e}}^{2\,x}+2\,a\,b^4\,{\mathrm {e}}^x+a^4\,b\,{\mathrm {e}}^{2\,x}-2\,a^3\,b^2\,{\mathrm {e}}^x\right )\,\left (a^2-b^2\right )}{a^4+2\,a^2\,b^2+b^4}+\frac {2\,a\,b\,{\mathrm {e}}^x}{\left (a^2\,b+b^3\right )\,\left (2\,a\,{\mathrm {e}}^x-b+b\,{\mathrm {e}}^{2\,x}\right )}+\frac {\ln \left ({\mathrm {e}}^x+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{a^2\,1{}\mathrm {i}+2\,a\,b-b^2\,1{}\mathrm {i}} \]

[In]

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

[Out]

log(exp(x)*1i + 1)/(a*b*2i + a^2 - b^2) + (log(exp(x) + 1i)*1i)/(2*a*b + a^2*1i - b^2*1i) - (log(b^5*exp(2*x)
- a^4*b - b^5 + a^2*b^3 + 2*a^5*exp(x) - a^2*b^3*exp(2*x) + 2*a*b^4*exp(x) + a^4*b*exp(2*x) - 2*a^3*b^2*exp(x)
)*(a^2 - b^2))/(a^4 + b^4 + 2*a^2*b^2) + (2*a*b*exp(x))/((a^2*b + b^3)*(2*a*exp(x) - b + b*exp(2*x)))