3.204 \(\int \frac {A+B \text {sech}(x)}{a+b \cosh (x)} \, dx\)

Optimal. Leaf size=62 \[ \frac {2 (a A-b B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b}}+\frac {B \tan ^{-1}(\sinh (x))}{a} \]

[Out]

B*arctan(sinh(x))/a+2*(A*a-B*b)*arctanh((a-b)^(1/2)*tanh(1/2*x)/(a+b)^(1/2))/a/(a-b)^(1/2)/(a+b)^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.13, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2828, 3001, 3770, 2659, 208} \[ \frac {2 (a A-b B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b}}+\frac {B \tan ^{-1}(\sinh (x))}{a} \]

Antiderivative was successfully verified.

[In]

Int[(A + B*Sech[x])/(a + b*Cosh[x]),x]

[Out]

(B*ArcTan[Sinh[x]])/a + (2*(a*A - b*B)*ArcTanh[(Sqrt[a - b]*Tanh[x/2])/Sqrt[a + b]])/(a*Sqrt[a - b]*Sqrt[a + b
])

Rule 208

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

Rule 2659

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

Rule 2828

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> In
t[((a + b*Sin[e + f*x])^m*(d + c*Sin[e + f*x])^n)/Sin[e + f*x]^n, x] /; FreeQ[{a, b, c, d, e, f, m}, x] && Int
egerQ[n]

