Optimal. Leaf size=82 \[ \frac {2 (a A-b B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} (a+b)^{3/2}}-\frac {(A b-a B) \sinh (x)}{\left (a^2-b^2\right ) (a+b \cosh (x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.267, Rules used = {2833, 12, 2738,
214} \begin {gather*} \frac {2 (a A-b B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} (a+b)^{3/2}}-\frac {\sinh (x) (A b-a B)}{\left (a^2-b^2\right ) (a+b \cosh (x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 214
Rule 2738
Rule 2833
Rubi steps
\begin {align*} \int \frac {A+B \cosh (x)}{(a+b \cosh (x))^2} \, dx &=-\frac {(A b-a B) \sinh (x)}{\left (a^2-b^2\right ) (a+b \cosh (x))}+\frac {\int \frac {-a A+b B}{a+b \cosh (x)} \, dx}{-a^2+b^2}\\ &=-\frac {(A b-a B) \sinh (x)}{\left (a^2-b^2\right ) (a+b \cosh (x))}+\frac {(a A-b B) \int \frac {1}{a+b \cosh (x)} \, dx}{a^2-b^2}\\ &=-\frac {(A b-a B) \sinh (x)}{\left (a^2-b^2\right ) (a+b \cosh (x))}+\frac {(2 (a A-b B)) \text {Subst}\left (\int \frac {1}{a+b-(a-b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{a^2-b^2}\\ &=\frac {2 (a A-b B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} (a+b)^{3/2}}-\frac {(A b-a B) \sinh (x)}{\left (a^2-b^2\right ) (a+b \cosh (x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.14, size = 81, normalized size = 0.99 \begin {gather*} \frac {2 (a A-b B) \text {ArcTan}\left (\frac {(a-b) \tanh \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2}}\right )}{\left (-a^2+b^2\right )^{3/2}}+\frac {(-A b+a B) \sinh (x)}{(a-b) (a+b) (a+b \cosh (x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.42, size = 108, normalized size = 1.32
method | result | size |
default | \(\frac {2 \left (A b -B a \right ) \tanh \left (\frac {x}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-b \left (\tanh ^{2}\left (\frac {x}{2}\right )\right )-a -b \right )}+\frac {2 \left (A a -B b \right ) \arctanh \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}\) | \(108\) |
risch | \(\frac {2 \left (A b -B a \right ) \left (a \,{\mathrm e}^{x}+b \right )}{b \left (a^{2}-b^{2}\right ) \left (b \,{\mathrm e}^{2 x}+2 a \,{\mathrm e}^{x}+b \right )}+\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}-b^{2}}-a^{2}+b^{2}}{b \sqrt {a^{2}-b^{2}}}\right ) A a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right )}-\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}-b^{2}}-a^{2}+b^{2}}{b \sqrt {a^{2}-b^{2}}}\right ) B b}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right )}-\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}-b^{2}}+a^{2}-b^{2}}{b \sqrt {a^{2}-b^{2}}}\right ) A a}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right )}+\frac {\ln \left ({\mathrm e}^{x}+\frac {a \sqrt {a^{2}-b^{2}}+a^{2}-b^{2}}{b \sqrt {a^{2}-b^{2}}}\right ) B b}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right )}\) | \(317\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \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. 377 vs.
\(2 (71) = 142\).
time = 0.39, size = 828, normalized size = 10.10 \begin {gather*} \left [-\frac {2 \, B a^{3} b - 2 \, A a^{2} b^{2} - 2 \, B a b^{3} + 2 \, A b^{4} - {\left (A a b^{2} - B b^{3} + {\left (A a b^{2} - B b^{3}\right )} \cosh \left (x\right )^{2} + {\left (A a b^{2} - B b^{3}\right )} \sinh \left (x\right )^{2} + 2 \, {\left (A a^{2} b - B a b^{2}\right )} \cosh \left (x\right ) + 2 \, {\left (A a^{2} b - B a b^{2} + {\left (A a b^{2} - B b^{3}\right )} \cosh \left (x\right )\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 ) + 2 \, {\left (B a^{4} - A a^{3} b - B a^{2} b^{2} + A a b^{3}\right )} \cosh \left (x\right ) + 2 \, {\left (B a^{4} - A a^{3} b - B a^{2} b^{2} + A a b^{3}\right )} \sinh \left (x\right )}{a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6} + {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} \cosh \left (x\right )^{2} + {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} \sinh \left (x\right )^{2} + 2 \, {\left (a^{5} b - 2 \, a^{3} b^{3} + a b^{5}\right )} \cosh \left (x\right ) + 2 \, {\left (a^{5} b - 2 \, a^{3} b^{3} + a b^{5} + {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )}, -\frac {2 \, {\left (B a^{3} b - A a^{2} b^{2} - B a b^{3} + A b^{4} + {\left (A a b^{2} - B b^{3} + {\left (A a b^{2} - B b^{3}\right )} \cosh \left (x\right )^{2} + {\left (A a b^{2} - B b^{3}\right )} \sinh \left (x\right )^{2} + 2 \, {\left (A a^{2} b - B a b^{2}\right )} \cosh \left (x\right ) + 2 \, {\left (A a^{2} b - B a b^{2} + {\left (A a b^{2} - B b^{3}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cosh \left (x\right ) + b \sinh \left (x\right ) + a\right )}}{a^{2} - b^{2}}\right ) + {\left (B a^{4} - A a^{3} b - B a^{2} b^{2} + A a b^{3}\right )} \cosh \left (x\right ) + {\left (B a^{4} - A a^{3} b - B a^{2} b^{2} + A a b^{3}\right )} \sinh \left (x\right )\right )}}{a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6} + {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} \cosh \left (x\right )^{2} + {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} \sinh \left (x\right )^{2} + 2 \, {\left (a^{5} b - 2 \, a^{3} b^{3} + a b^{5}\right )} \cosh \left (x\right ) + 2 \, {\left (a^{5} b - 2 \, a^{3} b^{3} + a b^{5} + {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right )}\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 = 107, normalized size = 1.30 \begin {gather*} \frac {2 \, {\left (A a - B b\right )} \arctan \left (\frac {b e^{x} + a}{\sqrt {-a^{2} + b^{2}}}\right )}{{\left (a^{2} - b^{2}\right )} \sqrt {-a^{2} + b^{2}}} - \frac {2 \, {\left (B a^{2} e^{x} - A a b e^{x} + B a b - A b^{2}\right )}}{{\left (a^{2} b - b^{3}\right )} {\left (b e^{\left (2 \, x\right )} + 2 \, a e^{x} + b\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.42, size = 246, normalized size = 3.00 \begin {gather*} \frac {\frac {2\,\left (A\,b^3-B\,a\,b^2\right )}{b\,\left (a^2\,b-b^3\right )}-\frac {2\,{\mathrm {e}}^x\,\left (B\,a^2\,b^2-A\,a\,b^3\right )}{b^2\,\left (a^2\,b-b^3\right )}}{b+2\,a\,{\mathrm {e}}^x+b\,{\mathrm {e}}^{2\,x}}+\frac {\ln \left (-\frac {2\,{\mathrm {e}}^x\,\left (A\,a-B\,b\right )}{b\,\left (a^2-b^2\right )}-\frac {2\,\left (b+a\,{\mathrm {e}}^x\right )\,\left (A\,a-B\,b\right )}{b\,{\left (a+b\right )}^{3/2}\,{\left (a-b\right )}^{3/2}}\right )\,\left (A\,a-B\,b\right )}{{\left (a+b\right )}^{3/2}\,{\left (a-b\right )}^{3/2}}-\frac {\ln \left (\frac {2\,\left (b+a\,{\mathrm {e}}^x\right )\,\left (A\,a-B\,b\right )}{b\,{\left (a+b\right )}^{3/2}\,{\left (a-b\right )}^{3/2}}-\frac {2\,{\mathrm {e}}^x\,\left (A\,a-B\,b\right )}{b\,\left (a^2-b^2\right )}\right )\,\left (A\,a-B\,b\right )}{{\left (a+b\right )}^{3/2}\,{\left (a-b\right )}^{3/2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________