### 3.780 $$\int \frac{1}{a+c \text{sech}(x)+b \tanh (x)} \, dx$$

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]

(a*x)/(a^2 - b^2) - (2*a*c*ArcTan[(b + (a - c)*Tanh[x/2])/Sqrt[a^2 - b^2 - c^2]])/((a^2 - b^2)*Sqrt[a^2 - b^2
- c^2]) - (b*Log[c + a*Cosh[x] + b*Sinh[x]])/(a^2 - b^2)

________________________________________________________________________________________

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 veriﬁed.

[In]

Int[(a + c*Sech[x] + b*Tanh[x])^(-1),x]

[Out]

(a*x)/(a^2 - b^2) - (2*a*c*ArcTan[(b + (a - c)*Tanh[x/2])/Sqrt[a^2 - b^2 - c^2]])/((a^2 - b^2)*Sqrt[a^2 - b^2
- c^2]) - (b*Log[c + a*Cosh[x] + b*Sinh[x]])/(a^2 - b^2)

Rule 3159

Int[((a_.) + (b_.)*sec[(d_.) + (e_.)*(x_)] + (c_.)*tan[(d_.) + (e_.)*(x_)])^(-1), x_Symbol] :> Int[Cos[d + e*x
]/(b + a*Cos[d + e*x] + c*Sin[d + e*x]), x] /; FreeQ[{a, b, c, d, e}, x]

Rule 3138

Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.))/((a_.) + cos[(d_.) + (e_.)*(x_)]*(b_.) + (c_.)*sin[(d_.) + (e_.)*(
x_)]), x_Symbol] :> Simp[(b*B*(d + e*x))/(e*(b^2 + c^2)), x] + (Dist[(A*(b^2 + c^2) - a*b*B)/(b^2 + c^2), Int[
1/(a + b*Cos[d + e*x] + c*Sin[d + e*x]), x], x] + Simp[(c*B*Log[a + b*Cos[d + e*x] + c*Sin[d + e*x]])/(e*(b^2
+ c^2)), x]) /; FreeQ[{a, b, c, d, e, A, B}, x] && NeQ[b^2 + c^2, 0] && NeQ[A*(b^2 + c^2) - a*b*B, 0]

Rule 3124

Int[(cos[(d_.) + (e_.)*(x_)]*(b_.) + (a_) + (c_.)*sin[(d_.) + (e_.)*(x_)])^(-1), x_Symbol] :> Module[{f = Free
Factors[Tan[(d + e*x)/2], x]}, Dist[(2*f)/e, Subst[Int[1/(a + b + 2*c*f*x + (a - b)*f^2*x^2), x], x, Tan[(d +
e*x)/2]/f], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[a^2 - b^2 - c^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

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 veriﬁed.

[In]

Integrate[(a + c*Sech[x] + b*Tanh[x])^(-1),x]

[Out]

(a*x - (2*a*c*ArcTan[(b + (a - c)*Tanh[x/2])/Sqrt[a^2 - b^2 - c^2]])/Sqrt[a^2 - b^2 - c^2] - b*Log[c + a*Cosh[
x] + b*Sinh[x]])/(a^2 - b^2)

________________________________________________________________________________________

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*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a+c*sech(x)+b*tanh(x)),x)

[Out]

2/(2*a-2*b)*ln(tanh(1/2*x)+1)-2/(2*b+2*a)*ln(tanh(1/2*x)-1)-1/(a+b)/(a-b)/(a-c)*ln(a*tanh(1/2*x)^2-tanh(1/2*x)
^2*c+2*tanh(1/2*x)*b+a+c)*a*b+1/(a+b)/(a-b)/(a-c)*ln(a*tanh(1/2*x)^2-tanh(1/2*x)^2*c+2*tanh(1/2*x)*b+a+c)*c*b-
2/(a+b)/(a-b)/(a^2-b^2-c^2)^(1/2)*arctan(1/2*(2*(a-c)*tanh(1/2*x)+2*b)/(a^2-b^2-c^2)^(1/2))*a*c-2/(a+b)/(a-b)/
(a^2-b^2-c^2)^(1/2)*arctan(1/2*(2*(a-c)*tanh(1/2*x)+2*b)/(a^2-b^2-c^2)^(1/2))*b^2+2/(a+b)/(a-b)/(a^2-b^2-c^2)^
(1/2)*arctan(1/2*(2*(a-c)*tanh(1/2*x)+2*b)/(a^2-b^2-c^2)^(1/2))*b^2/(a-c)*a-2/(a+b)/(a-b)/(a^2-b^2-c^2)^(1/2)*
arctan(1/2*(2*(a-c)*tanh(1/2*x)+2*b)/(a^2-b^2-c^2)^(1/2))*b^2/(a-c)*c

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+c*sech(x)+b*tanh(x)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

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*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+c*sech(x)+b*tanh(x)),x, algorithm="fricas")

[Out]

[(sqrt(-a^2 + b^2 + c^2)*a*c*log((2*(a + b)*c*cosh(x) + (a^2 + 2*a*b + b^2)*cosh(x)^2 + (a^2 + 2*a*b + b^2)*si
nh(x)^2 - a^2 + b^2 + 2*c^2 + 2*((a + b)*c + (a^2 + 2*a*b + b^2)*cosh(x))*sinh(x) - 2*sqrt(-a^2 + b^2 + c^2)*(
(a + b)*cosh(x) + (a + b)*sinh(x) + c))/((a + b)*cosh(x)^2 + (a + b)*sinh(x)^2 + 2*c*cosh(x) + 2*((a + b)*cosh
(x) + c)*sinh(x) + a - b)) + (a^3 + a^2*b - a*b^2 - b^3 - (a + b)*c^2)*x - (a^2*b - b^3 - b*c^2)*log(2*(a*cosh
(x) + b*sinh(x) + c)/(cosh(x) - sinh(x))))/(a^4 - 2*a^2*b^2 + b^4 - (a^2 - b^2)*c^2), (2*sqrt(a^2 - b^2 - c^2)
*a*c*arctan(-((a + b)*cosh(x) + (a + b)*sinh(x) + c)/sqrt(a^2 - b^2 - c^2)) + (a^3 + a^2*b - a*b^2 - b^3 - (a
+ b)*c^2)*x - (a^2*b - b^3 - b*c^2)*log(2*(a*cosh(x) + b*sinh(x) + c)/(cosh(x) - sinh(x))))/(a^4 - 2*a^2*b^2 +
b^4 - (a^2 - b^2)*c^2)]

________________________________________________________________________________________

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*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+c*sech(x)+b*tanh(x)),x)

[Out]

Integral(1/(a + b*tanh(x) + c*sech(x)), x)

________________________________________________________________________________________

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*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+c*sech(x)+b*tanh(x)),x, algorithm="giac")

[Out]

-2*a*c*arctan((a*e^x + b*e^x + c)/sqrt(a^2 - b^2 - c^2))/(sqrt(a^2 - b^2 - c^2)*(a^2 - b^2)) - b*log(a*e^(2*x)
+ b*e^(2*x) + 2*c*e^x + a - b)/(a^2 - b^2) + x/(a - b)