Optimal. Leaf size=82 \[ -\frac {\left (a^2-2 b^2\right ) x}{2 a^3}+\frac {2 \sqrt {a-b} b \sqrt {a+b} \text {ArcTan}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a^3}-\frac {(2 b-a \cosh (x)) \sinh (x)}{2 a^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.385, Rules used = {3957, 2944,
2814, 2738, 211} \begin {gather*} \frac {2 b \sqrt {a-b} \sqrt {a+b} \text {ArcTan}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a^3}-\frac {\sinh (x) (2 b-a \cosh (x))}{2 a^2}-\frac {x \left (a^2-2 b^2\right )}{2 a^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 2738
Rule 2814
Rule 2944
Rule 3957
Rubi steps
\begin {align*} \int \frac {\sinh ^2(x)}{a+b \text {sech}(x)} \, dx &=-\int \frac {\cosh (x) \sinh ^2(x)}{-b-a \cosh (x)} \, dx\\ &=-\frac {(2 b-a \cosh (x)) \sinh (x)}{2 a^2}+\frac {\int \frac {-a b+\left (a^2-2 b^2\right ) \cosh (x)}{-b-a \cosh (x)} \, dx}{2 a^2}\\ &=-\frac {\left (a^2-2 b^2\right ) x}{2 a^3}-\frac {(2 b-a \cosh (x)) \sinh (x)}{2 a^2}-\frac {\left (b \left (a^2-b^2\right )\right ) \int \frac {1}{-b-a \cosh (x)} \, dx}{a^3}\\ &=-\frac {\left (a^2-2 b^2\right ) x}{2 a^3}-\frac {(2 b-a \cosh (x)) \sinh (x)}{2 a^2}-\frac {\left (2 b \left (a^2-b^2\right )\right ) \text {Subst}\left (\int \frac {1}{-a-b-(a-b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{a^3}\\ &=-\frac {\left (a^2-2 b^2\right ) x}{2 a^3}+\frac {2 \sqrt {a-b} b \sqrt {a+b} \tan ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a^3}-\frac {(2 b-a \cosh (x)) \sinh (x)}{2 a^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.13, size = 76, normalized size = 0.93 \begin {gather*} \frac {-2 a^2 x+4 b^2 x-8 b \sqrt {a^2-b^2} \text {ArcTan}\left (\frac {(-a+b) \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )-4 a b \sinh (x)+a^2 \sinh (2 x)}{4 a^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(159\) vs.
\(2(68)=136\).
time = 0.68, size = 160, normalized size = 1.95
method | result | size |
risch | \(-\frac {x}{2 a}+\frac {x \,b^{2}}{a^{3}}+\frac {{\mathrm e}^{2 x}}{8 a}-\frac {b \,{\mathrm e}^{x}}{2 a^{2}}+\frac {b \,{\mathrm e}^{-x}}{2 a^{2}}-\frac {{\mathrm e}^{-2 x}}{8 a}+\frac {\sqrt {-a^{2}+b^{2}}\, b \ln \left ({\mathrm e}^{x}+\frac {b +\sqrt {-a^{2}+b^{2}}}{a}\right )}{a^{3}}-\frac {\sqrt {-a^{2}+b^{2}}\, b \ln \left ({\mathrm e}^{x}-\frac {\sqrt {-a^{2}+b^{2}}-b}{a}\right )}{a^{3}}\) | \(130\) |
default | \(-\frac {1}{2 a \left (\tanh \left (\frac {x}{2}\right )+1\right )^{2}}-\frac {-2 b -a}{2 a^{2} \left (\tanh \left (\frac {x}{2}\right )+1\right )}+\frac {\left (-a^{2}+2 b^{2}\right ) \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{2 a^{3}}+\frac {2 b \left (a^{2}-b^{2}\right ) \arctan \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{3} \sqrt {\left (a +b \right ) \left (a -b \right )}}+\frac {1}{2 a \left (\tanh \left (\frac {x}{2}\right )-1\right )^{2}}+\frac {\left (a^{2}-2 b^{2}\right ) \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{2 a^{3}}-\frac {-2 b -a}{2 a^{2} \left (\tanh \left (\frac {x}{2}\right )-1\right )}\) | \(160\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \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. 228 vs.
\(2 (67) = 134\).
time = 0.37, size = 536, normalized size = 6.54 \begin {gather*} \left [\frac {a^{2} \cosh \left (x\right )^{4} + a^{2} \sinh \left (x\right )^{4} - 4 \, a b \cosh \left (x\right )^{3} - 4 \, {\left (a^{2} - 2 \, b^{2}\right )} x \cosh \left (x\right )^{2} + 4 \, {\left (a^{2} \cosh \left (x\right ) - a b\right )} \sinh \left (x\right )^{3} + 4 \, a b \cosh \left (x\right ) + 2 \, {\left (3 \, a^{2} \cosh \left (x\right )^{2} - 6 \, a b \cosh \left (x\right ) - 2 \, {\left (a^{2} - 2 \, b^{2}\right )} x\right )} \sinh \left (x\right )^{2} + 8 \, {\left (b \cosh \left (x\right )^{2} + 2 \, b \cosh \left (x\right ) \sinh \left (x\right ) + b \sinh \left (x\right )^{2}\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {a^{2} \cosh \left (x\right )^{2} + a^{2} \sinh \left (x\right )^{2} + 2 \, a b \cosh \left (x\right ) - a^{2} + 2 \, b^{2} + 2 \, {\left (a^{2} \cosh \left (x\right ) + a b\right )} \sinh \left (x\right ) + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cosh \left (x\right ) + a \sinh \left (x\right ) + b\right )}}{a \cosh \left (x\right )^{2} + a \sinh \left (x\right )^{2} + 2 \, b \cosh \left (x\right ) + 2 \, {\left (a \cosh \left (x\right ) + b\right )} \sinh \left (x\right ) + a}\right ) - a^{2} + 4 \, {\left (a^{2} \cosh \left (x\right )^{3} - 3 \, a b \cosh \left (x\right )^{2} - 2 \, {\left (a^{2} - 2 \, b^{2}\right )} x \cosh \left (x\right ) + a b\right )} \sinh \left (x\right )}{8 \, {\left (a^{3} \cosh \left (x\right )^{2} + 2 \, a^{3} \cosh \left (x\right ) \sinh \left (x\right ) + a^{3} \sinh \left (x\right )^{2}\right )}}, \frac {a^{2} \cosh \left (x\right )^{4} + a^{2} \sinh \left (x\right )^{4} - 4 \, a b \cosh \left (x\right )^{3} - 4 \, {\left (a^{2} - 2 \, b^{2}\right )} x \cosh \left (x\right )^{2} + 4 \, {\left (a^{2} \cosh \left (x\right ) - a b\right )} \sinh \left (x\right )^{3} + 4 \, a b \cosh \left (x\right ) + 2 \, {\left (3 \, a^{2} \cosh \left (x\right )^{2} - 6 \, a b \cosh \left (x\right ) - 2 \, {\left (a^{2} - 2 \, b^{2}\right )} x\right )} \sinh \left (x\right )^{2} - 16 \, {\left (b \cosh \left (x\right )^{2} + 2 \, b \cosh \left (x\right ) \sinh \left (x\right ) + b \sinh \left (x\right )^{2}\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cosh \left (x\right ) + a \sinh \left (x\right ) + b}{\sqrt {a^{2} - b^{2}}}\right ) - a^{2} + 4 \, {\left (a^{2} \cosh \left (x\right )^{3} - 3 \, a b \cosh \left (x\right )^{2} - 2 \, {\left (a^{2} - 2 \, b^{2}\right )} x \cosh \left (x\right ) + a b\right )} \sinh \left (x\right )}{8 \, {\left (a^{3} \cosh \left (x\right )^{2} + 2 \, a^{3} \cosh \left (x\right ) \sinh \left (x\right ) + a^{3} \sinh \left (x\right )^{2}\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sinh ^{2}{\left (x \right )}}{a + b \operatorname {sech}{\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.39, size = 100, normalized size = 1.22 \begin {gather*} \frac {a e^{\left (2 \, x\right )} - 4 \, b e^{x}}{8 \, a^{2}} - \frac {{\left (a^{2} - 2 \, b^{2}\right )} x}{2 \, a^{3}} + \frac {{\left (4 \, a b e^{x} - a^{2}\right )} e^{\left (-2 \, x\right )}}{8 \, a^{3}} + \frac {2 \, {\left (a^{2} b - b^{3}\right )} \arctan \left (\frac {a e^{x} + b}{\sqrt {a^{2} - b^{2}}}\right )}{\sqrt {a^{2} - b^{2}} a^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.67, size = 173, normalized size = 2.11 \begin {gather*} \frac {{\mathrm {e}}^{2\,x}}{8\,a}-\frac {{\mathrm {e}}^{-2\,x}}{8\,a}-\frac {b\,{\mathrm {e}}^x}{2\,a^2}+\frac {b\,{\mathrm {e}}^{-x}}{2\,a^2}-\frac {x\,\left (a^2-2\,b^2\right )}{2\,a^3}+\frac {b\,\ln \left (-\frac {2\,b\,{\mathrm {e}}^x\,\left (a^2-b^2\right )}{a^4}-\frac {2\,b\,\sqrt {a+b}\,\left (a+b\,{\mathrm {e}}^x\right )\,\sqrt {b-a}}{a^4}\right )\,\sqrt {a+b}\,\sqrt {b-a}}{a^3}-\frac {b\,\ln \left (\frac {2\,b\,\sqrt {a+b}\,\left (a+b\,{\mathrm {e}}^x\right )\,\sqrt {b-a}}{a^4}-\frac {2\,b\,{\mathrm {e}}^x\,\left (a^2-b^2\right )}{a^4}\right )\,\sqrt {a+b}\,\sqrt {b-a}}{a^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________