Optimal. Leaf size=57 \[ -\frac {a x}{b^2}-\frac {2 a^2 \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b^2 \sqrt {a^2+b^2}}+\frac {\cosh (x)}{b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 57, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.462, Rules used = {2825, 12, 2814,
2739, 632, 212} \begin {gather*} -\frac {2 a^2 \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b^2 \sqrt {a^2+b^2}}-\frac {a x}{b^2}+\frac {\cosh (x)}{b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 212
Rule 632
Rule 2739
Rule 2814
Rule 2825
Rubi steps
\begin {align*} \int \frac {\sinh ^2(x)}{a+b \sinh (x)} \, dx &=\frac {\cosh (x)}{b}-\frac {\int \frac {a \sinh (x)}{a+b \sinh (x)} \, dx}{b}\\ &=\frac {\cosh (x)}{b}-\frac {a \int \frac {\sinh (x)}{a+b \sinh (x)} \, dx}{b}\\ &=-\frac {a x}{b^2}+\frac {\cosh (x)}{b}+\frac {a^2 \int \frac {1}{a+b \sinh (x)} \, dx}{b^2}\\ &=-\frac {a x}{b^2}+\frac {\cosh (x)}{b}+\frac {\left (2 a^2\right ) \text {Subst}\left (\int \frac {1}{a+2 b x-a x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{b^2}\\ &=-\frac {a x}{b^2}+\frac {\cosh (x)}{b}-\frac {\left (4 a^2\right ) \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^2}\\ &=-\frac {a x}{b^2}-\frac {2 a^2 \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b^2 \sqrt {a^2+b^2}}+\frac {\cosh (x)}{b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.08, size = 61, normalized size = 1.07 \begin {gather*} \frac {a \left (-x+\frac {2 a \text {ArcTan}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {-a^2-b^2}}\right )}{\sqrt {-a^2-b^2}}\right )+b \cosh (x)}{b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.35, size = 92, normalized size = 1.61
method | result | size |
default | \(\frac {1}{b \left (\tanh \left (\frac {x}{2}\right )+1\right )}-\frac {a \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{b^{2}}+\frac {2 a^{2} \arctanh \left (\frac {2 a \tanh \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{b^{2} \sqrt {a^{2}+b^{2}}}-\frac {1}{b \left (\tanh \left (\frac {x}{2}\right )-1\right )}+\frac {a \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{b^{2}}\) | \(92\) |
risch | \(-\frac {a x}{b^{2}}+\frac {{\mathrm e}^{x}}{2 b}+\frac {{\mathrm e}^{-x}}{2 b}+\frac {a^{2} \ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}-a^{2}-b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right )}{\sqrt {a^{2}+b^{2}}\, b^{2}}-\frac {a^{2} \ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}+a^{2}+b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right )}{\sqrt {a^{2}+b^{2}}\, b^{2}}\) | \(132\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 84, normalized size = 1.47 \begin {gather*} \frac {a^{2} \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^{2}} - \frac {a x}{b^{2}} + \frac {e^{\left (-x\right )}}{2 \, b} + \frac {e^{x}}{2 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 238 vs.
\(2 (53) = 106\).
time = 0.55, size = 238, normalized size = 4.18 \begin {gather*} \frac {a^{2} b + b^{3} - 2 \, {\left (a^{3} + a b^{2}\right )} x \cosh \left (x\right ) + {\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^{2} \cosh \left (x\right ) + a^{2} \sinh \left (x\right )\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 ) - 2 \, {\left ({\left (a^{3} + a b^{2}\right )} x - {\left (a^{2} b + b^{3}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )}{2 \, {\left ({\left (a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right ) + {\left (a^{2} b^{2} + b^{4}\right )} \sinh \left (x\right )\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 1253 vs.
\(2 (49) = 98\).
time = 175.16, size = 1253, normalized size = 21.98 \begin {gather*} \begin {cases} \tilde {\infty } \cosh {\left (x \right )} & \text {for}\: a = 0 \wedge b = 0 \\\frac {\cosh {\left (x \right )}}{b} & \text {for}\: a = 0 \\\frac {b x \tanh ^{2}{\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}}} - \frac {b x}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}}} - \frac {2 b \tanh {\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}}} + \frac {x \sqrt {- b^{2}} \tanh ^{3}{\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}}} - \frac {x \sqrt {- b^{2}} \tanh {\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}}} - \frac {2 \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}}} + \frac {4 \sqrt {- b^{2}}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}}} & \text {for}\: a = - \sqrt {- b^{2}} \\\frac {b x \tanh ^{2}{\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}}} - \frac {b x}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}}} - \frac {2 b \tanh {\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}}} - \frac {x \sqrt {- b^{2}} \tanh ^{3}{\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}}} + \frac {x \sqrt {- b^{2}} \tanh {\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}}} + \frac {2 \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}}} - \frac {4 \sqrt {- b^{2}}}{b^{2} \tanh ^{3}{\left (\frac {x}{2} \right )} - b^{2} \tanh {\left (\frac {x}{2} \right )} + b \sqrt {- b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b \sqrt {- b^{2}}} & \text {for}\: a = \sqrt {- b^{2}} \\\frac {\frac {x \sinh ^{2}{\left (x \right )}}{2} - \frac {x \cosh ^{2}{\left (x \right )}}{2} + \frac {\sinh {\left (x \right )} \cosh {\left (x \right )}}{2}}{a} & \text {for}\: b = 0 \\- \frac {a^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} - \frac {\sqrt {a^{2} + b^{2}}}{a} \right )} \tanh ^{2}{\left (\frac {x}{2} \right )}}{b^{2} \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b^{2} \sqrt {a^{2} + b^{2}}} + \frac {a^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} - \frac {\sqrt {a^{2} + b^{2}}}{a} \right )}}{b^{2} \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b^{2} \sqrt {a^{2} + b^{2}}} + \frac {a^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} + \frac {\sqrt {a^{2} + b^{2}}}{a} \right )} \tanh ^{2}{\left (\frac {x}{2} \right )}}{b^{2} \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b^{2} \sqrt {a^{2} + b^{2}}} - \frac {a^{2} \log {\left (\tanh {\left (\frac {x}{2} \right )} - \frac {b}{a} + \frac {\sqrt {a^{2} + b^{2}}}{a} \right )}}{b^{2} \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b^{2} \sqrt {a^{2} + b^{2}}} - \frac {a x \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )}}{b^{2} \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b^{2} \sqrt {a^{2} + b^{2}}} + \frac {a x \sqrt {a^{2} + b^{2}}}{b^{2} \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b^{2} \sqrt {a^{2} + b^{2}}} - \frac {2 b \sqrt {a^{2} + b^{2}}}{b^{2} \sqrt {a^{2} + b^{2}} \tanh ^{2}{\left (\frac {x}{2} \right )} - b^{2} \sqrt {a^{2} + b^{2}}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.43, size = 86, normalized size = 1.51 \begin {gather*} \frac {a^{2} \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^{2}} - \frac {a x}{b^{2}} + \frac {e^{\left (-x\right )}}{2 \, b} + \frac {e^{x}}{2 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.54, size = 129, normalized size = 2.26 \begin {gather*} \frac {{\mathrm {e}}^{-x}}{2\,b}+\frac {{\mathrm {e}}^x}{2\,b}-\frac {a\,x}{b^2}-\frac {a^2\,\ln \left (-\frac {2\,a^2\,{\mathrm {e}}^x}{b^3}-\frac {2\,a^2\,\left (b-a\,{\mathrm {e}}^x\right )}{b^3\,\sqrt {a^2+b^2}}\right )}{b^2\,\sqrt {a^2+b^2}}+\frac {a^2\,\ln \left (\frac {2\,a^2\,\left (b-a\,{\mathrm {e}}^x\right )}{b^3\,\sqrt {a^2+b^2}}-\frac {2\,a^2\,{\mathrm {e}}^x}{b^3}\right )}{b^2\,\sqrt {a^2+b^2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________