\(\int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx\) [129]

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

Optimal result

Integrand size = 15, antiderivative size = 55 \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=\frac {B x}{b}-\frac {2 (A b-a B) \text {arctanh}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b \sqrt {a^2+b^2}} \]

[Out]

B*x/b-2*(A*b-B*a)*arctanh((b-a*tanh(1/2*x))/(a^2+b^2)^(1/2))/b/(a^2+b^2)^(1/2)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 55, 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.267, Rules used = {2814, 2739, 632, 212} \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=\frac {B x}{b}-\frac {2 (A b-a B) \text {arctanh}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b \sqrt {a^2+b^2}} \]

[In]

Int[(A + B*Sinh[x])/(a + b*Sinh[x]),x]

[Out]

(B*x)/b - (2*(A*b - a*B)*ArcTanh[(b - a*Tanh[x/2])/Sqrt[a^2 + b^2]])/(b*Sqrt[a^2 + b^2])

Rule 212

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

Rule 632

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

Rule 2739

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[2*(e/d), Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {B x}{b}-\frac {(i (i A b-i a B)) \int \frac {1}{a+b \sinh (x)} \, dx}{b} \\ & = \frac {B x}{b}-\frac {(2 i (i A b-i a B)) \text {Subst}\left (\int \frac {1}{a+2 b x-a x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{b} \\ & = \frac {B x}{b}+\frac {(4 i (i A b-i a B)) \text {Subst}\left (\int \frac {1}{4 \left (a^2+b^2\right )-x^2} \, dx,x,2 b-2 a \tanh \left (\frac {x}{2}\right )\right )}{b} \\ & = \frac {B x}{b}-\frac {2 (A b-a B) \text {arctanh}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b \sqrt {a^2+b^2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.15 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.11 \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=\frac {B x+\frac {2 (A b-a B) \arctan \left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {-a^2-b^2}}\right )}{\sqrt {-a^2-b^2}}}{b} \]

[In]

Integrate[(A + B*Sinh[x])/(a + b*Sinh[x]),x]

[Out]

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

Maple [A] (verified)

Time = 0.53 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.31

method result size
default \(\frac {B \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{b}-\frac {B \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{b}-\frac {2 \left (-A b +a B \right ) \operatorname {arctanh}\left (\frac {2 a \tanh \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{b \sqrt {a^{2}+b^{2}}}\) \(72\)
risch \(\frac {B x}{b}+\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}-a^{2}-b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right ) A}{\sqrt {a^{2}+b^{2}}}-\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}-a^{2}-b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right ) a B}{\sqrt {a^{2}+b^{2}}\, b}-\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}+a^{2}+b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right ) A}{\sqrt {a^{2}+b^{2}}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}+a^{2}+b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right ) a B}{\sqrt {a^{2}+b^{2}}\, b}\) \(210\)

[In]

int((A+B*sinh(x))/(a+b*sinh(x)),x,method=_RETURNVERBOSE)

[Out]

B/b*ln(tanh(1/2*x)+1)-B/b*ln(tanh(1/2*x)-1)-2*(-A*b+B*a)/b/(a^2+b^2)^(1/2)*arctanh(1/2*(2*a*tanh(1/2*x)-2*b)/(
a^2+b^2)^(1/2))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 147 vs. \(2 (51) = 102\).

Time = 0.31 (sec) , antiderivative size = 147, normalized size of antiderivative = 2.67 \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=-\frac {{\left (B a - A b\right )} \sqrt {a^{2} + b^{2}} \log \left (\frac {b^{2} \cosh \left (x\right )^{2} + b^{2} \sinh \left (x\right )^{2} + 2 \, a b \cosh \left (x\right ) + 2 \, a^{2} + b^{2} + 2 \, {\left (b^{2} \cosh \left (x\right ) + a b\right )} \sinh \left (x\right ) - 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cosh \left (x\right ) + b \sinh \left (x\right ) + a\right )}}{b \cosh \left (x\right )^{2} + b \sinh \left (x\right )^{2} + 2 \, a \cosh \left (x\right ) + 2 \, {\left (b \cosh \left (x\right ) + a\right )} \sinh \left (x\right ) - b}\right ) - {\left (B a^{2} + B b^{2}\right )} x}{a^{2} b + b^{3}} \]

[In]

integrate((A+B*sinh(x))/(a+b*sinh(x)),x, algorithm="fricas")

