Optimal. Leaf size=29 \[ -a b \cosh (x)-\text{sech}(x) (b-a \sinh (x)) (a+b \sinh (x))+b^2 x \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0627443, antiderivative size = 29, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.273, Rules used = {4391, 2691, 2638} \[ -a b \cosh (x)-\text{sech}(x) (b-a \sinh (x)) (a+b \sinh (x))+b^2 x \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4391
Rule 2691
Rule 2638
Rubi steps
\begin{align*} \int (a \text{sech}(x)+b \tanh (x))^2 \, dx &=\int \text{sech}^2(x) (a+b \sinh (x))^2 \, dx\\ &=-\text{sech}(x) (b-a \sinh (x)) (a+b \sinh (x))-\int \left (-b^2+a b \sinh (x)\right ) \, dx\\ &=b^2 x-\text{sech}(x) (b-a \sinh (x)) (a+b \sinh (x))-(a b) \int \sinh (x) \, dx\\ &=b^2 x-a b \cosh (x)-\text{sech}(x) (b-a \sinh (x)) (a+b \sinh (x))\\ \end{align*}
Mathematica [A] time = 0.0476505, size = 26, normalized size = 0.9 \[ \left (a^2-b^2\right ) \tanh (x)-2 a b \text{sech}(x)+b^2 \tanh ^{-1}(\tanh (x)) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.014, size = 36, normalized size = 1.2 \begin{align*}{a}^{2}\tanh \left ( x \right ) +2\,ab \left ({\frac{ \left ( \sinh \left ( x \right ) \right ) ^{2}}{\cosh \left ( x \right ) }}-\cosh \left ( x \right ) \right ) +{b}^{2} \left ( x-\tanh \left ( x \right ) \right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.05664, size = 58, normalized size = 2. \begin{align*} b^{2}{\left (x - \frac{2}{e^{\left (-2 \, x\right )} + 1}\right )} - \frac{4 \, a b}{e^{\left (-x\right )} + e^{x}} + \frac{2 \, a^{2}}{e^{\left (-2 \, x\right )} + 1} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.26537, size = 95, normalized size = 3.28 \begin{align*} -\frac{2 \, a b -{\left (b^{2} x - a^{2} + b^{2}\right )} \cosh \left (x\right ) -{\left (a^{2} - b^{2}\right )} \sinh \left (x\right )}{\cosh \left (x\right )} \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 \left (a \operatorname{sech}{\left (x \right )} + b \tanh{\left (x \right )}\right )^{2}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.13688, size = 42, normalized size = 1.45 \begin{align*} b^{2} x - \frac{2 \,{\left (2 \, a b e^{x} + a^{2} - b^{2}\right )}}{e^{\left (2 \, x\right )} + 1} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]