Rule 3001

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

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \frac {A+B \text {sech}(x)}{a+b \cosh (x)} \, dx &=\int \frac {(B+A \cosh (x)) \text {sech}(x)}{a+b \cosh (x)} \, dx\\ &=\frac {B \int \text {sech}(x) \, dx}{a}+\frac {(a A-b B) \int \frac {1}{a+b \cosh (x)} \, dx}{a}\\ &=\frac {B \tan ^{-1}(\sinh (x))}{a}+\frac {(2 (a A-b B)) \operatorname {Subst}\left (\int \frac {1}{a+b-(a-b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{a}\\ &=\frac {B \tan ^{-1}(\sinh (x))}{a}+\frac {2 (a A-b B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.13, size = 63, normalized size = 1.02 \[ \frac {2 \left (\frac {(b B-a A) \tan ^{-1}\left (\frac {(a-b) \tanh \left (\frac {x}{2}\right )}{\sqrt {b^2-a^2}}\right )}{\sqrt {b^2-a^2}}+B \tan ^{-1}\left (\tanh \left (\frac {x}{2}\right )\right )\right )}{a} \]

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Sech[x])/(a + b*Cosh[x]),x]

[Out]

(2*(B*ArcTan[Tanh[x/2]] + ((-(a*A) + b*B)*ArcTan[((a - b)*Tanh[x/2])/Sqrt[-a^2 + b^2]])/Sqrt[-a^2 + b^2]))/a

________________________________________________________________________________________

fricas [A]  time = 0.98, size = 249, normalized size = 4.02 \[ \left [-\frac {{\left (A a - B b\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {b^{2} \cosh \relax (x)^{2} + b^{2} \sinh \relax (x)^{2} + 2 \, a b \cosh \relax (x) + 2 \, a^{2} - b^{2} + 2 \, {\left (b^{2} \cosh \relax (x) + a b\right )} \sinh \relax (x) + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cosh \relax (x) + b \sinh \relax (x) + a\right )}}{b \cosh \relax (x)^{2} + b \sinh \relax (x)^{2} + 2 \, a \cosh \relax (x) + 2 \, {\left (b \cosh \relax (x) + a\right )} \sinh \relax (x) + b}\right ) - 2 \, {\left (B a^{2} - B b^{2}\right )} \arctan \left (\cosh \relax (x) + \sinh \relax (x)\right )}{a^{3} - a b^{2}}, -\frac {2 \, {\left ({\left (A a - B b\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cosh \relax (x) + b \sinh \relax (x) + a\right )}}{a^{2} - b^{2}}\right ) - {\left (B a^{2} - B b^{2}\right )} \arctan \left (\cosh \relax (x) + \sinh \relax (x)\right )\right )}}{a^{3} - a b^{2}}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

[-((A*a - B*b)*sqrt(a^2 - b^2)*log((b^2*cosh(x)^2 + b^2*sinh(x)^2 + 2*a*b*cosh(x) + 2*a^2 - b^2 + 2*(b^2*cosh(
x) + a*b)*sinh(x) + 2*sqrt(a^2 - b^2)*(b*cosh(x) + b*sinh(x) + a))/(b*cosh(x)^2 + b*sinh(x)^2 + 2*a*cosh(x) +
2*(b*cosh(x) + a)*sinh(x) + b)) - 2*(B*a^2 - B*b^2)*arctan(cosh(x) + sinh(x)))/(a^3 - a*b^2), -2*((A*a - B*b)*
sqrt(-a^2 + b^2)*arctan(-sqrt(-a^2 + b^2)*(b*cosh(x) + b*sinh(x) + a)/(a^2 - b^2)) - (B*a^2 - B*b^2)*arctan(co
sh(x) + sinh(x)))/(a^3 - a*b^2)]

________________________________________________________________________________________

giac [A]  time = 0.13, size = 53, normalized size = 0.85 \[ \frac {2 \, B \arctan \left (e^{x}\right )}{a} + \frac {2 \, {\left (A a - B b\right )} \arctan \left (\frac {b e^{x} + a}{\sqrt {-a^{2} + b^{2}}}\right )}{\sqrt {-a^{2} + b^{2}} a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*B*arctan(e^x)/a + 2*(A*a - B*b)*arctan((b*e^x + a)/sqrt(-a^2 + b^2))/(sqrt(-a^2 + b^2)*a)

________________________________________________________________________________________

maple [A]  time = 0.10, size = 89, normalized size = 1.44 \[ \frac {2 A \arctanh \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {2 B b \arctanh \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a \sqrt {\left (a +b \right ) \left (a -b \right )}}+\frac {2 B \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*sech(x))/(a+b*cosh(x)),x)

[Out]

2*A/((a+b)*(a-b))^(1/2)*arctanh((a-b)*tanh(1/2*x)/((a+b)*(a-b))^(1/2))-2/a/((a+b)*(a-b))^(1/2)*arctanh((a-b)*t
anh(1/2*x)/((a+b)*(a-b))^(1/2))*B*b+2*B/a*arctan(tanh(1/2*x))

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?`
 for more details)Is 4*a^2-4*b^2 positive or negative?

________________________________________________________________________________________

mupad [B]  time = 6.41, size = 636, normalized size = 10.26 \[ \frac {\ln \left (\frac {\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )\,\left (\frac {32\,\left (A^2\,a^2\,b-2\,A\,B\,a\,b^2-4\,{\mathrm {e}}^x\,B^2\,a^3-2\,B^2\,a^2\,b+3\,{\mathrm {e}}^x\,B^2\,a\,b^2+2\,B^2\,b^3\right )}{b^5}+\frac {\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )\,\left (\frac {32\,a^2\,\left (2\,B\,b^2-4\,A\,a^2\,{\mathrm {e}}^x+A\,b^2\,{\mathrm {e}}^x-2\,A\,a\,b+3\,B\,a\,b\,{\mathrm {e}}^x\right )}{b^5}-\frac {32\,a^2\,\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )\,\left (4\,{\mathrm {e}}^x\,a^3+3\,a^2\,b-3\,{\mathrm {e}}^x\,a\,b^2-2\,b^3\right )}{b^5\,\left (a\,b^2-a^3\right )}\right )}{a\,b^2-a^3}\right )}{a\,b^2-a^3}-\frac {32\,B\,\left (A\,a-B\,b\right )\,\left (2\,B\,b-A\,b\,{\mathrm {e}}^x+4\,B\,a\,{\mathrm {e}}^x\right )}{b^5}\right )\,\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )}{a\,b^2-a^3}-\frac {\ln \left (-\frac {\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )\,\left (\frac {32\,\left (A^2\,a^2\,b-2\,A\,B\,a\,b^2-4\,{\mathrm {e}}^x\,B^2\,a^3-2\,B^2\,a^2\,b+3\,{\mathrm {e}}^x\,B^2\,a\,b^2+2\,B^2\,b^3\right )}{b^5}-\frac {\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )\,\left (\frac {32\,a^2\,\left (2\,B\,b^2-4\,A\,a^2\,{\mathrm {e}}^x+A\,b^2\,{\mathrm {e}}^x-2\,A\,a\,b+3\,B\,a\,b\,{\mathrm {e}}^x\right )}{b^5}+\frac {32\,a^2\,\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )\,\left (4\,{\mathrm {e}}^x\,a^3+3\,a^2\,b-3\,{\mathrm {e}}^x\,a\,b^2-2\,b^3\right )}{b^5\,\left (a\,b^2-a^3\right )}\right )}{a\,b^2-a^3}\right )}{a\,b^2-a^3}-\frac {32\,B\,\left (A\,a-B\,b\right )\,\left (2\,B\,b-A\,b\,{\mathrm {e}}^x+4\,B\,a\,{\mathrm {e}}^x\right )}{b^5}\right )\,\sqrt {\left (a+b\right )\,\left (a-b\right )}\,\left (A\,a-B\,b\right )}{a\,b^2-a^3}-\frac {B\,\ln \left ({\mathrm {e}}^x-\mathrm {i}\right )\,1{}\mathrm {i}}{a}+\frac {B\,\ln \left ({\mathrm {e}}^x+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B/cosh(x))/(a + b*cosh(x)),x)

[Out]

(B*log(exp(x) + 1i)*1i)/a - (B*log(exp(x) - 1i)*1i)/a + (log((((a + b)*(a - b))^(1/2)*(A*a - B*b)*((32*(2*B^2*
b^3 + A^2*a^2*b - 2*B^2*a^2*b - 4*B^2*a^3*exp(x) + 3*B^2*a*b^2*exp(x) - 2*A*B*a*b^2))/b^5 + (((a + b)*(a - b))
^(1/2)*(A*a - B*b)*((32*a^2*(2*B*b^2 - 4*A*a^2*exp(x) + A*b^2*exp(x) - 2*A*a*b + 3*B*a*b*exp(x)))/b^5 - (32*a^
2*((a + b)*(a - b))^(1/2)*(A*a - B*b)*(3*a^2*b - 2*b^3 + 4*a^3*exp(x) - 3*a*b^2*exp(x)))/(b^5*(a*b^2 - a^3))))
/(a*b^2 - a^3)))/(a*b^2 - a^3) - (32*B*(A*a - B*b)*(2*B*b - A*b*exp(x) + 4*B*a*exp(x)))/b^5)*((a + b)*(a - b))
^(1/2)*(A*a - B*b))/(a*b^2 - a^3) - (log(- (((a + b)*(a - b))^(1/2)*(A*a - B*b)*((32*(2*B^2*b^3 + A^2*a^2*b -
2*B^2*a^2*b - 4*B^2*a^3*exp(x) + 3*B^2*a*b^2*exp(x) - 2*A*B*a*b^2))/b^5 - (((a + b)*(a - b))^(1/2)*(A*a - B*b)
*((32*a^2*(2*B*b^2 - 4*A*a^2*exp(x) + A*b^2*exp(x) - 2*A*a*b + 3*B*a*b*exp(x)))/b^5 + (32*a^2*((a + b)*(a - b)
)^(1/2)*(A*a - B*b)*(3*a^2*b - 2*b^3 + 4*a^3*exp(x) - 3*a*b^2*exp(x)))/(b^5*(a*b^2 - a^3))))/(a*b^2 - a^3)))/(
a*b^2 - a^3) - (32*B*(A*a - B*b)*(2*B*b - A*b*exp(x) + 4*B*a*exp(x)))/b^5)*((a + b)*(a - b))^(1/2)*(A*a - B*b)
)/(a*b^2 - a^3)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {A + B \operatorname {sech}{\relax (x )}}{a + b \cosh {\relax (x )}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________