[Out]

-((B*a - A*b)*sqrt(a^2 + b^2)*log((b^2*cosh(x)^2 + b^2*sinh(x)^2 + 2*a*b*cosh(x) + 2*a^2 + b^2 + 2*(b^2*cosh(x
) + a*b)*sinh(x) - 2*sqrt(a^2 + b^2)*(b*cosh(x) + b*sinh(x) + a))/(b*cosh(x)^2 + b*sinh(x)^2 + 2*a*cosh(x) + 2
*(b*cosh(x) + a)*sinh(x) - b)) - (B*a^2 + B*b^2)*x)/(a^2*b + b^3)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 15.11 (sec) , antiderivative size = 309, normalized size of antiderivative = 5.62 \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=\begin {cases} \tilde {\infty } \left (A \log {\left (\tanh {\left (\frac {x}{2} \right )} \right )} + B x\right ) & \text {for}\: a = 0 \wedge b = 0 \\\frac {A \log {\left (\tanh {\left (\frac {x}{2} \right )} \right )} + B x}{b} & \text {for}\: a = 0 \\\frac {A x + B \cosh {\left (x \right )}}{a} & \text {for}\: b = 0 \\\frac {2 i A}{b \tanh {\left (\frac {x}{2} \right )} - i b} + \frac {B x \tanh {\left (\frac {x}{2} \right )}}{b \tanh {\left (\frac {x}{2} \right )} - i b} - \frac {i B x}{b \tanh {\left (\frac {x}{2} \right )} - i b} - \frac {2 B}{b \tanh {\left (\frac {x}{2} \right )} - i b} & \text {for}\: a = - i b \\- \frac {2 i A}{b \tanh {\left (\frac {x}{2} \right )} + i b} + \frac {B x \tanh {\left (\frac {x}{2} \right )}}{b \tanh {\left (\frac {x}{2} \right )} + i b} + \frac {i B x}{b \tanh {\left (\frac {x}{2} \right )} + i b} - \frac {2 B}{b \tanh {\left (\frac {x}{2} \right )} + i b} & \text {for}\: a = i b \\- \frac {A \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} - \frac {\sqrt {a^{2} + b^{2}}}{a} \right )}}{\sqrt {a^{2} + b^{2}}} + \frac {A \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} + \frac {\sqrt {a^{2} + b^{2}}}{a} \right )}}{\sqrt {a^{2} + b^{2}}} + \frac {B a \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} - \frac {\sqrt {a^{2} + b^{2}}}{a} \right )}}{b \sqrt {a^{2} + b^{2}}} - \frac {B a \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} + \frac {\sqrt {a^{2} + b^{2}}}{a} \right )}}{b \sqrt {a^{2} + b^{2}}} + \frac {B x}{b} & \text {otherwise} \end {cases} \]

[In]

integrate((A+B*sinh(x))/(a+b*sinh(x)),x)

[Out]

