\(\int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx\) [28]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [B] (verified)
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [F]
Giac [F(-2)]
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 41 \[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\frac {\arctan (\sinh (x))}{a}-\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b} \sinh (x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b}} \] Output:

arctan(sinh(x))/a-b^(1/2)*arctan(b^(1/2)*sinh(x)/(a+b)^(1/2))/a/(a+b)^(1/2 
)
 

Mathematica [A] (verified)

Time = 0.09 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.10 \[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\frac {\sqrt {b} \arctan \left (\frac {\sqrt {a+b} \text {csch}(x)}{\sqrt {b}}\right )}{a \sqrt {a+b}}+\frac {2 \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{a} \] Input:

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

Output:

(Sqrt[b]*ArcTan[(Sqrt[a + b]*Csch[x])/Sqrt[b]])/(a*Sqrt[a + b]) + (2*ArcTa 
n[Tanh[x/2]])/a
 

Rubi [A] (verified)

Time = 0.24 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.385, Rules used = {3042, 3665, 303, 216, 218}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\sin \left (\frac {\pi }{2}+i x\right ) \left (a+b \sin \left (\frac {\pi }{2}+i x\right )^2\right )}dx\)

\(\Big \downarrow \) 3665

\(\displaystyle \int \frac {1}{\left (\sinh ^2(x)+1\right ) \left (a+b \sinh ^2(x)+b\right )}d\sinh (x)\)

\(\Big \downarrow \) 303

\(\displaystyle \frac {\int \frac {1}{\sinh ^2(x)+1}d\sinh (x)}{a}-\frac {b \int \frac {1}{b \sinh ^2(x)+a+b}d\sinh (x)}{a}\)

\(\Big \downarrow \) 216

\(\displaystyle \frac {\arctan (\sinh (x))}{a}-\frac {b \int \frac {1}{b \sinh ^2(x)+a+b}d\sinh (x)}{a}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {\arctan (\sinh (x))}{a}-\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b} \sinh (x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b}}\)

Input:

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

Output:

ArcTan[Sinh[x]]/a - (Sqrt[b]*ArcTan[(Sqrt[b]*Sinh[x])/Sqrt[a + b]])/(a*Sqr 
t[a + b])
 

Defintions of rubi rules used

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

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

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

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3665
Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^ 
(p_.), x_Symbol] :> With[{ff = FreeFactors[Cos[e + f*x], x]}, Simp[-ff/f 
Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p, x], x, Cos[e + 
 f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(84\) vs. \(2(33)=66\).

Time = 0.70 (sec) , antiderivative size = 85, normalized size of antiderivative = 2.07

method result size
default \(-\frac {2 b \left (\frac {\arctan \left (\frac {2 \sqrt {a +b}\, \tanh \left (\frac {x}{2}\right )+2 \sqrt {a}}{2 \sqrt {b}}\right )}{2 \sqrt {a +b}\, \sqrt {b}}+\frac {\arctan \left (\frac {2 \sqrt {a +b}\, \tanh \left (\frac {x}{2}\right )-2 \sqrt {a}}{2 \sqrt {b}}\right )}{2 \sqrt {a +b}\, \sqrt {b}}\right )}{a}+\frac {2 \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{a}\) \(85\)
risch \(\frac {i \ln \left ({\mathrm e}^{x}+i\right )}{a}-\frac {i \ln \left ({\mathrm e}^{x}-i\right )}{a}+\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 x}-\frac {2 \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{x}}{b}-1\right )}{2 \left (a +b \right ) a}-\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 x}+\frac {2 \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{x}}{b}-1\right )}{2 \left (a +b \right ) a}\) \(106\)

Input:

int(sech(x)/(a+b*cosh(x)^2),x,method=_RETURNVERBOSE)
 

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 115 vs. \(2 (33) = 66\).

