### 3.785 $$\int \frac{\text{sech}^2(x)}{a+c \text{sech}(x)+b \tanh (x)} \, dx$$

Optimal. Leaf size=146 $-\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 (b^2+c^2\right ) \sqrt{a^2-b^2-c^2}}+\frac{b \log \left ((a-c) \tanh ^2\left (\frac{x}{2}\right )+a+2 b \tanh \left (\frac{x}{2}\right )+c\right )}{b^2+c^2}-\frac{b \log \left (\tanh ^2\left (\frac{x}{2}\right )+1\right )}{b^2+c^2}+\frac{2 c \tan ^{-1}\left (\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^2}$

[Out]

(2*c*ArcTan[Tanh[x/2]])/(b^2 + c^2) - (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^2 + c^2)) - (b*Log[1 + Tanh[x/2]^2])/(b^2 + c^2) + (b*Log[a + c + 2*b*Tanh[x/2] + (a - c)*Tanh
[x/2]^2])/(b^2 + c^2)

________________________________________________________________________________________

Rubi [A]  time = 0.481288, antiderivative size = 146, normalized size of antiderivative = 1., number of steps used = 10, number of rules used = 9, integrand size = 17, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.529, Rules used = {4397, 1075, 634, 618, 204, 628, 635, 203, 260} $-\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 (b^2+c^2\right ) \sqrt{a^2-b^2-c^2}}+\frac{b \log \left ((a-c) \tanh ^2\left (\frac{x}{2}\right )+a+2 b \tanh \left (\frac{x}{2}\right )+c\right )}{b^2+c^2}-\frac{b \log \left (\tanh ^2\left (\frac{x}{2}\right )+1\right )}{b^2+c^2}+\frac{2 c \tan ^{-1}\left (\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^2}$

Antiderivative was successfully veriﬁed.

[In]

Int[Sech[x]^2/(a + c*Sech[x] + b*Tanh[x]),x]

[Out]

(2*c*ArcTan[Tanh[x/2]])/(b^2 + c^2) - (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^2 + c^2)) - (b*Log[1 + Tanh[x/2]^2])/(b^2 + c^2) + (b*Log[a + c + 2*b*Tanh[x/2] + (a - c)*Tanh
[x/2]^2])/(b^2 + c^2)

Rule 4397

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rule 1075

Int[((A_.) + (C_.)*(x_)^2)/(((a_) + (b_.)*(x_) + (c_.)*(x_)^2)*((d_) + (f_.)*(x_)^2)), x_Symbol] :> With[{q =
c^2*d^2 + b^2*d*f - 2*a*c*d*f + a^2*f^2}, Dist[1/q, Int[(A*c^2*d - a*c*C*d + A*b^2*f - a*A*c*f + a^2*C*f + c*(
-(b*C*d) + A*b*f)*x)/(a + b*x + c*x^2), x], x] + Dist[1/q, Int[(c*C*d^2 - A*c*d*f - a*C*d*f + a*A*f^2 - f*(-(b
*C*d) + A*b*f)*x)/(d + f*x^2), x], x] /; NeQ[q, 0]] /; FreeQ[{a, b, c, d, f, A, C}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 634

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

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])

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 203

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

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rubi steps

