Optimal. Leaf size=100 \[ -\frac {a B \log (a+b \cosh (x))}{a^2-b^2}+\frac {2 A \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b}}+\frac {B \log (1-\cosh (x))}{2 (a+b)}+\frac {B \log (\cosh (x)+1)}{2 (a-b)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.17, antiderivative size = 100, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {4401, 2659, 208, 2721, 801} \[ -\frac {a B \log (a+b \cosh (x))}{a^2-b^2}+\frac {2 A \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b}}+\frac {B \log (1-\cosh (x))}{2 (a+b)}+\frac {B \log (\cosh (x)+1)}{2 (a-b)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 208
Rule 801
Rule 2659
Rule 2721
Rule 4401
Rubi steps
\begin {align*} \int \frac {A+B \coth (x)}{a+b \cosh (x)} \, dx &=\int \left (\frac {A}{a+b \cosh (x)}+\frac {B \coth (x)}{a+b \cosh (x)}\right ) \, dx\\ &=A \int \frac {1}{a+b \cosh (x)} \, dx+B \int \frac {\coth (x)}{a+b \cosh (x)} \, dx\\ &=(2 A) \operatorname {Subst}\left (\int \frac {1}{a+b-(a-b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )-B \operatorname {Subst}\left (\int \frac {x}{(a+x) \left (b^2-x^2\right )} \, dx,x,b \cosh (x)\right )\\ &=\frac {2 A \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b}}-B \operatorname {Subst}\left (\int \left (\frac {1}{2 (a+b) (b-x)}+\frac {a}{(a-b) (a+b) (a+x)}-\frac {1}{2 (a-b) (b+x)}\right ) \, dx,x,b \cosh (x)\right )\\ &=\frac {2 A \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b}}+\frac {B \log (1-\cosh (x))}{2 (a+b)}+\frac {B \log (1+\cosh (x))}{2 (a-b)}-\frac {a B \log (a+b \cosh (x))}{a^2-b^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.26, size = 81, normalized size = 0.81 \[ \frac {B \left (a \log (a+b \cosh (x))-a \log (\sinh (x))+b \log \left (\tanh \left (\frac {x}{2}\right )\right )\right )}{b^2-a^2}-\frac {2 A \tan ^{-1}\left (\frac {(a-b) \tanh \left (\frac {x}{2}\right )}{\sqrt {b^2-a^2}}\right )}{\sqrt {b^2-a^2}} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 2.75, size = 303, normalized size = 3.03 \[ \left [-\frac {B a \log \left (\frac {2 \, {\left (b \cosh \relax (x) + a\right )}}{\cosh \relax (x) - \sinh \relax (x)}\right ) - \sqrt {a^{2} - b^{2}} A \log \left (\frac {b^{2} \cosh \relax (x)^{2} + b^{2} \sinh \relax (x)^{2} + 2 \, a b \cosh \relax (x) + 2 \, a^{2} - b^{2} + 2 \, {\left (b^{2} \cosh \relax (x) + a b\right )} \sinh \relax (x) - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cosh \relax (x) + b \sinh \relax (x) + a\right )}}{b \cosh \relax (x)^{2} + b \sinh \relax (x)^{2} + 2 \, a \cosh \relax (x) + 2 \, {\left (b \cosh \relax (x) + a\right )} \sinh \relax (x) + b}\right ) - {\left (B a + B b\right )} \log \left (\cosh \relax (x) + \sinh \relax (x) + 1\right ) - {\left (B a - B b\right )} \log \left (\cosh \relax (x) + \sinh \relax (x) - 1\right )}{a^{2} - b^{2}}, -\frac {B a \log \left (\frac {2 \, {\left (b \cosh \relax (x) + a\right )}}{\cosh \relax (x) - \sinh \relax (x)}\right ) + 2 \, \sqrt {-a^{2} + b^{2}} A \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cosh \relax (x) + b \sinh \relax (x) + a\right )}}{a^{2} - b^{2}}\right ) - {\left (B a + B b\right )} \log \left (\cosh \relax (x) + \sinh \relax (x) + 1\right ) - {\left (B a - B b\right )} \log \left (\cosh \relax (x) + \sinh \relax (x) - 1\right )}{a^{2} - b^{2}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.13, size = 90, normalized size = 0.90 \[ -\frac {B a \log \left (b e^{\left (2 \, x\right )} + 2 \, a e^{x} + b\right )}{a^{2} - b^{2}} + \frac {2 \, A \arctan \left (\frac {b e^{x} + a}{\sqrt {-a^{2} + b^{2}}}\right )}{\sqrt {-a^{2} + b^{2}}} + \frac {B \log \left (e^{x} + 1\right )}{a - b} + \frac {B \log \left ({\left | e^{x} - 1 \right |}\right )}{a + b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.11, size = 139, normalized size = 1.39 \[ -\frac {a B \ln \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-\left (\tanh ^{2}\left (\frac {x}{2}\right )\right ) b -a -b \right )}{\left (a +b \right ) \left (a -b \right )}+\frac {2 \arctanh \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right ) A a}{\left (a +b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}+\frac {2 \arctanh \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right ) A b}{\left (a +b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}+\frac {B \ln \left (\tanh \left (\frac {x}{2}\right )\right )}{a +b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 3.68, size = 974, normalized size = 9.74 \[ \frac {B\,\ln \left ({\mathrm {e}}^x+1\right )}{a-b}+\frac {\ln \left (\frac {\left (\frac {32\,\left (A^2\,a^2\,b+2\,{\mathrm {e}}^x\,A^2\,a\,b^2+A^2\,b^3+8\,{\mathrm {e}}^x\,A\,B\,a^3+4\,A\,B\,a^2\,b-2\,{\mathrm {e}}^x\,A\,B\,a\,b^2+4\,{\mathrm {e}}^x\,B^2\,a^3+3\,B^2\,a^2\,b+5\,{\mathrm {e}}^x\,B^2\,a\,b^2+B^2\,b^3\right )}{b^5}+\frac {\left (A\,\sqrt {{\left (a+b\right )}^3\,{\left (a-b\right )}^3}-B\,a^3+B\,a\,b^2\right )\,\left (128\,{\mathrm {e}}^x\,{\left (a^2-b^2\right )}^3\,\left (A-2\,B\right )+a\,b^5\,\left (64\,A-128\,B\right )+a^5\,b\,\left (64\,A-128\,B\right )+96\,b^6\,{\mathrm {e}}^x\,\left (A-3\,B\right )-a^3\,b^3\,\left (128\,A-256\,B\right )-192\,a^2\,b^4\,{\mathrm {e}}^x\,\left (A-3\,B\right )+96\,a^4\,b^2\,{\mathrm {e}}^x\,\left (A-3\,B\right )+128\,A\,a^3\,{\mathrm {e}}^x\,\sqrt {{\left (a^2-b^2\right )}^3}+96\,A\,a^2\,b\,\sqrt {{\left (a^2-b^2\right )}^3}-32\,A\,a\,b^2\,{\mathrm {e}}^x\,\sqrt {{\left (a^2-b^2\right )}^3}\right )}{\left (b^7-a^2\,b^5\right )\,{\left (a^2-b^2\right )}^2}\right )\,\left (A\,\sqrt {{\left (a+b\right )}^3\,{\left (a-b\right )}^3}-B\,a^3+B\,a\,b^2\right )}{{\left (a^2-b^2\right )}^2}-\frac {32\,B\,\left (A^2\,a\,b+{\mathrm {e}}^x\,A^2\,b^2+4\,{\mathrm {e}}^x\,A\,B\,a^2+2\,A\,B\,a\,b-{\mathrm {e}}^x\,A\,B\,b^2+4\,{\mathrm {e}}^x\,B^2\,a^2+B^2\,a\,b\right )}{b^5}\right )\,\left (A\,\sqrt {{\left (a+b\right )}^3\,{\left (a-b\right )}^3}-B\,a^3+B\,a\,b^2\right )}{a^4-2\,a^2\,b^2+b^4}-\frac {\ln \left (-\frac {32\,B\,\left (A^2\,a\,b+{\mathrm {e}}^x\,A^2\,b^2+4\,{\mathrm {e}}^x\,A\,B\,a^2+2\,A\,B\,a\,b-{\mathrm {e}}^x\,A\,B\,b^2+4\,{\mathrm {e}}^x\,B^2\,a^2+B^2\,a\,b\right )}{b^5}-\frac {\left (\frac {32\,\left (A^2\,a^2\,b+2\,{\mathrm {e}}^x\,A^2\,a\,b^2+A^2\,b^3+8\,{\mathrm {e}}^x\,A\,B\,a^3+4\,A\,B\,a^2\,b-2\,{\mathrm {e}}^x\,A\,B\,a\,b^2+4\,{\mathrm {e}}^x\,B^2\,a^3+3\,B^2\,a^2\,b+5\,{\mathrm {e}}^x\,B^2\,a\,b^2+B^2\,b^3\right )}{b^5}-\frac {\left (B\,a^3+A\,\sqrt {{\left (a+b\right )}^3\,{\left (a-b\right )}^3}-B\,a\,b^2\right )\,\left (128\,{\mathrm {e}}^x\,{\left (a^2-b^2\right )}^3\,\left (A-2\,B\right )+a\,b^5\,\left (64\,A-128\,B\right )+a^5\,b\,\left (64\,A-128\,B\right )+96\,b^6\,{\mathrm {e}}^x\,\left (A-3\,B\right )-a^3\,b^3\,\left (128\,A-256\,B\right )-192\,a^2\,b^4\,{\mathrm {e}}^x\,\left (A-3\,B\right )+96\,a^4\,b^2\,{\mathrm {e}}^x\,\left (A-3\,B\right )-128\,A\,a^3\,{\mathrm {e}}^x\,\sqrt {{\left (a^2-b^2\right )}^3}-96\,A\,a^2\,b\,\sqrt {{\left (a^2-b^2\right )}^3}+32\,A\,a\,b^2\,{\mathrm {e}}^x\,\sqrt {{\left (a^2-b^2\right )}^3}\right )}{\left (b^7-a^2\,b^5\right )\,{\left (a^2-b^2\right )}^2}\right )\,\left (B\,a^3+A\,\sqrt {{\left (a+b\right )}^3\,{\left (a-b\right )}^3}-B\,a\,b^2\right )}{{\left (a^2-b^2\right )}^2}\right )\,\left (B\,a^3+A\,\sqrt {{\left (a+b\right )}^3\,{\left (a-b\right )}^3}-B\,a\,b^2\right )}{a^4-2\,a^2\,b^2+b^4}+\frac {B\,\ln \left ({\mathrm {e}}^x-1\right )}{a+b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {A + B \coth {\relax (x )}}{a + b \cosh {\relax (x )}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________