Optimal. Leaf size=89 \[ -\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 {a B \tan ^{-1}(\sinh (x))}{a^2+b^2}-\frac {b B \log (\cosh (x))}{a^2+b^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.25, 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 = {4226, 4401, 2660, 618, 206, 2668, 706, 31, 635, 204, 260} \[ -\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 {a B \tan ^{-1}(\sinh (x))}{a^2+b^2}-\frac {b B \log (\cosh (x))}{a^2+b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 204
Rule 206
Rule 260
Rule 618
Rule 635
Rule 706
Rule 2660
Rule 2668
Rule 4226
Rule 4401
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) \operatorname {Subst}\left (\int \frac {1}{a+2 b x-a x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )-(b B) \operatorname {Subst}\left (\int \frac {1}{(a+x) \left (-b^2-x^2\right )} \, dx,x,b \sinh (x)\right )\\ &=-\left ((4 A) \operatorname {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) \operatorname {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \sinh (x)\right )}{a^2+b^2}+\frac {(b B) \operatorname {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) \operatorname {Subst}\left (\int \frac {x}{-b^2-x^2} \, dx,x,b \sinh (x)\right )}{a^2+b^2}-\frac {(a b B) \operatorname {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.25, size = 93, normalized size = 1.04 \[ \frac {2 A \tan ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {-a^2-b^2}}\right )}{\sqrt {-a^2-b^2}}+\frac {2 a B \tan ^{-1}\left (\tanh \left (\frac {x}{2}\right )\right )}{a^2+b^2}-\frac {b B (\log (\cosh (x))-\log (a+b \sinh (x)))}{a^2+b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 8.22, size = 172, normalized size = 1.93 \[ \frac {2 \, B a \arctan \left (\cosh \relax (x) + \sinh \relax (x)\right ) + B b \log \left (\frac {2 \, {\left (b \sinh \relax (x) + a\right )}}{\cosh \relax (x) - \sinh \relax (x)}\right ) - B b \log \left (\frac {2 \, \cosh \relax (x)}{\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 )}{a^{2} + b^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.51, size = 123, normalized size = 1.38 \[ \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}}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.06, size = 150, normalized size = 1.69 \[ \frac {b B \ln \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-2 \tanh \left (\frac {x}{2}\right ) b -a \right )}{a^{2}+b^{2}}+\frac {2 \arctanh \left (\frac {2 a \tanh \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right ) a^{2} A}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}+\frac {2 \arctanh \left (\frac {2 a \tanh \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right ) A \,b^{2}}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}-\frac {B b \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )}{a^{2}+b^{2}}+\frac {2 B a \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{a^{2}+b^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.53, size = 125, normalized size = 1.40 \[ -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}}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 10.64, size = 864, normalized size = 9.71 \[ \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}} \]
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 \operatorname {sech}{\relax (x )}}{a + b \sinh {\relax (x )}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________