Time = 0.12 (sec) , antiderivative size = 360, normalized size of antiderivative = 8.78 \[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\left [\frac {\sqrt {-\frac {b}{a + b}} \log \left (\frac {b \cosh \left (x\right )^{4} + 4 \, b \cosh \left (x\right ) \sinh \left (x\right )^{3} + b \sinh \left (x\right )^{4} - 2 \, {\left (2 \, a + 3 \, b\right )} \cosh \left (x\right )^{2} + 2 \, {\left (3 \, b \cosh \left (x\right )^{2} - 2 \, a - 3 \, b\right )} \sinh \left (x\right )^{2} + 4 \, {\left (b \cosh \left (x\right )^{3} - {\left (2 \, a + 3 \, b\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) - 4 \, {\left ({\left (a + b\right )} \cosh \left (x\right )^{3} + 3 \, {\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right )^{2} + {\left (a + b\right )} \sinh \left (x\right )^{3} - {\left (a + b\right )} \cosh \left (x\right ) + {\left (3 \, {\left (a + b\right )} \cosh \left (x\right )^{2} - a - b\right )} \sinh \left (x\right )\right )} \sqrt {-\frac {b}{a + b}} + b}{b \cosh \left (x\right )^{4} + 4 \, b \cosh \left (x\right ) \sinh \left (x\right )^{3} + b \sinh \left (x\right )^{4} + 2 \, {\left (2 \, a + b\right )} \cosh \left (x\right )^{2} + 2 \, {\left (3 \, b \cosh \left (x\right )^{2} + 2 \, a + b\right )} \sinh \left (x\right )^{2} + 4 \, {\left (b \cosh \left (x\right )^{3} + {\left (2 \, a + b\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) + b}\right ) + 4 \, \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )}{2 \, a}, -\frac {\sqrt {\frac {b}{a + b}} \arctan \left (\frac {1}{2} \, \sqrt {\frac {b}{a + b}} {\left (\cosh \left (x\right ) + \sinh \left (x\right )\right )}\right ) + \sqrt {\frac {b}{a + b}} \arctan \left (\frac {{\left (b \cosh \left (x\right )^{3} + 3 \, b \cosh \left (x\right ) \sinh \left (x\right )^{2} + b \sinh \left (x\right )^{3} + {\left (4 \, a + 3 \, b\right )} \cosh \left (x\right ) + {\left (3 \, b \cosh \left (x\right )^{2} + 4 \, a + 3 \, b\right )} \sinh \left (x\right )\right )} \sqrt {\frac {b}{a + b}}}{2 \, b}\right ) - 2 \, \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )}{a}\right ] \] Input:

integrate(sech(x)/(a+b*cosh(x)^2),x, algorithm="fricas")
 

Output:

[1/2*(sqrt(-b/(a + b))*log((b*cosh(x)^4 + 4*b*cosh(x)*sinh(x)^3 + b*sinh(x 
)^4 - 2*(2*a + 3*b)*cosh(x)^2 + 2*(3*b*cosh(x)^2 - 2*a - 3*b)*sinh(x)^2 + 
4*(b*cosh(x)^3 - (2*a + 3*b)*cosh(x))*sinh(x) - 4*((a + b)*cosh(x)^3 + 3*( 
a + b)*cosh(x)*sinh(x)^2 + (a + b)*sinh(x)^3 - (a + b)*cosh(x) + (3*(a + b 
)*cosh(x)^2 - a - b)*sinh(x))*sqrt(-b/(a + b)) + b)/(b*cosh(x)^4 + 4*b*cos 
h(x)*sinh(x)^3 + b*sinh(x)^4 + 2*(2*a + b)*cosh(x)^2 + 2*(3*b*cosh(x)^2 + 
2*a + b)*sinh(x)^2 + 4*(b*cosh(x)^3 + (2*a + b)*cosh(x))*sinh(x) + b)) + 4 
*arctan(cosh(x) + sinh(x)))/a, -(sqrt(b/(a + b))*arctan(1/2*sqrt(b/(a + b) 
)*(cosh(x) + sinh(x))) + sqrt(b/(a + b))*arctan(1/2*(b*cosh(x)^3 + 3*b*cos 
h(x)*sinh(x)^2 + b*sinh(x)^3 + (4*a + 3*b)*cosh(x) + (3*b*cosh(x)^2 + 4*a 
+ 3*b)*sinh(x))*sqrt(b/(a + b))/b) - 2*arctan(cosh(x) + sinh(x)))/a]
 

Sympy [F]

\[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\int \frac {\operatorname {sech}{\left (x \right )}}{a + b \cosh ^{2}{\left (x \right )}}\, dx \] Input:

integrate(sech(x)/(a+b*cosh(x)**2),x)
 

Output:

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

Maxima [F]

\[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\int { \frac {\operatorname {sech}\left (x\right )}{b \cosh \left (x\right )^{2} + a} \,d x } \] Input:

integrate(sech(x)/(a+b*cosh(x)^2),x, algorithm="maxima")
 

Output:

2*arctan(e^x)/a - 2*integrate((b*e^(3*x) + b*e^x)/(a*b*e^(4*x) + a*b + 2*( 
2*a^2 + a*b)*e^(2*x)), x)
 

Giac [F(-2)]

Exception generated. \[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\text {Exception raised: TypeError} \] Input:

integrate(sech(x)/(a+b*cosh(x)^2),x, algorithm="giac")
 

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Limit: Max order reached or unable 
to make series expansion Error: Bad Argument Value
 

Mupad [B] (verification not implemented)

Time = 2.73 (sec) , antiderivative size = 208, normalized size of antiderivative = 5.07 \[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\frac {2\,\mathrm {atan}\left (\frac {{\mathrm {e}}^x\,\left (16\,{\left (a^2\right )}^{3/2}+9\,b^2\,\sqrt {a^2}+24\,a\,b\,\sqrt {a^2}\right )}{16\,a^3+24\,a^2\,b+9\,a\,b^2}\right )}{\sqrt {a^2}}-\frac {\sqrt {b}\,\left (2\,\mathrm {atan}\left (\frac {\sqrt {b}\,{\mathrm {e}}^x\,\sqrt {a^2\,\left (a+b\right )}}{2\,a\,\left (a+b\right )}\right )+2\,\mathrm {atan}\left (\frac {4\,a^4\,{\mathrm {e}}^x+8\,a^3\,b\,{\mathrm {e}}^x+4\,a^2\,b^2\,{\mathrm {e}}^x-b\,{\mathrm {e}}^x\,\sqrt {a^2\,\left (a+b\right )}\,\sqrt {a^3+b\,a^2}+b\,{\mathrm {e}}^{3\,x}\,\sqrt {a^2\,\left (a+b\right )}\,\sqrt {a^3+b\,a^2}}{\sqrt {b}\,\sqrt {a^2\,\left (a+b\right )}\,\left (2\,a^2+2\,b\,a\right )}\right )\right )}{2\,\sqrt {a^3+b\,a^2}} \] Input:

int(1/(cosh(x)*(a + b*cosh(x)^2)),x)
 

Output:

(2*atan((exp(x)*(16*(a^2)^(3/2) + 9*b^2*(a^2)^(1/2) + 24*a*b*(a^2)^(1/2))) 
/(9*a*b^2 + 24*a^2*b + 16*a^3)))/(a^2)^(1/2) - (b^(1/2)*(2*atan((b^(1/2)*e 
xp(x)*(a^2*(a + b))^(1/2))/(2*a*(a + b))) + 2*atan((4*a^4*exp(x) + 8*a^3*b 
*exp(x) + 4*a^2*b^2*exp(x) - b*exp(x)*(a^2*(a + b))^(1/2)*(a^2*b + a^3)^(1 
/2) + b*exp(3*x)*(a^2*(a + b))^(1/2)*(a^2*b + a^3)^(1/2))/(b^(1/2)*(a^2*(a 
 + b))^(1/2)*(2*a*b + 2*a^2)))))/(2*(a^2*b + a^3)^(1/2))
 

Reduce [B] (verification not implemented)

Time = 0.23 (sec) , antiderivative size = 454, normalized size of antiderivative = 11.07 \[ \int \frac {\text {sech}(x)}{a+b \cosh ^2(x)} \, dx=\frac {4 \mathit {atan} \left (e^{x}\right ) a b +4 \mathit {atan} \left (e^{x}\right ) b^{2}+2 \sqrt {b}\, \sqrt {a}\, \sqrt {a +b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}+2 a +b}\, \mathit {atan} \left (\frac {e^{x} b}{\sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}+2 a +b}}\right )-2 \sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}+2 a +b}\, \mathit {atan} \left (\frac {e^{x} b}{\sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}+2 a +b}}\right ) a -2 \sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}+2 a +b}\, \mathit {atan} \left (\frac {e^{x} b}{\sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}+2 a +b}}\right ) b +\sqrt {b}\, \sqrt {a}\, \sqrt {a +b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}\, \mathrm {log}\left (-\sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}+e^{x} \sqrt {b}\right )-\sqrt {b}\, \sqrt {a}\, \sqrt {a +b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}\, \mathrm {log}\left (\sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}+e^{x} \sqrt {b}\right )+\sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}\, \mathrm {log}\left (-\sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}+e^{x} \sqrt {b}\right ) a +\sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}\, \mathrm {log}\left (-\sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}+e^{x} \sqrt {b}\right ) b -\sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}\, \mathrm {log}\left (\sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}+e^{x} \sqrt {b}\right ) a -\sqrt {b}\, \sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}\, \mathrm {log}\left (\sqrt {2 \sqrt {a}\, \sqrt {a +b}-2 a -b}+e^{x} \sqrt {b}\right ) b}{2 a b \left (a +b \right )} \] Input:

