\(\int \frac {a+b \text {sech}(x)}{c+d \cosh (x)} \, dx\) [330]

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

Optimal result

Integrand size = 15, antiderivative size = 62 \[ \int \frac {a+b \text {sech}(x)}{c+d \cosh (x)} \, dx=\frac {b \arctan (\sinh (x))}{c}+\frac {2 (a c-b d) \text {arctanh}\left (\frac {\sqrt {c-d} \tanh \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{c \sqrt {c-d} \sqrt {c+d}} \] Output:

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

Mathematica [A] (verified)

Time = 0.19 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.02 \[ \int \frac {a+b \text {sech}(x)}{c+d \cosh (x)} \, dx=\frac {2 \left (b \arctan \left (\tanh \left (\frac {x}{2}\right )\right )+\frac {(-a c+b d) \arctan \left (\frac {(c-d) \tanh \left (\frac {x}{2}\right )}{\sqrt {-c^2+d^2}}\right )}{\sqrt {-c^2+d^2}}\right )}{c} \] Input:

Integrate[(a + b*Sech[x])/(c + d*Cosh[x]),x]
 

Output:

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

Rubi [A] (verified)

Time = 0.48 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.533, Rules used = {3042, 3307, 3042, 3480, 3042, 3138, 221, 4257}

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 {a+b \text {sech}(x)}{c+d \cosh (x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a+b \csc \left (\frac {\pi }{2}+i x\right )}{c+d \sin \left (\frac {\pi }{2}+i x\right )}dx\)

\(\Big \downarrow \) 3307

\(\displaystyle \int \frac {\text {sech}(x) (a \cosh (x)+b)}{c+d \cosh (x)}dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3480

\(\displaystyle \frac {(a c-b d) \int \frac {1}{c+d \cosh (x)}dx}{c}+\frac {b \int \text {sech}(x)dx}{c}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3138

\(\displaystyle \frac {2 (a c-b d) \int \frac {1}{-\left ((c-d) \tanh ^2\left (\frac {x}{2}\right )\right )+c+d}d\tanh \left (\frac {x}{2}\right )}{c}+\frac {b \int \csc \left (i x+\frac {\pi }{2}\right )dx}{c}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {2 (a c-b d) \text {arctanh}\left (\frac {\sqrt {c-d} \tanh \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{c \sqrt {c-d} \sqrt {c+d}}+\frac {b \int \csc \left (i x+\frac {\pi }{2}\right )dx}{c}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {2 (a c-b d) \text {arctanh}\left (\frac {\sqrt {c-d} \tanh \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{c \sqrt {c-d} \sqrt {c+d}}+\frac {b \arctan (\sinh (x))}{c}\)

Input:

Int[(a + b*Sech[x])/(c + d*Cosh[x]),x]
 

Output:

(b*ArcTan[Sinh[x]])/c + (2*(a*c - b*d)*ArcTanh[(Sqrt[c - d]*Tanh[x/2])/Sqr 
t[c + d]])/(c*Sqrt[c - d]*Sqrt[c + d])
 

Defintions of rubi rules used

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

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

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[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 3307
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.)*((a_) + (b_.)*sin[(e_.) + 
(f_.)*(x_)])^(m_.), x_Symbol] :> Int[(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] && IntegerQ 
[n]
 

rule 3480
Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(((a_.) + (b_.)*sin[(e_.) + (f_ 
.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])), x_Symbol] :> Simp[(A*b 
- a*B)/(b*c - a*d)   Int[1/(a + b*Sin[e + f*x]), x], x] + Simp[(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 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 
Maple [A] (verified)

Time = 0.75 (sec) , antiderivative size = 59, normalized size of antiderivative = 0.95

method result size
default \(-\frac {2 \left (-a c +b d \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{c \sqrt {\left (c +d \right ) \left (c -d \right )}}+\frac {2 b \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{c}\) \(59\)
risch \(\frac {i b \ln \left ({\mathrm e}^{x}+i\right )}{c}-\frac {i b \ln \left ({\mathrm e}^{x}-i\right )}{c}+\frac {\ln \left ({\mathrm e}^{x}+\frac {\sqrt {c^{2}-d^{2}}\, c -c^{2}+d^{2}}{\sqrt {c^{2}-d^{2}}\, d}\right ) a}{\sqrt {c^{2}-d^{2}}}-\frac {\ln \left ({\mathrm e}^{x}+\frac {\sqrt {c^{2}-d^{2}}\, c -c^{2}+d^{2}}{\sqrt {c^{2}-d^{2}}\, d}\right ) b d}{\sqrt {c^{2}-d^{2}}\, c}-\frac {\ln \left ({\mathrm e}^{x}+\frac {\sqrt {c^{2}-d^{2}}\, c +c^{2}-d^{2}}{\sqrt {c^{2}-d^{2}}\, d}\right ) a}{\sqrt {c^{2}-d^{2}}}+\frac {\ln \left ({\mathrm e}^{x}+\frac {\sqrt {c^{2}-d^{2}}\, c +c^{2}-d^{2}}{\sqrt {c^{2}-d^{2}}\, d}\right ) b d}{\sqrt {c^{2}-d^{2}}\, c}\) \(254\)

Input:

int((a+b*sech(x))/(c+d*cosh(x)),x,method=_RETURNVERBOSE)
 

Output:

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

Fricas [A] (verification not implemented)

Time = 0.34 (sec) , antiderivative size = 249, normalized size of antiderivative = 4.02 \[ \int \frac {a+b \text {sech}(x)}{c+d \cosh (x)} \, dx=\left [-\frac {{\left (a c - b d\right )} \sqrt {c^{2} - d^{2}} \log \left (\frac {d^{2} \cosh \left (x\right )^{2} + d^{2} \sinh \left (x\right )^{2} + 2 \, c d \cosh \left (x\right ) + 2 \, c^{2} - d^{2} + 2 \, {\left (d^{2} \cosh \left (x\right ) + c d\right )} \sinh \left (x\right ) + 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cosh \left (x\right ) + d \sinh \left (x\right ) + c\right )}}{d \cosh \left (x\right )^{2} + d \sinh \left (x\right )^{2} + 2 \, c \cosh \left (x\right ) + 2 \, {\left (d \cosh \left (x\right ) + c\right )} \sinh \left (x\right ) + d}\right ) - 2 \, {\left (b c^{2} - b d^{2}\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )}{c^{3} - c d^{2}}, -\frac {2 \, {\left ({\left (a c - b d\right )} \sqrt {-c^{2} + d^{2}} \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cosh \left (x\right ) + d \sinh \left (x\right ) + c\right )}}{c^{2} - d^{2}}\right ) - {\left (b c^{2} - b d^{2}\right )} \arctan \left (\cosh \left (x\right ) + \sinh \left (x\right )\right )\right )}}{c^{3} - c d^{2}}\right ] \] Input:

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

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

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

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*c^2-4*d^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 53, normalized size of antiderivative = 0.85 \[ \int \frac {a+b \text {sech}(x)}{c+d \cosh (x)} \, dx=\frac {2 \, b \arctan \left (e^{x}\right )}{c} + \frac {2 \, {\left (a c - b d\right )} \arctan \left (\frac {d e^{x} + c}{\sqrt {-c^{2} + d^{2}}}\right )}{\sqrt {-c^{2} + d^{2}} c} \] Input:

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

Output:

2*b*arctan(e^x)/c + 2*(a*c - b*d)*arctan((d*e^x + c)/sqrt(-c^2 + d^2))/(sq 
rt(-c^2 + d^2)*c)
 

Mupad [B] (verification not implemented)

Time = 6.45 (sec) , antiderivative size = 636, normalized size of antiderivative = 10.26 \[ \int \frac {a+b \text {sech}(x)}{c+d \cosh (x)} \, dx=\frac {\ln \left (\frac {\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (a\,c-b\,d\right )\,\left (\frac {32\,\left (a^2\,c^2\,d-2\,a\,b\,c\,d^2-4\,{\mathrm {e}}^x\,b^2\,c^3-2\,b^2\,c^2\,d+3\,{\mathrm {e}}^x\,b^2\,c\,d^2+2\,b^2\,d^3\right )}{d^5}+\frac {\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (\frac {32\,c^2\,\left (2\,b\,d^2-4\,a\,c^2\,{\mathrm {e}}^x+a\,d^2\,{\mathrm {e}}^x-2\,a\,c\,d+3\,b\,c\,d\,{\mathrm {e}}^x\right )}{d^5}-\frac {32\,c^2\,\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (a\,c-b\,d\right )\,\left (4\,{\mathrm {e}}^x\,c^3+3\,c^2\,d-3\,{\mathrm {e}}^x\,c\,d^2-2\,d^3\right )}{d^5\,\left (c\,d^2-c^3\right )}\right )\,\left (a\,c-b\,d\right )}{c\,d^2-c^3}\right )}{c\,d^2-c^3}-\frac {32\,b\,\left (a\,c-b\,d\right )\,\left (2\,b\,d-a\,d\,{\mathrm {e}}^x+4\,b\,c\,{\mathrm {e}}^x\right )}{d^5}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (a\,c-b\,d\right )}{c\,d^2-c^3}-\frac {\ln \left (-\frac {32\,b\,\left (a\,c-b\,d\right )\,\left (2\,b\,d-a\,d\,{\mathrm {e}}^x+4\,b\,c\,{\mathrm {e}}^x\right )}{d^5}-\frac {\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (a\,c-b\,d\right )\,\left (\frac {32\,\left (a^2\,c^2\,d-2\,a\,b\,c\,d^2-4\,{\mathrm {e}}^x\,b^2\,c^3-2\,b^2\,c^2\,d+3\,{\mathrm {e}}^x\,b^2\,c\,d^2+2\,b^2\,d^3\right )}{d^5}-\frac {\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (\frac {32\,c^2\,\left (2\,b\,d^2-4\,a\,c^2\,{\mathrm {e}}^x+a\,d^2\,{\mathrm {e}}^x-2\,a\,c\,d+3\,b\,c\,d\,{\mathrm {e}}^x\right )}{d^5}+\frac {32\,c^2\,\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (a\,c-b\,d\right )\,\left (4\,{\mathrm {e}}^x\,c^3+3\,c^2\,d-3\,{\mathrm {e}}^x\,c\,d^2-2\,d^3\right )}{d^5\,\left (c\,d^2-c^3\right )}\right )\,\left (a\,c-b\,d\right )}{c\,d^2-c^3}\right )}{c\,d^2-c^3}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}\,\left (a\,c-b\,d\right )}{c\,d^2-c^3}-\frac {b\,\ln \left ({\mathrm {e}}^x-\mathrm {i}\right )\,1{}\mathrm {i}}{c}+\frac {b\,\ln \left ({\mathrm {e}}^x+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{c} \] Input:

int((a + b/cosh(x))/(c + d*cosh(x)),x)
 

Output:

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

Reduce [B] (verification not implemented)

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

int((a+b*sech(x))/(c+d*cosh(x)),x)
 

Output:

(2*(atan(e**x)*b*c**2 - atan(e**x)*b*d**2 - sqrt( - c**2 + d**2)*atan((e** 
x*d + c)/sqrt( - c**2 + d**2))*a*c + sqrt( - c**2 + d**2)*atan((e**x*d + c 
)/sqrt( - c**2 + d**2))*b*d))/(c*(c**2 - d**2))