\begin{align*} \int \frac{\text{sech}^2(x)}{a+c \text{sech}(x)+b \tanh (x)} \, dx &=\int \frac{\text{sech}(x)}{c+a \cosh (x)+b \sinh (x)} \, dx\\ &=2 \operatorname{Subst}\left (\int \frac{1-x^2}{\left (1+x^2\right ) \left (a+c+2 b x+(a-c) x^2\right )} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )\\ &=\frac{\operatorname{Subst}\left (\int \frac{4 c-4 b x}{1+x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{2 \left (b^2+c^2\right )}+\frac{\operatorname{Subst}\left (\int \frac{4 b^2+(a-c)^2-(a+c)^2+4 b (a-c) x}{a+c+2 b x+(a-c) x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{2 \left (b^2+c^2\right )}\\ &=\frac{b \operatorname{Subst}\left (\int \frac{2 b+2 (a-c) x}{a+c+2 b x+(a-c) x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^2}-\frac{(2 b) \operatorname{Subst}\left (\int \frac{x}{1+x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^2}+\frac{(2 c) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^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 )}{b^2+c^2}\\ &=\frac{2 c \tan ^{-1}\left (\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^2}-\frac{b \log \left (1+\tanh ^2\left (\frac{x}{2}\right )\right )}{b^2+c^2}+\frac{b \log \left (a+c+2 b \tanh \left (\frac{x}{2}\right )+(a-c) \tanh ^2\left (\frac{x}{2}\right )\right )}{b^2+c^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 )}{b^2+c^2}\\ &=\frac{2 c \tan ^{-1}\left (\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^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 )}{\sqrt{a^2-b^2-c^2} \left (b^2+c^2\right )}-\frac{b \log \left (1+\tanh ^2\left (\frac{x}{2}\right )\right )}{b^2+c^2}+\frac{b \log \left (a+c+2 b \tanh \left (\frac{x}{2}\right )+(a-c) \tanh ^2\left (\frac{x}{2}\right )\right )}{b^2+c^2}\\ \end{align*}

Mathematica [A]  time = 0.235881, size = 96, normalized size = 0.66 $\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)-\log (\cosh (x)))+2 c \tan ^{-1}\left (\tanh \left (\frac{x}{2}\right )\right )}{b^2+c^2}$

Antiderivative was successfully veriﬁed.

[In]

Integrate[Sech[x]^2/(a + c*Sech[x] + b*Tanh[x]),x]

[Out]

(2*c*ArcTan[Tanh[x/2]] - (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[Cosh[x]] + Log[c + a*Cosh[x] + b*Sinh[x]]))/(b^2 + c^2)

________________________________________________________________________________________

Maple [B]  time = 0.049, size = 406, normalized size = 2.8 \begin{align*} -{\frac{b}{{b}^{2}+{c}^{2}}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}+1 \right ) }+2\,{\frac{c\arctan \left ( \tanh \left ( x/2 \right ) \right ) }{{b}^{2}+{c}^{2}}}+{\frac{ab}{ \left ({b}^{2}+{c}^{2} \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 ({b}^{2}+{c}^{2} \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 ({b}^{2}+{c}^{2} \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 ({b}^{2}+{c}^{2} \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 ({b}^{2}+{c}^{2} \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 ({b}^{2}+{c}^{2} \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(sech(x)^2/(a+c*sech(x)+b*tanh(x)),x)

[Out]

-b*ln(tanh(1/2*x)^2+1)/(b^2+c^2)+2*c*arctan(tanh(1/2*x))/(b^2+c^2)+1/(b^2+c^2)/(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/(b^2+c^2)/(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/(b^2+c^2)/(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/(b^2+c^2)/(
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/(b^2+c^2)/(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/(b^2+c^2)/(a^2-b^2-c^2)^(1/2)*arcta
n(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(sech(x)^2/(a+c*sech(x)+b*tanh(x)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 14.2307, size = 1254, normalized size = 8.59 \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 ) + 2 \,{\left (c^{3} -{\left (a^{2} - b^{2}\right )} c\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) -{\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 ) +{\left (a^{2} b - b^{3} - b c^{2}\right )} \log \left (\frac{2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{2} b^{2} - b^{4} - c^{4} +{\left (a^{2} - 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 ) - 2 \,{\left (c^{3} -{\left (a^{2} - b^{2}\right )} c\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right ) +{\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 ) -{\left (a^{2} b - b^{3} - b c^{2}\right )} \log \left (\frac{2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right )}{a^{2} b^{2} - b^{4} - c^{4} +{\left (a^{2} - 2 \, b^{2}\right )} c^{2}}\right ] \end{align*}

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

[In]

integrate(sech(x)^2/(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)*s
inh(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)*cos
h(x) + c)*sinh(x) + a - b)) + 2*(c^3 - (a^2 - b^2)*c)*arctan(cosh(x) + sinh(x)) - (a^2*b - b^3 - b*c^2)*log(2*
(a*cosh(x) + b*sinh(x) + c)/(cosh(x) - sinh(x))) + (a^2*b - b^3 - b*c^2)*log(2*cosh(x)/(cosh(x) - sinh(x))))/(
a^2*b^2 - b^4 - c^4 + (a^2 - 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)) - 2*(c^3 - (a^2 - b^2)*c)*arctan(cosh(x) + sinh(x)) + (a^2*b - b^3 - b*c^2)*lo
g(2*(a*cosh(x) + b*sinh(x) + c)/(cosh(x) - sinh(x))) - (a^2*b - b^3 - b*c^2)*log(2*cosh(x)/(cosh(x) - sinh(x))
))/(a^2*b^2 - b^4 - c^4 + (a^2 - 2*b^2)*c^2)]

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\operatorname{sech}^{2}{\left (x \right )}}{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(sech(x)**2/(a+c*sech(x)+b*tanh(x)),x)

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.14126, size = 170, normalized size = 1.16 \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 (b^{2} + c^{2}\right )}} + \frac{2 \, c \arctan \left (e^{x}\right )}{b^{2} + c^{2}} + \frac{b \log \left (a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + 2 \, c e^{x} + a - b\right )}{b^{2} + c^{2}} - \frac{b \log \left (e^{\left (2 \, x\right )} + 1\right )}{b^{2} + c^{2}} \end{align*}

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

[In]

integrate(sech(x)^2/(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)*(b^2 + c^2)) + 2*c*arctan(e^x)
/(b^2 + c^2) + b*log(a*e^(2*x) + b*e^(2*x) + 2*c*e^x + a - b)/(b^2 + c^2) - b*log(e^(2*x) + 1)/(b^2 + c^2)