Integrand size = 13, antiderivative size = 85 \[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {\left (a^2+2 b^2\right ) x}{2 a^3}-\frac {2 b^3 \arctan \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} \]
[Out]
Time = 0.19 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.462, Rules used = {3938, 4189, 4004, 3916, 2738, 211} \[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=-\frac {2 b^3 \arctan \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 {x \left (a^2+2 b^2\right )}{2 a^3}+\frac {\sinh (x) \cosh (x)}{2 a} \]
[In]
[Out]
Rule 211
Rule 2738
Rule 3916
Rule 3938
Rule 4004
Rule 4189
Rubi steps \begin{align*} \text {integral}& = \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 ) \text {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 \arctan \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*}
Time = 0.16 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.92 \[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {2 a^2 x+4 b^2 x+\frac {8 b^3 \arctan \left (\frac {(-a+b) \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}-4 a b \sinh (x)+a^2 \sinh (2 x)}{4 a^3} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. \(152\) vs. \(2(71)=142\).
Time = 0.27 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.80
method | result | size |
default | \(\frac {1}{2 a \left (\tanh \left (\frac {x}{2}\right )-1\right )^{2}}-\frac {-a -2 b}{2 a^{2} \left (\tanh \left (\frac {x}{2}\right )-1\right )}+\frac {\left (-a^{2}-2 b^{2}\right ) \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{2 a^{3}}-\frac {2 b^{3} \arctan \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{3} \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {1}{2 a \left (\tanh \left (\frac {x}{2}\right )+1\right )^{2}}-\frac {-a -2 b}{2 a^{2} \left (\tanh \left (\frac {x}{2}\right )+1\right )}+\frac {\left (a^{2}+2 b^{2}\right ) \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{2 a^{3}}\) | \(153\) |
risch | \(\frac {x}{2 a}+\frac {x \,b^{2}}{a^{3}}+\frac {{\mathrm e}^{2 x}}{8 a}-\frac {b \,{\mathrm e}^{x}}{2 a^{2}}+\frac {b \,{\mathrm e}^{-x}}{2 a^{2}}-\frac {{\mathrm e}^{-2 x}}{8 a}-\frac {b^{3} \ln \left ({\mathrm e}^{x}+\frac {b \sqrt {-a^{2}+b^{2}}+a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, a}\right )}{\sqrt {-a^{2}+b^{2}}\, a^{3}}+\frac {b^{3} \ln \left ({\mathrm e}^{x}+\frac {b \sqrt {-a^{2}+b^{2}}-a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, a}\right )}{\sqrt {-a^{2}+b^{2}}\, a^{3}}\) | \(171\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 390 vs. \(2 (71) = 142\).
Time = 0.28 (sec) , antiderivative size = 860, normalized size of antiderivative = 10.12 \[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=\text {Too large to display} \]
[In]
[Out]
\[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=\int \frac {\cosh ^{2}{\left (x \right )}}{a + b \operatorname {sech}{\left (x \right )}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
none
Time = 0.28 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.08 \[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=-\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}} \]
[In]
[Out]
Time = 2.19 (sec) , antiderivative size = 167, normalized size of antiderivative = 1.96 \[ \int \frac {\cosh ^2(x)}{a+b \text {sech}(x)} \, dx=\frac {{\mathrm {e}}^{2\,x}}{8\,a}-\frac {{\mathrm {e}}^{-2\,x}}{8\,a}-\frac {b\,{\mathrm {e}}^x}{2\,a^2}+\frac {b\,{\mathrm {e}}^{-x}}{2\,a^2}+\frac {x\,\left (a^2+2\,b^2\right )}{2\,a^3}+\frac {b^3\,\ln \left (\frac {2\,b^3\,{\mathrm {e}}^x}{a^4}-\frac {2\,b^3\,\left (a+b\,{\mathrm {e}}^x\right )}{a^4\,\sqrt {a+b}\,\sqrt {b-a}}\right )}{a^3\,\sqrt {a+b}\,\sqrt {b-a}}-\frac {b^3\,\ln \left (\frac {2\,b^3\,{\mathrm {e}}^x}{a^4}+\frac {2\,b^3\,\left (a+b\,{\mathrm {e}}^x\right )}{a^4\,\sqrt {a+b}\,\sqrt {b-a}}\right )}{a^3\,\sqrt {a+b}\,\sqrt {b-a}} \]
[In]
[Out]