Optimal. Leaf size=65 \[ \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 (\cosh (x))}{a}-\frac {B \log (a+b \cosh (x))}{a} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.467, Rules used = {4486, 2738,
214, 2800, 36, 29, 31} \begin {gather*} \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 (a+b \cosh (x))}{a}+\frac {B \log (\cosh (x))}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 29
Rule 31
Rule 36
Rule 214
Rule 2738
Rule 2800
Rule 4486
Rubi steps
\begin {align*} \int \frac {A+B \tanh (x)}{a+b \cosh (x)} \, dx &=\int \left (\frac {A}{a+b \cosh (x)}+\frac {B \tanh (x)}{a+b \cosh (x)}\right ) \, dx\\ &=A \int \frac {1}{a+b \cosh (x)} \, dx+B \int \frac {\tanh (x)}{a+b \cosh (x)} \, dx\\ &=(2 A) \text {Subst}\left (\int \frac {1}{a+b-(a-b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )+B \text {Subst}\left (\int \frac {1}{x (a+x)} \, 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 \text {Subst}\left (\int \frac {1}{x} \, dx,x,b \cosh (x)\right )}{a}-\frac {B \text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \cosh (x)\right )}{a}\\ &=\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 (\cosh (x))}{a}-\frac {B \log (a+b \cosh (x))}{a}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.12, size = 61, normalized size = 0.94 \begin {gather*} -\frac {2 A \text {ArcTan}\left (\frac {(a-b) \tanh \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+\frac {B (\log (\cosh (x))-\log (a+b \cosh (x)))}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.76, size = 100, normalized size = 1.54
method | result | size |
default | \(\frac {\frac {2 \left (-B a +B b \right ) \ln \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-b \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-a -b \right )}{2 a -2 b}+\frac {2 A a \arctanh \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}}{a}+\frac {B \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )}{a}\) | \(100\) |
risch | \(-\frac {2 x B}{a}-\frac {2 x B \,a^{3}}{-a^{4}+a^{2} b^{2}}+\frac {2 x B a \,b^{2}}{-a^{4}+a^{2} b^{2}}+\frac {B \ln \left (1+{\mathrm e}^{2 x}\right )}{a}-\frac {a \ln \left ({\mathrm e}^{x}+\frac {a^{2} A -\sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{A a b}\right ) B}{a^{2}-b^{2}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {a^{2} A -\sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{A a b}\right ) B \,b^{2}}{\left (a^{2}-b^{2}\right ) a}+\frac {\ln \left ({\mathrm e}^{x}+\frac {a^{2} A -\sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{A a b}\right ) \sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{\left (a^{2}-b^{2}\right ) a}-\frac {a \ln \left ({\mathrm e}^{x}+\frac {a^{2} A +\sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{A a b}\right ) B}{a^{2}-b^{2}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {a^{2} A +\sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{A a b}\right ) B \,b^{2}}{\left (a^{2}-b^{2}\right ) a}-\frac {\ln \left ({\mathrm e}^{x}+\frac {a^{2} A +\sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{A a b}\right ) \sqrt {A^{2} a^{4}-A^{2} a^{2} b^{2}}}{\left (a^{2}-b^{2}\right ) a}\) | \(459\) |
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. 124 vs.
\(2 (55) = 110\).
time = 0.38, size = 315, normalized size = 4.85 \begin {gather*} \left [\frac {\sqrt {a^{2} - b^{2}} A a \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 ) - {\left (B a^{2} - B b^{2}\right )} \log \left (\frac {2 \, {\left (b \cosh \left (x\right ) + a\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + {\left (B a^{2} - B b^{2}\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{3} - a b^{2}}, -\frac {2 \, \sqrt {-a^{2} + b^{2}} A a \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cosh \left (x\right ) + b \sinh \left (x\right ) + a\right )}}{a^{2} - b^{2}}\right ) + {\left (B a^{2} - B b^{2}\right )} \log \left (\frac {2 \, {\left (b \cosh \left (x\right ) + a\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) - {\left (B a^{2} - B b^{2}\right )} \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{3} - a b^{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 {A + B \tanh {\left (x \right )}}{a + b \cosh {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.44, size = 66, normalized size = 1.02 \begin {gather*} \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 (b e^{\left (2 \, x\right )} + 2 \, a e^{x} + b\right )}{a} + \frac {B \log \left (e^{\left (2 \, x\right )} + 1\right )}{a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.14, size = 160, normalized size = 2.46 \begin {gather*} \frac {B\,\ln \left (16\,B^2\,b^2-16\,B^2\,a^2-16\,B^2\,a^2\,{\mathrm {e}}^{2\,x}+16\,B^2\,b^2\,{\mathrm {e}}^{2\,x}\right )}{a}-\frac {B\,\ln \left (16\,B^2\,b+32\,B^2\,a\,{\mathrm {e}}^x+16\,B^2\,b\,{\mathrm {e}}^{2\,x}\right )}{a}-\frac {2\,\mathrm {atan}\left (\frac {A^2\,b^2\,{\mathrm {e}}^x\,\sqrt {b^2-a^2}+A^2\,a\,b\,\sqrt {b^2-a^2}}{A\,b\,\left (a^2-b^2\right )\,\sqrt {A^2}}\right )\,\sqrt {A^2}}{\sqrt {b^2-a^2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________