Optimal. Leaf size=102 \[ \frac {a^2 b x}{\left (a^2-b^2\right )^2}-\frac {b x}{2 \left (a^2-b^2\right )}-\frac {a b^2 \log (a \cosh (x)+b \sinh (x))}{\left (a^2-b^2\right )^2}-\frac {b \cosh (x) \sinh (x)}{2 \left (a^2-b^2\right )}+\frac {a \sinh ^2(x)}{2 \left (a^2-b^2\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 102, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.389, Rules used = {3188, 2715, 8,
2644, 30, 3177, 3212} \begin {gather*} \frac {a^2 b x}{\left (a^2-b^2\right )^2}-\frac {b x}{2 \left (a^2-b^2\right )}+\frac {a \sinh ^2(x)}{2 \left (a^2-b^2\right )}-\frac {b \sinh (x) \cosh (x)}{2 \left (a^2-b^2\right )}-\frac {a b^2 \log (a \cosh (x)+b \sinh (x))}{\left (a^2-b^2\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 30
Rule 2644
Rule 2715
Rule 3177
Rule 3188
Rule 3212
Rubi steps
\begin {align*} \int \frac {\cosh ^2(x) \sinh (x)}{a \cosh (x)+b \sinh (x)} \, dx &=\frac {a \int \cosh (x) \sinh (x) \, dx}{a^2-b^2}-\frac {b \int \cosh ^2(x) \, dx}{a^2-b^2}+\frac {(a b) \int \frac {\cosh (x)}{a \cosh (x)+b \sinh (x)} \, dx}{a^2-b^2}\\ &=\frac {a^2 b x}{\left (a^2-b^2\right )^2}-\frac {b \cosh (x) \sinh (x)}{2 \left (a^2-b^2\right )}-\frac {\left (i a b^2\right ) \int \frac {-i b \cosh (x)-i a \sinh (x)}{a \cosh (x)+b \sinh (x)} \, dx}{\left (a^2-b^2\right )^2}-\frac {a \text {Subst}(\int x \, dx,x,i \sinh (x))}{a^2-b^2}-\frac {b \int 1 \, dx}{2 \left (a^2-b^2\right )}\\ &=\frac {a^2 b x}{\left (a^2-b^2\right )^2}-\frac {b x}{2 \left (a^2-b^2\right )}-\frac {a b^2 \log (a \cosh (x)+b \sinh (x))}{\left (a^2-b^2\right )^2}-\frac {b \cosh (x) \sinh (x)}{2 \left (a^2-b^2\right )}+\frac {a \sinh ^2(x)}{2 \left (a^2-b^2\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.17, size = 73, normalized size = 0.72 \begin {gather*} \frac {a \left (a^2-b^2\right ) \cosh (2 x)+b \left (2 \left (a^2+b^2\right ) x-4 a b \log (a \cosh (x)+b \sinh (x))+\left (-a^2+b^2\right ) \sinh (2 x)\right )}{4 (a-b)^2 (a+b)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 1.00, size = 146, normalized size = 1.43
method | result | size |
risch | \(\frac {b x}{2 \left (a +b \right )^{2}}+\frac {{\mathrm e}^{2 x}}{8 a +8 b}+\frac {{\mathrm e}^{-2 x}}{8 a -8 b}+\frac {2 a \,b^{2} x}{a^{4}-2 a^{2} b^{2}+b^{4}}-\frac {a \,b^{2} \ln \left ({\mathrm e}^{2 x}+\frac {a -b}{a +b}\right )}{a^{4}-2 a^{2} b^{2}+b^{4}}\) | \(99\) |
default | \(-\frac {4}{\left (8 a -8 b \right ) \left (\tanh \left (\frac {x}{2}\right )+1\right )}+\frac {2}{\left (4 a -4 b \right ) \left (\tanh \left (\frac {x}{2}\right )+1\right )^{2}}+\frac {b \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{2 \left (a -b \right )^{2}}-\frac {a \,b^{2} \ln \left (a +2 b \tanh \left (\frac {x}{2}\right )+a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}+\frac {2}{\left (4 a +4 b \right ) \left (\tanh \left (\frac {x}{2}\right )-1\right )^{2}}+\frac {4}{\left (8 a +8 b \right ) \left (\tanh \left (\frac {x}{2}\right )-1\right )}-\frac {b \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{2 \left (a +b \right )^{2}}\) | \(146\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 84, normalized size = 0.82 \begin {gather*} -\frac {a b^{2} \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} - a - b\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4}} + \frac {b x}{2 \, {\left (a^{2} + 2 \, a b + b^{2}\right )}} + \frac {e^{\left (2 \, x\right )}}{8 \, {\left (a + b\right )}} + \frac {e^{\left (-2 \, x\right )}}{8 \, {\left (a - b\right )}} \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. 334 vs.
\(2 (96) = 192\).
time = 0.37, size = 334, normalized size = 3.27 \begin {gather*} \frac {{\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{4} + 4 \, {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} + {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \sinh \left (x\right )^{4} + 4 \, {\left (a^{2} b + 2 \, a b^{2} + b^{3}\right )} x \cosh \left (x\right )^{2} + a^{3} + a^{2} b - a b^{2} - b^{3} + 2 \, {\left (3 \, {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (a^{2} b + 2 \, a b^{2} + b^{3}\right )} x\right )} \sinh \left (x\right )^{2} - 8 \, {\left (a b^{2} \cosh \left (x\right )^{2} + 2 \, a b^{2} \cosh \left (x\right ) \sinh \left (x\right ) + a b^{2} \sinh \left (x\right )^{2}\right )} \log \left (\frac {2 \, {\left (a \cosh \left (x\right ) + b \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 4 \, {\left ({\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{3} + 2 \, {\left (a^{2} b + 2 \, a b^{2} + b^{3}\right )} x \cosh \left (x\right )\right )} \sinh \left (x\right )}{8 \, {\left ({\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right ) + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sinh \left (x\right )^{2}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 102, normalized size = 1.00 \begin {gather*} -\frac {a b^{2} \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b \right |}\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4}} + \frac {b x}{2 \, {\left (a^{2} - 2 \, a b + b^{2}\right )}} - \frac {{\left (2 \, b e^{\left (2 \, x\right )} - a + b\right )} e^{\left (-2 \, x\right )}}{8 \, {\left (a^{2} - 2 \, a b + b^{2}\right )}} + \frac {e^{\left (2 \, x\right )}}{8 \, {\left (a + b\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.91, size = 81, normalized size = 0.79 \begin {gather*} \frac {{\mathrm {e}}^{-2\,x}}{8\,a-8\,b}+\frac {{\mathrm {e}}^{2\,x}}{8\,a+8\,b}+\frac {b\,x}{2\,{\left (a-b\right )}^2}-\frac {a\,b^2\,\ln \left (a-b+a\,{\mathrm {e}}^{2\,x}+b\,{\mathrm {e}}^{2\,x}\right )}{a^4-2\,a^2\,b^2+b^4} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________