Optimal. Leaf size=85 \[ \frac{x \left (a^2+2 b^2\right )}{2 a^3}-\frac{2 b^3 \tan ^{-1}\left (\frac{\sqrt{a-b} \tanh \left (\frac{x}{2}\right )}{\sqrt{a+b}}\right )}{a^3 \sqrt{a-b} \sqrt{a+b}}-\frac{b \sinh (x)}{a^2}+\frac{\sinh (x) \cosh (x)}{2 a} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.264664, antiderivative size = 85, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.462, Rules used = {3853, 4104, 3919, 3831, 2659, 205} \[ \frac{x \left (a^2+2 b^2\right )}{2 a^3}-\frac{2 b^3 \tan ^{-1}\left (\frac{\sqrt{a-b} \tanh \left (\frac{x}{2}\right )}{\sqrt{a+b}}\right )}{a^3 \sqrt{a-b} \sqrt{a+b}}-\frac{b \sinh (x)}{a^2}+\frac{\sinh (x) \cosh (x)}{2 a} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3853
Rule 4104
Rule 3919
Rule 3831
Rule 2659
Rule 205
Rubi steps
\begin{align*} \int \frac{\cosh ^2(x)}{a+b \text{sech}(x)} \, dx &=\frac{\cosh (x) \sinh (x)}{2 a}+\frac{\int \frac{\cosh (x) \left (-2 b+a \text{sech}(x)+b \text{sech}^2(x)\right )}{a+b \text{sech}(x)} \, dx}{2 a}\\ &=-\frac{b \sinh (x)}{a^2}+\frac{\cosh (x) \sinh (x)}{2 a}-\frac{\int \frac{-a^2-2 b^2-a b \text{sech}(x)}{a+b \text{sech}(x)} \, dx}{2 a^2}\\ &=\frac{\left (a^2+2 b^2\right ) x}{2 a^3}-\frac{b \sinh (x)}{a^2}+\frac{\cosh (x) \sinh (x)}{2 a}-\frac{b^3 \int \frac{\text{sech}(x)}{a+b \text{sech}(x)} \, dx}{a^3}\\ &=\frac{\left (a^2+2 b^2\right ) x}{2 a^3}-\frac{b \sinh (x)}{a^2}+\frac{\cosh (x) \sinh (x)}{2 a}-\frac{b^2 \int \frac{1}{1+\frac{a \cosh (x)}{b}} \, dx}{a^3}\\ &=\frac{\left (a^2+2 b^2\right ) x}{2 a^3}-\frac{b \sinh (x)}{a^2}+\frac{\cosh (x) \sinh (x)}{2 a}-\frac{\left (2 b^2\right ) \operatorname{Subst}\left (\int \frac{1}{1+\frac{a}{b}-\left (1-\frac{a}{b}\right ) x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{a^3}\\ &=\frac{\left (a^2+2 b^2\right ) x}{2 a^3}-\frac{2 b^3 \tan ^{-1}\left (\frac{\sqrt{a-b} \tanh \left (\frac{x}{2}\right )}{\sqrt{a+b}}\right )}{a^3 \sqrt{a-b} \sqrt{a+b}}-\frac{b \sinh (x)}{a^2}+\frac{\cosh (x) \sinh (x)}{2 a}\\ \end{align*}
Mathematica [A] time = 0.124125, size = 78, normalized size = 0.92 \[ \frac{\frac{8 b^3 \tan ^{-1}\left (\frac{(b-a) \tanh \left (\frac{x}{2}\right )}{\sqrt{a^2-b^2}}\right )}{\sqrt{a^2-b^2}}+2 a^2 x+a^2 \sinh (2 x)-4 a b \sinh (x)+4 b^2 x}{4 a^3} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.031, size = 174, normalized size = 2.1 \begin{align*} -{\frac{1}{2\,a} \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) ^{-2}}+{\frac{1}{2\,a} \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) ^{-1}}+{\frac{b}{{a}^{2}} \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) ^{-1}}+{\frac{1}{2\,a}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) }+{\frac{{b}^{2}}{{a}^{3}}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) }+{\frac{1}{2\,a} \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) ^{-2}}+{\frac{1}{2\,a} \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) ^{-1}}+{\frac{b}{{a}^{2}} \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) ^{-1}}-{\frac{1}{2\,a}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) }-{\frac{{b}^{2}}{{a}^{3}}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) }-2\,{\frac{{b}^{3}}{{a}^{3}\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}\arctan \left ({\frac{ \left ( a-b \right ) \tanh \left ( x/2 \right ) }{\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.60045, size = 2067, normalized size = 24.32 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\cosh ^{2}{\left (x \right )}}{a + b \operatorname{sech}{\left (x \right )}}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.13296, size = 124, normalized size = 1.46 \begin{align*} -\frac{2 \, b^{3} \arctan \left (\frac{a e^{x} + b}{\sqrt{a^{2} - b^{2}}}\right )}{\sqrt{a^{2} - b^{2}} a^{3}} + \frac{a e^{\left (2 \, x\right )} - 4 \, b e^{x}}{8 \, a^{2}} + \frac{{\left (a^{2} + 2 \, b^{2}\right )} x}{2 \, a^{3}} + \frac{{\left (4 \, a b e^{x} - a^{2}\right )} e^{\left (-2 \, x\right )}}{8 \, a^{3}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]