Optimal. Leaf size=62 \[ \frac {2 a \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b^2 \sqrt {a^2+b^2}}-\frac {\cosh (x)}{b (a+b \sinh (x))}+\frac {x}{b^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.13, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.546, Rules used = {4391, 2693, 2735, 2660, 618, 206} \[ \frac {2 a \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b^2 \sqrt {a^2+b^2}}-\frac {\cosh (x)}{b (a+b \sinh (x))}+\frac {x}{b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 206
Rule 618
Rule 2660
Rule 2693
Rule 2735
Rule 4391
Rubi steps
\begin {align*} \int \frac {1}{(a \text {sech}(x)+b \tanh (x))^2} \, dx &=\int \frac {\cosh ^2(x)}{(a+b \sinh (x))^2} \, dx\\ &=-\frac {\cosh (x)}{b (a+b \sinh (x))}+\frac {\int \frac {\sinh (x)}{a+b \sinh (x)} \, dx}{b}\\ &=\frac {x}{b^2}-\frac {\cosh (x)}{b (a+b \sinh (x))}-\frac {a \int \frac {1}{a+b \sinh (x)} \, dx}{b^2}\\ &=\frac {x}{b^2}-\frac {\cosh (x)}{b (a+b \sinh (x))}-\frac {(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^2}\\ &=\frac {x}{b^2}-\frac {\cosh (x)}{b (a+b \sinh (x))}+\frac {(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 )}{b^2}\\ &=\frac {x}{b^2}+\frac {2 a \tanh ^{-1}\left (\frac {b-a \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{b^2 \sqrt {a^2+b^2}}-\frac {\cosh (x)}{b (a+b \sinh (x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 2.08, size = 502, normalized size = 8.10 \[ -\frac {\cosh (x) \left (\sqrt {a+i b} \sqrt {-\frac {b (\sinh (x)-i)}{a+i b}} \left (\sqrt {a-i b} \left (a^2+b^2\right ) \sqrt {1+i \sinh (x)} \sqrt {-\frac {b (\sinh (x)+i)}{a-i b}}-2 \sqrt [4]{-1} b^{3/2} (b+i a) \sinh (x) \sin ^{-1}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {a-i b} \sqrt {-\frac {b (\sinh (x)+i)}{a-i b}}}{\sqrt {b}}\right )-2 \sqrt [4]{-1} a \sqrt {b} (b+i a) \sin ^{-1}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {a-i b} \sqrt {-\frac {b (\sinh (x)+i)}{a-i b}}}{\sqrt {b}}\right )\right )-2 a \sqrt {a-i b} \sqrt {a+i b} \sqrt {1+i \sinh (x)} (a+b \sinh (x)) \tanh ^{-1}\left (\frac {\sqrt {-\frac {b (\sinh (x)+i)}{a-i b}}}{\sqrt {-\frac {b (\sinh (x)-i)}{a+i b}}}\right )+2 a (a-i b) \sqrt {1+i \sinh (x)} (a+b \sinh (x)) \tanh ^{-1}\left (\frac {\sqrt {a-i b} \sqrt {-\frac {b (\sinh (x)+i)}{a-i b}}}{\sqrt {a+i b} \sqrt {-\frac {b (\sinh (x)-i)}{a+i b}}}\right )\right )}{b (a-i b)^{3/2} (a+i b)^{3/2} \sqrt {1+i \sinh (x)} \sqrt {-\frac {b (\sinh (x)-i)}{a+i b}} \sqrt {-\frac {b (\sinh (x)+i)}{a-i b}} (a+b \sinh (x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.42, size = 362, normalized size = 5.84 \[ -\frac {{\left (a^{2} b + b^{3}\right )} x \cosh \relax (x)^{2} + {\left (a^{2} b + b^{3}\right )} x \sinh \relax (x)^{2} - 2 \, a^{2} b - 2 \, b^{3} + {\left (a b \cosh \relax (x)^{2} + a b \sinh \relax (x)^{2} + 2 \, a^{2} \cosh \relax (x) - a b + 2 \, {\left (a b \cosh \relax (x) + a^{2}\right )} \sinh \relax (x)\right )} \sqrt {a^{2} + b^{2}} \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 (a^{2} b + b^{3}\right )} x + 2 \, {\left (a^{3} + a b^{2} + {\left (a^{3} + a b^{2}\right )} x\right )} \cosh \relax (x) + 2 \, {\left (a^{3} + a b^{2} + {\left (a^{2} b + b^{3}\right )} x \cosh \relax (x) + {\left (a^{3} + a b^{2}\right )} x\right )} \sinh \relax (x)}{a^{2} b^{3} + b^{5} - {\left (a^{2} b^{3} + b^{5}\right )} \cosh \relax (x)^{2} - {\left (a^{2} b^{3} + b^{5}\right )} \sinh \relax (x)^{2} - 2 \, {\left (a^{3} b^{2} + a b^{4}\right )} \cosh \relax (x) - 2 \, {\left (a^{3} b^{2} + a b^{4} + {\left (a^{2} b^{3} + b^{5}\right )} \cosh \relax (x)\right )} \sinh \relax (x)} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.14, size = 97, normalized size = 1.56 \[ -\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}} b^{2}} + \frac {x}{b^{2}} + \frac {2 \, {\left (a e^{x} - b\right )}}{{\left (b e^{\left (2 \, x\right )} + 2 \, a e^{x} - b\right )} b^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.28, size = 119, normalized size = 1.92 \[ -\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{b^{2}}+\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{b^{2}}+\frac {2 \tanh \left (\frac {x}{2}\right )}{\left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-2 \tanh \left (\frac {x}{2}\right ) b -a \right ) a}+\frac {2}{b \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-2 \tanh \left (\frac {x}{2}\right ) b -a \right )}-\frac {2 a \arctanh \left (\frac {2 a \tanh \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{b^{2} \sqrt {a^{2}+b^{2}}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.43, size = 100, normalized size = 1.61 \[ -\frac {2 \, {\left (a e^{\left (-x\right )} + b\right )}}{2 \, a b^{2} e^{\left (-x\right )} - b^{3} e^{\left (-2 \, x\right )} + b^{3}} - \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}} b^{2}} + \frac {x}{b^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.74, size = 132, normalized size = 2.13 \[ \frac {x}{b^2}-\frac {\frac {2}{b}-\frac {2\,a\,{\mathrm {e}}^x}{b^2}}{2\,a\,{\mathrm {e}}^x-b+b\,{\mathrm {e}}^{2\,x}}-\frac {a\,\ln \left (\frac {2\,a\,{\mathrm {e}}^x}{b^3}-\frac {2\,a\,\left (b-a\,{\mathrm {e}}^x\right )}{b^3\,\sqrt {a^2+b^2}}\right )}{b^2\,\sqrt {a^2+b^2}}+\frac {a\,\ln \left (\frac {2\,a\,{\mathrm {e}}^x}{b^3}+\frac {2\,a\,\left (b-a\,{\mathrm {e}}^x\right )}{b^3\,\sqrt {a^2+b^2}}\right )}{b^2\,\sqrt {a^2+b^2}} \]
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 {1}{\left (a \operatorname {sech}{\relax (x )} + b \tanh {\relax (x )}\right )^{2}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________