Optimal. Leaf size=89 \[ \frac {a B \text {ArcTan}(\sinh (x))}{a^2+b^2}-\frac {2 A \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}-\frac {b B \log (\cosh (x))}{a^2+b^2}+\frac {b B \log (a+b \sinh (x))}{a^2+b^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 89, normalized size of antiderivative = 1.00, number of steps
used = 12, number of rules used = 11, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.733, Rules used = {4311, 4486,
2739, 632, 212, 2747, 720, 31, 649, 210, 266} \begin {gather*} -\frac {2 A \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}+\frac {a B \text {ArcTan}(\sinh (x))}{a^2+b^2}+\frac {b B \log (a+b \sinh (x))}{a^2+b^2}-\frac {b B \log (\cosh (x))}{a^2+b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 210
Rule 212
Rule 266
Rule 632
Rule 649
Rule 720
Rule 2739
Rule 2747
Rule 4311
Rule 4486
Rubi steps
\begin {align*} \int \frac {A+B \text {sech}(x)}{a+b \sinh (x)} \, dx &=\int \frac {(B+A \cosh (x)) \text {sech}(x)}{a+b \sinh (x)} \, dx\\ &=\int \left (\frac {A}{a+b \sinh (x)}+\frac {B \text {sech}(x)}{a+b \sinh (x)}\right ) \, dx\\ &=A \int \frac {1}{a+b \sinh (x)} \, dx+B \int \frac {\text {sech}(x)}{a+b \sinh (x)} \, dx\\ &=(2 A) \text {Subst}\left (\int \frac {1}{a+2 b x-a x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )-(b B) \text {Subst}\left (\int \frac {1}{(a+x) \left (-b^2-x^2\right )} \, dx,x,b \sinh (x)\right )\\ &=-\left ((4 A) \text {Subst}\left (\int \frac {1}{4 \left (a^2+b^2\right )-x^2} \, dx,x,2 b-2 a \tanh \left (\frac {x}{2}\right )\right )\right )+\frac {(b B) \text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \sinh (x)\right )}{a^2+b^2}+\frac {(b B) \text {Subst}\left (\int \frac {-a+x}{-b^2-x^2} \, dx,x,b \sinh (x)\right )}{a^2+b^2}\\ &=-\frac {2 A \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}+\frac {b B \log (a+b \sinh (x))}{a^2+b^2}+\frac {(b B) \text {Subst}\left (\int \frac {x}{-b^2-x^2} \, dx,x,b \sinh (x)\right )}{a^2+b^2}-\frac {(a b B) \text {Subst}\left (\int \frac {1}{-b^2-x^2} \, dx,x,b \sinh (x)\right )}{a^2+b^2}\\ &=\frac {a B \tan ^{-1}(\sinh (x))}{a^2+b^2}-\frac {2 A \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}-\frac {b B \log (\cosh (x))}{a^2+b^2}+\frac {b B \log (a+b \sinh (x))}{a^2+b^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.19, size = 93, normalized size = 1.04 \begin {gather*} \frac {2 a B \text {ArcTan}\left (\tanh \left (\frac {x}{2}\right )\right )}{a^2+b^2}+\frac {2 A \text {ArcTan}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {-a^2-b^2}}\right )}{\sqrt {-a^2-b^2}}-\frac {b B (\log (\cosh (x))-\log (a+b \sinh (x)))}{a^2+b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.64, size = 117, normalized size = 1.31
method | result | size |
default | \(\frac {2 B \left (-\frac {b \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )}{2}+a \arctan \left (\tanh \left (\frac {x}{2}\right )\right )\right )}{a^{2}+b^{2}}+\frac {b B \ln \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-2 b \tanh \left (\frac {x}{2}\right )-a \right )-\frac {2 \left (-a^{2} A -A \,b^{2}\right ) \arctanh \left (\frac {2 a \tanh \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}}{a^{2}+b^{2}}\) | \(117\) |
risch | \(\frac {2 x B b}{a^{2}+b^{2}}+\frac {2 x B \,a^{2} b}{-a^{4}-2 a^{2} b^{2}-b^{4}}+\frac {2 x B \,b^{3}}{-a^{4}-2 a^{2} b^{2}-b^{4}}+\frac {i B \ln \left ({\mathrm e}^{x}+i\right ) a}{a^{2}+b^{2}}-\frac {B \ln \left ({\mathrm e}^{x}+i\right ) b}{a^{2}+b^{2}}-\frac {i B \ln \left ({\mathrm e}^{x}-i\right ) a}{a^{2}+b^{2}}-\frac {B \ln \left ({\mathrm e}^{x}-i\right ) b}{a^{2}+b^{2}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {A a -\sqrt {A^{2} a^{2}+A^{2} b^{2}}}{A b}\right ) B b}{a^{2}+b^{2}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {A a -\sqrt {A^{2} a^{2}+A^{2} b^{2}}}{A b}\right ) \sqrt {A^{2} a^{2}+A^{2} b^{2}}}{a^{2}+b^{2}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {A a +\sqrt {A^{2} a^{2}+A^{2} b^{2}}}{A b}\right ) B b}{a^{2}+b^{2}}-\frac {\ln \left ({\mathrm e}^{x}+\frac {A a +\sqrt {A^{2} a^{2}+A^{2} b^{2}}}{A b}\right ) \sqrt {A^{2} a^{2}+A^{2} b^{2}}}{a^{2}+b^{2}}\) | \(362\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 125, normalized size = 1.40 \begin {gather*} -B {\left (\frac {2 \, a \arctan \left (e^{\left (-x\right )}\right )}{a^{2} + b^{2}} - \frac {b \log \left (-2 \, a e^{\left (-x\right )} + b e^{\left (-2 \, x\right )} - b\right )}{a^{2} + b^{2}} + \frac {b \log \left (e^{\left (-2 \, x\right )} + 1\right )}{a^{2} + b^{2}}\right )} + \frac {A \log \left (\frac {b e^{\left (-x\right )} - a - \sqrt {a^{2} + b^{2}}}{b e^{\left (-x\right )} - a + \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}}} \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. 172 vs.
\(2 (85) = 170\).
time = 2.11, size = 172, normalized size = 1.93 \begin {gather*} \frac {2 \, B a \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) + B b \log \left (\frac {2 \, {\left (b \sinh \left (x\right ) + a\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) - B b \log \left (\frac {2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + \sqrt {a^{2} + b^{2}} 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 )}{a^{2} + b^{2}} \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 \operatorname {sech}{\left (x \right )}}{a + b \sinh {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.44, size = 123, normalized size = 1.38 \begin {gather*} \frac {2 \, B a \arctan \left (e^{x}\right )}{a^{2} + b^{2}} - \frac {B b \log \left (e^{\left (2 \, x\right )} + 1\right )}{a^{2} + b^{2}} + \frac {B b \log \left ({\left | b e^{\left (2 \, x\right )} + 2 \, a e^{x} - b \right |}\right )}{a^{2} + b^{2}} + \frac {A \log \left (\frac {{\left | 2 \, b e^{x} + 2 \, a - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, b e^{x} + 2 \, a + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{\sqrt {a^{2} + b^{2}}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 10.64, size = 864, normalized size = 9.71 \begin {gather*} \frac {\ln \left (\frac {\left (A\,\sqrt {{\left (a^2+b^2\right )}^3}+B\,b^3+B\,a^2\,b\right )\,\left (b^3\,\left (32\,A^2-96\,{\mathrm {e}}^x\,A\,B+64\,B^2\right )-128\,A^2\,{\mathrm {e}}^x\,\sqrt {{\left (a^2+b^2\right )}^3}-a\,b^2\,\left (96\,{\mathrm {e}}^x\,A^2-192\,A\,B+128\,{\mathrm {e}}^x\,B^2\right )-128\,a^3\,{\mathrm {e}}^x\,\left (A^2+B^2\right )+a^2\,b\,\left (64\,A^2-384\,{\mathrm {e}}^x\,A\,B+64\,B^2\right )+\frac {32\,A\,b^6\,\left (2\,B+3\,A\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^4\,b^2\,\left (5\,B+3\,A\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^2\,b^4\,\left (7\,B+6\,A\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^3\,b^3\,\left (4\,A-19\,B\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {64\,A\,a\,b^5\,\left (A-4\,B\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^5\,b\,\left (2\,A-11\,B\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}\right )}{b^5\,{\left (a^2+b^2\right )}^2}-\frac {32\,B\,\left ({\mathrm {e}}^x\,A^2\,a\,b-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\,b+2\,B^2\,b^2\right )}{b^5}\right )\,\left (A\,\sqrt {{\left (a^2+b^2\right )}^3}+B\,b^3+B\,a^2\,b\right )}{a^4+2\,a^2\,b^2+b^4}-\frac {B\,\ln \left ({\mathrm {e}}^x+1{}\mathrm {i}\right )}{b+a\,1{}\mathrm {i}}+\frac {\ln \left (-\frac {32\,B\,\left ({\mathrm {e}}^x\,A^2\,a\,b-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\,b+2\,B^2\,b^2\right )}{b^5}-\frac {\left (B\,b^3-A\,\sqrt {{\left (a^2+b^2\right )}^3}+B\,a^2\,b\right )\,\left (a\,b^2\,\left (96\,{\mathrm {e}}^x\,A^2-192\,A\,B+128\,{\mathrm {e}}^x\,B^2\right )-128\,A^2\,{\mathrm {e}}^x\,\sqrt {{\left (a^2+b^2\right )}^3}-b^3\,\left (32\,A^2-96\,{\mathrm {e}}^x\,A\,B+64\,B^2\right )+128\,a^3\,{\mathrm {e}}^x\,\left (A^2+B^2\right )-a^2\,b\,\left (64\,A^2-384\,{\mathrm {e}}^x\,A\,B+64\,B^2\right )+\frac {32\,A\,b^6\,\left (2\,B+3\,A\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^4\,b^2\,\left (5\,B+3\,A\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^2\,b^4\,\left (7\,B+6\,A\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^3\,b^3\,\left (4\,A-19\,B\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {64\,A\,a\,b^5\,\left (A-4\,B\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}+\frac {32\,A\,a^5\,b\,\left (2\,A-11\,B\,{\mathrm {e}}^x\right )}{\sqrt {{\left (a^2+b^2\right )}^3}}\right )}{b^5\,{\left (a^2+b^2\right )}^2}\right )\,\left (B\,b^3-A\,\sqrt {{\left (a^2+b^2\right )}^3}+B\,a^2\,b\right )}{a^4+2\,a^2\,b^2+b^4}-\frac {B\,\ln \left ({\mathrm {e}}^x-\mathrm {i}\right )\,1{}\mathrm {i}}{a+b\,1{}\mathrm {i}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________