Piecewise((zoo*(A*log(tanh(x/2)) + B*x), Eq(a, 0) & Eq(b, 0)), ((A*log(tanh(x/2)) + B*x)/b, Eq(a, 0)), ((A*x +
 B*cosh(x))/a, Eq(b, 0)), (2*I*A/(b*tanh(x/2) - I*b) + B*x*tanh(x/2)/(b*tanh(x/2) - I*b) - I*B*x/(b*tanh(x/2)
- I*b) - 2*B/(b*tanh(x/2) - I*b), Eq(a, -I*b)), (-2*I*A/(b*tanh(x/2) + I*b) + B*x*tanh(x/2)/(b*tanh(x/2) + I*b
) + I*B*x/(b*tanh(x/2) + I*b) - 2*B/(b*tanh(x/2) + I*b), Eq(a, I*b)), (-A*log(tanh(x/2) - b/a - sqrt(a**2 + b*
*2)/a)/sqrt(a**2 + b**2) + A*log(tanh(x/2) - b/a + sqrt(a**2 + b**2)/a)/sqrt(a**2 + b**2) + B*a*log(tanh(x/2)
- b/a - sqrt(a**2 + b**2)/a)/(b*sqrt(a**2 + b**2)) - B*a*log(tanh(x/2) - b/a + sqrt(a**2 + b**2)/a)/(b*sqrt(a*
*2 + b**2)) + B*x/b, True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 124 vs. \(2 (51) = 102\).

Time = 0.28 (sec) , antiderivative size = 124, normalized size of antiderivative = 2.25 \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=-B {\left (\frac {a \log \left (\frac {b e^{\left (-x\right )} - a - \sqrt {a^{2} + b^{2}}}{b e^{\left (-x\right )} - a + \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}} b} - \frac {x}{b}\right )} + \frac {A \log \left (\frac {b e^{\left (-x\right )} - a - \sqrt {a^{2} + b^{2}}}{b e^{\left (-x\right )} - a + \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}}} \]

[In]

integrate((A+B*sinh(x))/(a+b*sinh(x)),x, algorithm="maxima")

[Out]

-B*(a*log((b*e^(-x) - a - sqrt(a^2 + b^2))/(b*e^(-x) - a + sqrt(a^2 + b^2)))/(sqrt(a^2 + b^2)*b) - x/b) + A*lo
g((b*e^(-x) - a - sqrt(a^2 + b^2))/(b*e^(-x) - a + sqrt(a^2 + b^2)))/sqrt(a^2 + b^2)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.36 \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=\frac {B x}{b} - \frac {{\left (B a - A b\right )} \log \left (\frac {{\left | 2 \, b e^{x} + 2 \, a - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, b e^{x} + 2 \, a + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{\sqrt {a^{2} + b^{2}} b} \]

[In]

integrate((A+B*sinh(x))/(a+b*sinh(x)),x, algorithm="giac")

[Out]

B*x/b - (B*a - A*b)*log(abs(2*b*e^x + 2*a - 2*sqrt(a^2 + b^2))/abs(2*b*e^x + 2*a + 2*sqrt(a^2 + b^2)))/(sqrt(a
^2 + b^2)*b)

Mupad [B] (verification not implemented)

Time = 1.66 (sec) , antiderivative size = 269, normalized size of antiderivative = 4.89 \[ \int \frac {A+B \sinh (x)}{a+b \sinh (x)} \, dx=\frac {B\,x}{b}-\frac {2\,\mathrm {atan}\left (\frac {b^2\,{\mathrm {e}}^x\,\sqrt {-a^2\,b^2-b^4}\,\left (\frac {2\,\left (A\,b\,\sqrt {-a^2\,b^2-b^4}-B\,a\,\sqrt {-a^2\,b^2-b^4}\right )}{b^4\,\sqrt {-a^2\,b^2-b^4}\,\sqrt {{\left (A\,b-B\,a\right )}^2}}+\frac {2\,a^2\,\sqrt {A^2\,b^2-2\,A\,B\,a\,b+B^2\,a^2}}{b^2\,\sqrt {-b^2\,\left (a^2+b^2\right )}\,\sqrt {-a^2\,b^2-b^4}\,\left (A\,b-B\,a\right )}\right )}{2}-\frac {a\,b\,\sqrt {A^2\,b^2-2\,A\,B\,a\,b+B^2\,a^2}}{\sqrt {-b^2\,\left (a^2+b^2\right )}\,\left (A\,b-B\,a\right )}\right )\,\sqrt {A^2\,b^2-2\,A\,B\,a\,b+B^2\,a^2}}{\sqrt {-a^2\,b^2-b^4}} \]

[In]

int((A + B*sinh(x))/(a + b*sinh(x)),x)

[Out]

(B*x)/b - (2*atan((b^2*exp(x)*(- b^4 - a^2*b^2)^(1/2)*((2*(A*b*(- b^4 - a^2*b^2)^(1/2) - B*a*(- b^4 - a^2*b^2)
^(1/2)))/(b^4*(- b^4 - a^2*b^2)^(1/2)*((A*b - B*a)^2)^(1/2)) + (2*a^2*(A^2*b^2 + B^2*a^2 - 2*A*B*a*b)^(1/2))/(
b^2*(-b^2*(a^2 + b^2))^(1/2)*(- b^4 - a^2*b^2)^(1/2)*(A*b - B*a))))/2 - (a*b*(A^2*b^2 + B^2*a^2 - 2*A*B*a*b)^(
1/2))/((-b^2*(a^2 + b^2))^(1/2)*(A*b - B*a)))*(A^2*b^2 + B^2*a^2 - 2*A*B*a*b)^(1/2))/(- b^4 - a^2*b^2)^(1/2)