Optimal. Leaf size=63 \[ -\frac {a^2 \log (a \cosh (x)+b \sinh (x))}{b \left (a^2-b^2\right )}+\frac {a^3 x}{b^2 \left (a^2-b^2\right )}-\frac {a x}{b^2}+\frac {\log (\cosh (x))}{b} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.09, antiderivative size = 63, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {3541, 3475, 3484, 3530} \[ \frac {a^3 x}{b^2 \left (a^2-b^2\right )}-\frac {a^2 \log (a \cosh (x)+b \sinh (x))}{b \left (a^2-b^2\right )}-\frac {a x}{b^2}+\frac {\log (\cosh (x))}{b} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3484
Rule 3530
Rule 3541
Rubi steps
\begin {align*} \int \frac {\tanh ^2(x)}{a+b \tanh (x)} \, dx &=-\frac {a x}{b^2}+\frac {a^2 \int \frac {1}{a+b \tanh (x)} \, dx}{b^2}+\frac {\int \tanh (x) \, dx}{b}\\ &=-\frac {a x}{b^2}+\frac {a^3 x}{b^2 \left (a^2-b^2\right )}+\frac {\log (\cosh (x))}{b}-\frac {\left (i a^2\right ) \int \frac {-i b-i a \tanh (x)}{a+b \tanh (x)} \, dx}{b \left (a^2-b^2\right )}\\ &=-\frac {a x}{b^2}+\frac {a^3 x}{b^2 \left (a^2-b^2\right )}+\frac {\log (\cosh (x))}{b}-\frac {a^2 \log (a \cosh (x)+b \sinh (x))}{b \left (a^2-b^2\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.09, size = 49, normalized size = 0.78 \[ \frac {-a^2 \log (a \cosh (x)+b \sinh (x))+a^2 \log (\cosh (x))+a b x-b^2 \log (\cosh (x))}{a^2 b-b^3} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.60, size = 76, normalized size = 1.21 \[ -\frac {a^{2} \log \left (\frac {2 \, {\left (a \cosh \relax (x) + b \sinh \relax (x)\right )}}{\cosh \relax (x) - \sinh \relax (x)}\right ) - {\left (a b + b^{2}\right )} x - {\left (a^{2} - b^{2}\right )} \log \left (\frac {2 \, \cosh \relax (x)}{\cosh \relax (x) - \sinh \relax (x)}\right )}{a^{2} b - b^{3}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.14, size = 58, normalized size = 0.92 \[ -\frac {a^{2} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b \right |}\right )}{a^{2} b - b^{3}} + \frac {x}{a - b} + \frac {\log \left (e^{\left (2 \, x\right )} + 1\right )}{b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.05, size = 60, normalized size = 0.95 \[ -\frac {\ln \left (\tanh \relax (x )-1\right )}{2 b +2 a}+\frac {\ln \left (1+\tanh \relax (x )\right )}{2 a -2 b}-\frac {a^{2} \ln \left (a +b \tanh \relax (x )\right )}{\left (a +b \right ) \left (a -b \right ) b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.41, size = 56, normalized size = 0.89 \[ -\frac {a^{2} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} - a - b\right )}{a^{2} b - b^{3}} + \frac {x}{a + b} + \frac {\log \left (e^{\left (-2 \, x\right )} + 1\right )}{b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.12, size = 46, normalized size = 0.73 \[ -\frac {b^2\,\left (x-\ln \left (\mathrm {tanh}\relax (x)+1\right )\right )+a^2\,\ln \left (a+b\,\mathrm {tanh}\relax (x)\right )-a\,b\,x}{b\,\left (a^2-b^2\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.64, size = 243, normalized size = 3.86 \[ \begin {cases} \tilde {\infty } \left (x - \log {\left (\tanh {\relax (x )} + 1 \right )}\right ) & \text {for}\: a = 0 \wedge b = 0 \\\frac {3 x \tanh {\relax (x )}}{2 b \tanh {\relax (x )} - 2 b} - \frac {3 x}{2 b \tanh {\relax (x )} - 2 b} - \frac {2 \log {\left (\tanh {\relax (x )} + 1 \right )} \tanh {\relax (x )}}{2 b \tanh {\relax (x )} - 2 b} + \frac {2 \log {\left (\tanh {\relax (x )} + 1 \right )}}{2 b \tanh {\relax (x )} - 2 b} + \frac {1}{2 b \tanh {\relax (x )} - 2 b} & \text {for}\: a = - b \\\frac {x \tanh {\relax (x )}}{2 b \tanh {\relax (x )} + 2 b} + \frac {x}{2 b \tanh {\relax (x )} + 2 b} - \frac {2 \log {\left (\tanh {\relax (x )} + 1 \right )} \tanh {\relax (x )}}{2 b \tanh {\relax (x )} + 2 b} - \frac {2 \log {\left (\tanh {\relax (x )} + 1 \right )}}{2 b \tanh {\relax (x )} + 2 b} - \frac {1}{2 b \tanh {\relax (x )} + 2 b} & \text {for}\: a = b \\\frac {x - \tanh {\relax (x )}}{a} & \text {for}\: b = 0 \\- \frac {a^{2} \log {\left (\frac {a}{b} + \tanh {\relax (x )} \right )}}{a^{2} b - b^{3}} + \frac {a b x}{a^{2} b - b^{3}} - \frac {b^{2} x}{a^{2} b - b^{3}} + \frac {b^{2} \log {\left (\tanh {\relax (x )} + 1 \right )}}{a^{2} b - b^{3}} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________