Optimal. Leaf size=114 \[ \frac {a x}{a^2-b^2}-\frac {b^2 x}{a \left (a^2-b^2\right )}+\frac {2 b^3 \text {ArcTan}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a (a-b)^{3/2} (a+b)^{3/2}}-\frac {a \coth (x)}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.15, antiderivative size = 114, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 8, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.615, Rules used = {3983, 2981,
2686, 8, 3554, 2814, 2738, 211} \begin {gather*} -\frac {b^2 x}{a \left (a^2-b^2\right )}+\frac {a x}{a^2-b^2}-\frac {a \coth (x)}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2}+\frac {2 b^3 \text {ArcTan}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a (a-b)^{3/2} (a+b)^{3/2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 211
Rule 2686
Rule 2738
Rule 2814
Rule 2981
Rule 3554
Rule 3983
Rubi steps
\begin {align*} \int \frac {\coth ^2(x)}{a+b \text {sech}(x)} \, dx &=\int \frac {\cosh (x) \coth ^2(x)}{b+a \cosh (x)} \, dx\\ &=\frac {a \int \coth ^2(x) \, dx}{a^2-b^2}-\frac {b \int \coth (x) \text {csch}(x) \, dx}{a^2-b^2}-\frac {b^2 \int \frac {\cosh (x)}{b+a \cosh (x)} \, dx}{a^2-b^2}\\ &=-\frac {b^2 x}{a \left (a^2-b^2\right )}-\frac {a \coth (x)}{a^2-b^2}+\frac {a \int 1 \, dx}{a^2-b^2}+\frac {(i b) \text {Subst}(\int 1 \, dx,x,-i \text {csch}(x))}{a^2-b^2}+\frac {b^3 \int \frac {1}{b+a \cosh (x)} \, dx}{a \left (a^2-b^2\right )}\\ &=\frac {a x}{a^2-b^2}-\frac {b^2 x}{a \left (a^2-b^2\right )}-\frac {a \coth (x)}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2}+\frac {\left (2 b^3\right ) \text {Subst}\left (\int \frac {1}{a+b-(-a+b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{a \left (a^2-b^2\right )}\\ &=\frac {a x}{a^2-b^2}-\frac {b^2 x}{a \left (a^2-b^2\right )}+\frac {2 b^3 \tan ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a (a-b)^{3/2} (a+b)^{3/2}}-\frac {a \coth (x)}{a^2-b^2}+\frac {b \text {csch}(x)}{a^2-b^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.24, size = 81, normalized size = 0.71 \begin {gather*} \frac {a^2 x-b^2 x+\frac {2 b^3 \text {ArcTan}\left (\frac {(a-b) \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}-a^2 \coth (x)+a b \text {csch}(x)}{a^3-a b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.88, size = 104, normalized size = 0.91
method | result | size |
default | \(-\frac {\tanh \left (\frac {x}{2}\right )}{2 \left (a -b \right )}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{a}+\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{a}+\frac {2 b^{3} \arctan \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a -b \right ) a \left (a +b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {1}{2 \left (a +b \right ) \tanh \left (\frac {x}{2}\right )}\) | \(104\) |
risch | \(\frac {x}{a}-\frac {2 \left (-{\mathrm e}^{x} b +a \right )}{\left ({\mathrm e}^{2 x}-1\right ) \left (a^{2}-b^{2}\right )}-\frac {b^{3} \ln \left ({\mathrm e}^{x}+\frac {b \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, a}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) a}+\frac {b^{3} \ln \left ({\mathrm e}^{x}+\frac {b \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, a}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) a}\) | \(178\) |
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. 283 vs.
\(2 (104) = 208\).
time = 0.38, size = 646, normalized size = 5.67 \begin {gather*} \left [\frac {2 \, a^{4} - 2 \, a^{2} b^{2} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \cosh \left (x\right )^{2} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \sinh \left (x\right )^{2} - {\left (b^{3} \cosh \left (x\right )^{2} + 2 \, b^{3} \cosh \left (x\right ) \sinh \left (x\right ) + b^{3} \sinh \left (x\right )^{2} - b^{3}\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 ) + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x - 2 \, {\left (a^{3} b - a b^{3}\right )} \cosh \left (x\right ) - 2 \, {\left (a^{3} b - a b^{3} + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \cosh \left (x\right )\right )} \sinh \left (x\right )}{a^{5} - 2 \, a^{3} b^{2} + a b^{4} - {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \sinh \left (x\right )^{2}}, \frac {2 \, a^{4} - 2 \, a^{2} b^{2} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \cosh \left (x\right )^{2} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \sinh \left (x\right )^{2} + 2 \, {\left (b^{3} \cosh \left (x\right )^{2} + 2 \, b^{3} \cosh \left (x\right ) \sinh \left (x\right ) + b^{3} \sinh \left (x\right )^{2} - b^{3}\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 ) + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x - 2 \, {\left (a^{3} b - a b^{3}\right )} \cosh \left (x\right ) - 2 \, {\left (a^{3} b - a b^{3} + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \cosh \left (x\right )\right )} \sinh \left (x\right )}{a^{5} - 2 \, a^{3} b^{2} + a b^{4} - {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \sinh \left (x\right )^{2}}\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 {\coth ^{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.40, size = 82, normalized size = 0.72 \begin {gather*} \frac {2 \, b^{3} \arctan \left (\frac {a e^{x} + b}{\sqrt {a^{2} - b^{2}}}\right )}{{\left (a^{3} - a b^{2}\right )} \sqrt {a^{2} - b^{2}}} + \frac {x}{a} + \frac {2 \, {\left (b e^{x} - a\right )}}{{\left (a^{2} - b^{2}\right )} {\left (e^{\left (2 \, x\right )} - 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.67, size = 383, normalized size = 3.36 \begin {gather*} \frac {x}{a}-\frac {\frac {2\,a}{a^2-b^2}-\frac {2\,b\,{\mathrm {e}}^x}{a^2-b^2}}{{\mathrm {e}}^{2\,x}-1}-\frac {2\,\mathrm {atan}\left (\left ({\mathrm {e}}^x\,\left (\frac {2\,b^3}{a^3\,\left (a\,b^2-a^3\right )\,\left (a^2-b^2\right )\,\sqrt {b^6}}-\frac {2\,\left (a\,b^3\,\sqrt {b^6}-a^3\,b\,\sqrt {b^6}\right )}{a^2\,b^2\,\left (a\,b^2-a^3\right )\,\sqrt {a^2\,{\left (a^2-b^2\right )}^3}\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}\right )+\frac {2\,\left (a^4\,\sqrt {b^6}-a^2\,b^2\,\sqrt {b^6}\right )}{a^2\,b^2\,\left (a\,b^2-a^3\right )\,\sqrt {a^2\,{\left (a^2-b^2\right )}^3}\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}\right )\,\left (\frac {a^4\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}{2}-\frac {a^2\,b^2\,\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}}{2}\right )\right )\,\sqrt {b^6}}{\sqrt {a^8-3\,a^6\,b^2+3\,a^4\,b^4-a^2\,b^6}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________