Optimal. Leaf size=107 \[ -\frac{2 a c \tan ^{-1}\left (\frac{(a-c) \tanh \left (\frac{x}{2}\right )+b}{\sqrt{a^2-b^2-c^2}}\right )}{\left (a^2-b^2\right ) \sqrt{a^2-b^2-c^2}}-\frac{b \log (a \cosh (x)+b \sinh (x)+c)}{a^2-b^2}+\frac{a x}{a^2-b^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.136864, antiderivative size = 107, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 12, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.417, Rules used = {3159, 3138, 3124, 618, 204} \[ -\frac{2 a c \tan ^{-1}\left (\frac{(a-c) \tanh \left (\frac{x}{2}\right )+b}{\sqrt{a^2-b^2-c^2}}\right )}{\left (a^2-b^2\right ) \sqrt{a^2-b^2-c^2}}-\frac{b \log (a \cosh (x)+b \sinh (x)+c)}{a^2-b^2}+\frac{a x}{a^2-b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3159
Rule 3138
Rule 3124
Rule 618
Rule 204
Rubi steps
\begin{align*} \int \frac{1}{a+c \text{sech}(x)+b \tanh (x)} \, dx &=\int \frac{\cosh (x)}{c+a \cosh (x)+b \sinh (x)} \, dx\\ &=\frac{a x}{a^2-b^2}-\frac{b \log (c+a \cosh (x)+b \sinh (x))}{a^2-b^2}-\frac{(a c) \int \frac{1}{c+a \cosh (x)+b \sinh (x)} \, dx}{a^2-b^2}\\ &=\frac{a x}{a^2-b^2}-\frac{b \log (c+a \cosh (x)+b \sinh (x))}{a^2-b^2}-\frac{(2 a c) \operatorname{Subst}\left (\int \frac{1}{a+c+2 b x-(-a+c) x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{a^2-b^2}\\ &=\frac{a x}{a^2-b^2}-\frac{b \log (c+a \cosh (x)+b \sinh (x))}{a^2-b^2}+\frac{(4 a c) \operatorname{Subst}\left (\int \frac{1}{-4 \left (a^2-b^2-c^2\right )-x^2} \, dx,x,2 b+2 (a-c) \tanh \left (\frac{x}{2}\right )\right )}{a^2-b^2}\\ &=\frac{a x}{a^2-b^2}-\frac{2 a c \tan ^{-1}\left (\frac{b+(a-c) \tanh \left (\frac{x}{2}\right )}{\sqrt{a^2-b^2-c^2}}\right )}{\left (a^2-b^2\right ) \sqrt{a^2-b^2-c^2}}-\frac{b \log (c+a \cosh (x)+b \sinh (x))}{a^2-b^2}\\ \end{align*}
Mathematica [A] time = 0.178435, size = 86, normalized size = 0.8 \[ \frac{-\frac{2 a c \tan ^{-1}\left (\frac{(a-c) \tanh \left (\frac{x}{2}\right )+b}{\sqrt{a^2-b^2-c^2}}\right )}{\sqrt{a^2-b^2-c^2}}-b \log (a \cosh (x)+b \sinh (x)+c)+a x}{a^2-b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.062, size = 422, normalized size = 3.9 \begin{align*} 2\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) +1 \right ) }{2\,a-2\,b}}-2\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) -1 \right ) }{2\,b+2\,a}}-{\frac{ab}{ \left ( a+b \right ) \left ( a-b \right ) \left ( a-c \right ) }\ln \left ( a \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}- \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}c+2\,\tanh \left ( x/2 \right ) b+a+c \right ) }+{\frac{cb}{ \left ( a+b \right ) \left ( a-b \right ) \left ( a-c \right ) }\ln \left ( a \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}- \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}c+2\,\tanh \left ( x/2 \right ) b+a+c \right ) }-2\,{\frac{ac}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}\arctan \left ( 1/2\,{\frac{2\, \left ( a-c \right ) \tanh \left ( x/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}} \right ) }-2\,{\frac{{b}^{2}}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}\arctan \left ( 1/2\,{\frac{2\, \left ( a-c \right ) \tanh \left ( x/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}} \right ) }+2\,{\frac{a{b}^{2}}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{{a}^{2}-{b}^{2}-{c}^{2}} \left ( a-c \right ) }\arctan \left ( 1/2\,{\frac{2\, \left ( a-c \right ) \tanh \left ( x/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}} \right ) }-2\,{\frac{c{b}^{2}}{ \left ( a+b \right ) \left ( a-b \right ) \sqrt{{a}^{2}-{b}^{2}-{c}^{2}} \left ( a-c \right ) }\arctan \left ( 1/2\,{\frac{2\, \left ( a-c \right ) \tanh \left ( x/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}-{c}^{2}}}} \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 [A] time = 2.57903, size = 1077, normalized size = 10.07 \begin{align*} \left [\frac{\sqrt{-a^{2} + b^{2} + c^{2}} a c \log \left (\frac{2 \,{\left (a + b\right )} c \cosh \left (x\right ) +{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{2} +{\left (a^{2} + 2 \, a b + b^{2}\right )} \sinh \left (x\right )^{2} - a^{2} + b^{2} + 2 \, c^{2} + 2 \,{\left ({\left (a + b\right )} c +{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) - 2 \, \sqrt{-a^{2} + b^{2} + c^{2}}{\left ({\left (a + b\right )} \cosh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right ) + c\right )}}{{\left (a + b\right )} \cosh \left (x\right )^{2} +{\left (a + b\right )} \sinh \left (x\right )^{2} + 2 \, c \cosh \left (x\right ) + 2 \,{\left ({\left (a + b\right )} \cosh \left (x\right ) + c\right )} \sinh \left (x\right ) + a - b}\right ) +{\left (a^{3} + a^{2} b - a b^{2} - b^{3} -{\left (a + b\right )} c^{2}\right )} x -{\left (a^{2} b - b^{3} - b c^{2}\right )} \log \left (\frac{2 \,{\left (a \cosh \left (x\right ) + b \sinh \left (x\right ) + c\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4} -{\left (a^{2} - b^{2}\right )} c^{2}}, \frac{2 \, \sqrt{a^{2} - b^{2} - c^{2}} a c \arctan \left (-\frac{{\left (a + b\right )} \cosh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right ) + c}{\sqrt{a^{2} - b^{2} - c^{2}}}\right ) +{\left (a^{3} + a^{2} b - a b^{2} - b^{3} -{\left (a + b\right )} c^{2}\right )} x -{\left (a^{2} b - b^{3} - b c^{2}\right )} \log \left (\frac{2 \,{\left (a \cosh \left (x\right ) + b \sinh \left (x\right ) + c\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4} -{\left (a^{2} - b^{2}\right )} c^{2}}\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 \frac{1}{a + b \tanh{\left (x \right )} + c \operatorname{sech}{\left (x \right )}}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.18451, size = 143, normalized size = 1.34 \begin{align*} -\frac{2 \, a c \arctan \left (\frac{a e^{x} + b e^{x} + c}{\sqrt{a^{2} - b^{2} - c^{2}}}\right )}{\sqrt{a^{2} - b^{2} - c^{2}}{\left (a^{2} - b^{2}\right )}} - \frac{b \log \left (a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + 2 \, c e^{x} + a - b\right )}{a^{2} - b^{2}} + \frac{x}{a - b} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]