Optimal. Leaf size=62 \[ \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))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, 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 = {4476, 2772,
2814, 2739, 632, 212} \begin {gather*} \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} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 632
Rule 2739
Rule 2772
Rule 2814
Rule 4476
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) \text {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) \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 )}{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] Result contains complex when optimal does not.
time = 1.44, size = 502, normalized size = 8.10 \begin {gather*} -\frac {\cosh (x) \left (-2 a \sqrt {a-i b} \sqrt {a+i b} \tanh ^{-1}\left (\frac {\sqrt {-\frac {b (i+\sinh (x))}{a-i b}}}{\sqrt {-\frac {b (-i+\sinh (x))}{a+i b}}}\right ) \sqrt {1+i \sinh (x)} (a+b \sinh (x))+2 a (a-i b) \tanh ^{-1}\left (\frac {\sqrt {a-i b} \sqrt {-\frac {b (i+\sinh (x))}{a-i b}}}{\sqrt {a+i b} \sqrt {-\frac {b (-i+\sinh (x))}{a+i b}}}\right ) \sqrt {1+i \sinh (x)} (a+b \sinh (x))+\sqrt {a+i b} \sqrt {-\frac {b (-i+\sinh (x))}{a+i b}} \left (-2 \sqrt [4]{-1} a \sqrt {b} (i a+b) \text {ArcSin}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {a-i b} \sqrt {-\frac {b (i+\sinh (x))}{a-i b}}}{\sqrt {b}}\right )-2 \sqrt [4]{-1} b^{3/2} (i a+b) \text {ArcSin}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {a-i b} \sqrt {-\frac {b (i+\sinh (x))}{a-i b}}}{\sqrt {b}}\right ) \sinh (x)+\sqrt {a-i b} \left (a^2+b^2\right ) \sqrt {1+i \sinh (x)} \sqrt {-\frac {b (i+\sinh (x))}{a-i b}}\right )\right )}{(a-i b)^{3/2} (a+i b)^{3/2} b \sqrt {1+i \sinh (x)} \sqrt {-\frac {b (-i+\sinh (x))}{a+i b}} \sqrt {-\frac {b (i+\sinh (x))}{a-i b}} (a+b \sinh (x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 1.13, size = 101, normalized size = 1.63
method | result | size |
default | \(\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{b^{2}}+\frac {\frac {2 \left (\frac {b^{2} \tanh \left (\frac {x}{2}\right )}{a}+b \right )}{a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-2 b \tanh \left (\frac {x}{2}\right )-a}-\frac {2 a \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}}}}{b^{2}}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{b^{2}}\) | \(101\) |
risch | \(\frac {x}{b^{2}}+\frac {2 a \,{\mathrm e}^{x}-2 b}{b^{2} \left (b \,{\mathrm e}^{2 x}+2 a \,{\mathrm e}^{x}-b \right )}+\frac {a \ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}+a^{2}+b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right )}{\sqrt {a^{2}+b^{2}}\, b^{2}}-\frac {a \ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}+b^{2}}-a^{2}-b^{2}}{\sqrt {a^{2}+b^{2}}\, b}\right )}{\sqrt {a^{2}+b^{2}}\, b^{2}}\) | \(140\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 100, normalized size = 1.61 \begin {gather*} -\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}} \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. 362 vs.
\(2 (58) = 116\).
time = 0.40, size = 362, normalized size = 5.84 \begin {gather*} -\frac {{\left (a^{2} b + b^{3}\right )} x \cosh \left (x\right )^{2} + {\left (a^{2} b + b^{3}\right )} x \sinh \left (x\right )^{2} - 2 \, a^{2} b - 2 \, b^{3} + {\left (a b \cosh \left (x\right )^{2} + a b \sinh \left (x\right )^{2} + 2 \, a^{2} \cosh \left (x\right ) - a b + 2 \, {\left (a b \cosh \left (x\right ) + a^{2}\right )} \sinh \left (x\right )\right )} \sqrt {a^{2} + b^{2}} \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 (a^{2} b + b^{3}\right )} x + 2 \, {\left (a^{3} + a b^{2} + {\left (a^{3} + a b^{2}\right )} x\right )} \cosh \left (x\right ) + 2 \, {\left (a^{3} + a b^{2} + {\left (a^{2} b + b^{3}\right )} x \cosh \left (x\right ) + {\left (a^{3} + a b^{2}\right )} x\right )} \sinh \left (x\right )}{a^{2} b^{3} + b^{5} - {\left (a^{2} b^{3} + b^{5}\right )} \cosh \left (x\right )^{2} - {\left (a^{2} b^{3} + b^{5}\right )} \sinh \left (x\right )^{2} - 2 \, {\left (a^{3} b^{2} + a b^{4}\right )} \cosh \left (x\right ) - 2 \, {\left (a^{3} b^{2} + a b^{4} + {\left (a^{2} b^{3} + b^{5}\right )} \cosh \left (x\right )\right )} \sinh \left (x\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 {1}{\left (a \operatorname {sech}{\left (x \right )} + b \tanh {\left (x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 97, normalized size = 1.56 \begin {gather*} -\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}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.74, size = 132, normalized size = 2.13 \begin {gather*} \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}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________