int(sech(x)/(a+b*cosh(x)^2),x)
 

Output:

(4*atan(e**x)*a*b + 4*atan(e**x)*b**2 + 2*sqrt(b)*sqrt(a)*sqrt(a + b)*sqrt 
(2*sqrt(a)*sqrt(a + b) + 2*a + b)*atan((e**x*b)/(sqrt(b)*sqrt(2*sqrt(a)*sq 
rt(a + b) + 2*a + b))) - 2*sqrt(b)*sqrt(2*sqrt(a)*sqrt(a + b) + 2*a + b)*a 
tan((e**x*b)/(sqrt(b)*sqrt(2*sqrt(a)*sqrt(a + b) + 2*a + b)))*a - 2*sqrt(b 
)*sqrt(2*sqrt(a)*sqrt(a + b) + 2*a + b)*atan((e**x*b)/(sqrt(b)*sqrt(2*sqrt 
(a)*sqrt(a + b) + 2*a + b)))*b + sqrt(b)*sqrt(a)*sqrt(a + b)*sqrt(2*sqrt(a 
)*sqrt(a + b) - 2*a - b)*log( - sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b) + e* 
*x*sqrt(b)) - sqrt(b)*sqrt(a)*sqrt(a + b)*sqrt(2*sqrt(a)*sqrt(a + b) - 2*a 
 - b)*log(sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b) + e**x*sqrt(b)) + sqrt(b)* 
sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b)*log( - sqrt(2*sqrt(a)*sqrt(a + b) - 
2*a - b) + e**x*sqrt(b))*a + sqrt(b)*sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b) 
*log( - sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b) + e**x*sqrt(b))*b - sqrt(b)* 
sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b)*log(sqrt(2*sqrt(a)*sqrt(a + b) - 2*a 
 - b) + e**x*sqrt(b))*a - sqrt(b)*sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b)*lo 
g(sqrt(2*sqrt(a)*sqrt(a + b) - 2*a - b) + e**x*sqrt(b))*b)/(2*a*b*(a + b))