Optimal. Leaf size=39 \[ \frac {x}{a+b}-\frac {\sqrt {a} \text {ArcTan}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 39, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.150, Rules used = {492, 213, 211}
\begin {gather*} \frac {x}{a+b}-\frac {\sqrt {a} \text {ArcTan}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 213
Rule 492
Rubi steps
\begin {align*} \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx &=-\text {Subst}\left (\int \frac {x^2}{\left (-1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tanh (x)\right )\\ &=-\frac {\text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\tanh (x)\right )}{a+b}-\frac {a \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tanh (x)\right )}{a+b}\\ &=\frac {x}{a+b}-\frac {\sqrt {a} \tan ^{-1}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.07, size = 34, normalized size = 0.87 \begin {gather*} \frac {x-\frac {\sqrt {a} \text {ArcTan}\left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b}}}{a+b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(190\) vs.
\(2(31)=62\).
time = 1.16, size = 191, normalized size = 4.90
method | result | size |
risch | \(\frac {x}{a +b}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 x}-\frac {2 \sqrt {-a b}-a +b}{a +b}\right )}{2 b \left (a +b \right )}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 x}+\frac {a +2 \sqrt {-a b}-b}{a +b}\right )}{2 b \left (a +b \right )}\) | \(92\) |
default | \(-\frac {8 \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{8 a +8 b}+\frac {8 \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{8 a +8 b}+\frac {8 a^{2} \left (\frac {\left (a +\sqrt {b \left (a +b \right )}+b \right ) \arctan \left (\frac {a \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (2 \sqrt {b \left (a +b \right )}+a +2 b \right ) a}}\right )}{2 \sqrt {b \left (a +b \right )}\, a \sqrt {\left (2 \sqrt {b \left (a +b \right )}+a +2 b \right ) a}}-\frac {\left (-a +\sqrt {b \left (a +b \right )}-b \right ) \arctanh \left (\frac {a \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (2 \sqrt {b \left (a +b \right )}-a -2 b \right ) a}}\right )}{2 \sqrt {b \left (a +b \right )}\, a \sqrt {\left (2 \sqrt {b \left (a +b \right )}-a -2 b \right ) a}}\right )}{4 a +4 b}\) | \(191\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 74 vs.
\(2 (31) = 62\).
time = 0.50, size = 74, normalized size = 1.90 \begin {gather*} -\frac {{\left (a - b\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (2 \, x\right )} + a - b}{2 \, \sqrt {a b}}\right )}{2 \, \sqrt {a b} {\left (a + b\right )}} + \frac {\arctan \left (\frac {{\left (a + b\right )} e^{\left (-2 \, x\right )} + a - b}{2 \, \sqrt {a b}}\right )}{2 \, \sqrt {a b}} + \frac {x}{a + b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 367, normalized size = 9.41 \begin {gather*} \left [\frac {\sqrt {-\frac {a}{b}} \log \left (\frac {{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{4} + 4 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} + {\left (a^{2} + 2 \, a b + b^{2}\right )} \sinh \left (x\right )^{4} + 2 \, {\left (a^{2} - b^{2}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (3 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{2} + a^{2} - b^{2}\right )} \sinh \left (x\right )^{2} + a^{2} - 6 \, a b + b^{2} + 4 \, {\left ({\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{3} + {\left (a^{2} - b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) - 4 \, {\left ({\left (a b + b^{2}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (a b + b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right ) + {\left (a b + b^{2}\right )} \sinh \left (x\right )^{2} + a b - b^{2}\right )} \sqrt {-\frac {a}{b}}}{{\left (a + b\right )} \cosh \left (x\right )^{4} + 4 \, {\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} + {\left (a + b\right )} \sinh \left (x\right )^{4} + 2 \, {\left (a - b\right )} \cosh \left (x\right )^{2} + 2 \, {\left (3 \, {\left (a + b\right )} \cosh \left (x\right )^{2} + a - b\right )} \sinh \left (x\right )^{2} + 4 \, {\left ({\left (a + b\right )} \cosh \left (x\right )^{3} + {\left (a - b\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) + a + b}\right ) + 2 \, x}{2 \, {\left (a + b\right )}}, -\frac {\sqrt {\frac {a}{b}} \arctan \left (\frac {{\left ({\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 )} \sqrt {\frac {a}{b}}}{2 \, a}\right ) - x}{a + b}\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. 202 vs.
\(2 (32) = 64\).
time = 0.65, size = 202, normalized size = 5.18 \begin {gather*} \begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge b = 0 \\- \frac {x \sinh ^{2}{\left (x \right )}}{- 2 b \sinh ^{2}{\left (x \right )} + 2 b \cosh ^{2}{\left (x \right )}} + \frac {x \cosh ^{2}{\left (x \right )}}{- 2 b \sinh ^{2}{\left (x \right )} + 2 b \cosh ^{2}{\left (x \right )}} - \frac {\sinh {\left (x \right )} \cosh {\left (x \right )}}{- 2 b \sinh ^{2}{\left (x \right )} + 2 b \cosh ^{2}{\left (x \right )}} & \text {for}\: a = - b \\\frac {x - \frac {\sinh {\left (x \right )}}{\cosh {\left (x \right )}}}{a} & \text {for}\: b = 0 \\\frac {x}{b} & \text {for}\: a = 0 \\\frac {2 x \sqrt {- \frac {b}{a}}}{2 a \sqrt {- \frac {b}{a}} + 2 b \sqrt {- \frac {b}{a}}} + \frac {\log {\left (- \sqrt {- \frac {b}{a}} \sinh {\left (x \right )} + \cosh {\left (x \right )} \right )}}{2 a \sqrt {- \frac {b}{a}} + 2 b \sqrt {- \frac {b}{a}}} - \frac {\log {\left (\sqrt {- \frac {b}{a}} \sinh {\left (x \right )} + \cosh {\left (x \right )} \right )}}{2 a \sqrt {- \frac {b}{a}} + 2 b \sqrt {- \frac {b}{a}}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.43, size = 46, normalized size = 1.18 \begin {gather*} -\frac {a \arctan \left (\frac {a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b}{2 \, \sqrt {a b}}\right )}{\sqrt {a b} {\left (a + b\right )}} + \frac {x}{a + b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.29, size = 209, normalized size = 5.36 \begin {gather*} \frac {x}{a+b}-\frac {\sqrt {a}\,\mathrm {atan}\left (\frac {\left ({\mathrm {e}}^{2\,x}\,\left (\frac {4\,a}{{\left (a+b\right )}^4}+\frac {\left (a^2-b^2\right )\,\left (a-b\right )}{{\left (a+b\right )}^3\,\sqrt {b\,{\left (a+b\right )}^2}\,\sqrt {a^2\,b+2\,a\,b^2+b^3}}\right )+\frac {\left (a-b\right )\,\left (a^2+2\,a\,b+b^2\right )}{{\left (a+b\right )}^3\,\sqrt {b\,{\left (a+b\right )}^2}\,\sqrt {a^2\,b+2\,a\,b^2+b^3}}\right )\,\left (a^2\,\sqrt {a^2\,b+2\,a\,b^2+b^3}+b^2\,\sqrt {a^2\,b+2\,a\,b^2+b^3}+2\,a\,b\,\sqrt {a^2\,b+2\,a\,b^2+b^3}\right )}{2\,\sqrt {a}}\right )}{\sqrt {a^2\,b+2\,a\,b^2+b^3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________