### 3.694 $$\int \frac{\tanh (x)}{b \cosh (x)+a \sinh (x)} \, dx$$

Optimal. Leaf size=50 $\frac{b \tanh ^{-1}\left (\frac{a \cosh (x)+b \sinh (x)}{\sqrt{a^2-b^2}}\right )}{a \sqrt{a^2-b^2}}+\frac{\tan ^{-1}(\sinh (x))}{a}$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0964272, antiderivative size = 50, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 14, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.286, Rules used = {3110, 3770, 3074, 204} $\frac{b \tanh ^{-1}\left (\frac{a \cosh (x)+b \sinh (x)}{\sqrt{a^2-b^2}}\right )}{a \sqrt{a^2-b^2}}+\frac{\tan ^{-1}(\sinh (x))}{a}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 3110

Int[(cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.))/(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(
c_.) + (d_.)*(x_)]), x_Symbol] :> Int[ExpandTrig[(cos[c + d*x]^m*sin[c + d*x]^n)/(a*cos[c + d*x] + b*sin[c + d
*x]), x], x] /; FreeQ[{a, b, c, d, m, n}, x] && IntegersQ[m, n]

Rule 3770

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

Rule 3074

Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> -Dist[d^(-1), Subst[Int
[1/(a^2 + b^2 - x^2), x], x, b*Cos[c + d*x] - a*Sin[c + d*x]], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2,
0]

Rule 204

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

Rubi steps

\begin{align*} \int \frac{\tanh (x)}{b \cosh (x)+a \sinh (x)} \, dx &=-\left (i \int \left (\frac{i \text{sech}(x)}{a}-\frac{i b}{a (b \cosh (x)+a \sinh (x))}\right ) \, dx\right )\\ &=\frac{\int \text{sech}(x) \, dx}{a}-\frac{b \int \frac{1}{b \cosh (x)+a \sinh (x)} \, dx}{a}\\ &=\frac{\tan ^{-1}(\sinh (x))}{a}-\frac{(i b) \operatorname{Subst}\left (\int \frac{1}{-a^2+b^2-x^2} \, dx,x,-i a \cosh (x)-i b \sinh (x)\right )}{a}\\ &=\frac{\tan ^{-1}(\sinh (x))}{a}+\frac{b \tanh ^{-1}\left (\frac{a \cosh (x)+b \sinh (x)}{\sqrt{a^2-b^2}}\right )}{a \sqrt{a^2-b^2}}\\ \end{align*}

Mathematica [A]  time = 0.122382, size = 60, normalized size = 1.2 $\frac{2 \left (\tan ^{-1}\left (\tanh \left (\frac{x}{2}\right )\right )-\frac{b \tan ^{-1}\left (\frac{a+b \tanh \left (\frac{x}{2}\right )}{\sqrt{b-a} \sqrt{a+b}}\right )}{\sqrt{b-a} \sqrt{a+b}}\right )}{a}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.049, size = 54, normalized size = 1.1 \begin{align*} 2\,{\frac{\arctan \left ( \tanh \left ( x/2 \right ) \right ) }{a}}-2\,{\frac{b}{a\sqrt{-{a}^{2}+{b}^{2}}}\arctan \left ( 1/2\,{\frac{2\,\tanh \left ( x/2 \right ) b+2\,a}{\sqrt{-{a}^{2}+{b}^{2}}}} \right ) } \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

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

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 2.02501, size = 564, normalized size = 11.28 \begin{align*} \left [\frac{\sqrt{a^{2} - b^{2}} b \log \left (\frac{{\left (a + b\right )} \cosh \left (x\right )^{2} + 2 \,{\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right )^{2} + 2 \, \sqrt{a^{2} - b^{2}}{\left (\cosh \left (x\right ) + \sinh \left (x\right )\right )} + a - b}{{\left (a + b\right )} \cosh \left (x\right )^{2} + 2 \,{\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right )^{2} - a + b}\right ) + 2 \,{\left (a^{2} - b^{2}\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )}{a^{3} - a b^{2}}, -\frac{2 \,{\left (\sqrt{-a^{2} + b^{2}} b \arctan \left (\frac{\sqrt{-a^{2} + b^{2}}}{{\left (a + b\right )} \cosh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right )}\right ) -{\left (a^{2} - b^{2}\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )\right )}}{a^{3} - a b^{2}}\right ] \end{align*}

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

[In]

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

[Out]

[(sqrt(a^2 - b^2)*b*log(((a + b)*cosh(x)^2 + 2*(a + b)*cosh(x)*sinh(x) + (a + b)*sinh(x)^2 + 2*sqrt(a^2 - b^2)
*(cosh(x) + sinh(x)) + a - b)/((a + b)*cosh(x)^2 + 2*(a + b)*cosh(x)*sinh(x) + (a + b)*sinh(x)^2 - a + b)) + 2
*(a^2 - b^2)*arctan(cosh(x) + sinh(x)))/(a^3 - a*b^2), -2*(sqrt(-a^2 + b^2)*b*arctan(sqrt(-a^2 + b^2)/((a + b)
*cosh(x) + (a + b)*sinh(x))) - (a^2 - b^2)*arctan(cosh(x) + sinh(x)))/(a^3 - a*b^2)]

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\tanh{\left (x \right )}}{a \sinh{\left (x \right )} + b \cosh{\left (x \right )}}\, dx \end{align*}

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

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.15066, size = 65, normalized size = 1.3 \begin{align*} -\frac{2 \, b \arctan \left (\frac{a e^{x} + b e^{x}}{\sqrt{-a^{2} + b^{2}}}\right )}{\sqrt{-a^{2} + b^{2}} a} + \frac{2 \, \arctan \left (e^{x}\right )}{a} \end{align*}

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

[In]

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

[Out]

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