\(\int \frac {\text {sech}(c+d x)}{(a+b \tanh ^2(c+d x))^2} \, dx\) [118]

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

Optimal result

Integrand size = 21, antiderivative size = 83 \[ \int \frac {\text {sech}(c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\frac {(2 a+b) \arctan \left (\frac {\sqrt {a+b} \sinh (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{3/2} d}+\frac {b \sinh (c+d x)}{2 a (a+b) d \left (a+(a+b) \sinh ^2(c+d x)\right )} \] Output:

1/2*(2*a+b)*arctan((a+b)^(1/2)*sinh(d*x+c)/a^(1/2))/a^(3/2)/(a+b)^(3/2)/d+ 
1/2*b*sinh(d*x+c)/a/(a+b)/d/(a+(a+b)*sinh(d*x+c)^2)
 

Mathematica [A] (verified)

Time = 0.21 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.94 \[ \int \frac {\text {sech}(c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\frac {\frac {(2 a+b) \arctan \left (\frac {\sqrt {a+b} \sinh (c+d x)}{\sqrt {a}}\right )}{a^{3/2} \sqrt {a+b}}+\frac {b \sinh (c+d x)}{a \left (a+(a+b) \sinh ^2(c+d x)\right )}}{2 (a+b) d} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.98, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3042, 4159, 298, 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}(c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\sec (i c+i d x)}{\left (a-b \tan (i c+i d x)^2\right )^2}dx\)

\(\Big \downarrow \) 4159

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

\(\Big \downarrow \) 298

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

\(\Big \downarrow \) 218

\(\displaystyle \frac {\frac {(2 a+b) \arctan \left (\frac {\sqrt {a+b} \sinh (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{3/2}}+\frac {b \sinh (c+d x)}{2 a (a+b) \left ((a+b) \sinh ^2(c+d x)+a\right )}}{d}\)

Input:

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

Output:

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

Defintions of rubi rules used

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 298
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[(-( 
b*c - a*d))*x*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] - Simp[(a*d - b*c*( 
2*p + 3))/(2*a*b*(p + 1))   Int[(a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, 
 c, d, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/2 + p, 0])
 

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

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

Leaf count of result is larger than twice the leaf count of optimal. \(251\) vs. \(2(71)=142\).

Time = 8.31 (sec) , antiderivative size = 252, normalized size of antiderivative = 3.04

method result size
derivativedivides \(\frac {\frac {-\frac {b \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a \left (a +b \right )}+\frac {b \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )}{a \left (a +b \right )}}{\tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} a +2 \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a +4 b \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+a}+\frac {\left (2 a +b \right ) \left (\frac {\left (\sqrt {\left (a +b \right ) b}+b \right ) \arctan \left (\frac {a \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (2 \sqrt {\left (a +b \right ) b}+a +2 b \right ) a}}\right )}{2 a \sqrt {\left (a +b \right ) b}\, \sqrt {\left (2 \sqrt {\left (a +b \right ) b}+a +2 b \right ) a}}-\frac {\left (\sqrt {\left (a +b \right ) b}-b \right ) \operatorname {arctanh}\left (\frac {a \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (2 \sqrt {\left (a +b \right ) b}-a -2 b \right ) a}}\right )}{2 a \sqrt {\left (a +b \right ) b}\, \sqrt {\left (2 \sqrt {\left (a +b \right ) b}-a -2 b \right ) a}}\right )}{a +b}}{d}\) \(252\)
default \(\frac {\frac {-\frac {b \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a \left (a +b \right )}+\frac {b \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )}{a \left (a +b \right )}}{\tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} a +2 \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a +4 b \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+a}+\frac {\left (2 a +b \right ) \left (\frac {\left (\sqrt {\left (a +b \right ) b}+b \right ) \arctan \left (\frac {a \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (2 \sqrt {\left (a +b \right ) b}+a +2 b \right ) a}}\right )}{2 a \sqrt {\left (a +b \right ) b}\, \sqrt {\left (2 \sqrt {\left (a +b \right ) b}+a +2 b \right ) a}}-\frac {\left (\sqrt {\left (a +b \right ) b}-b \right ) \operatorname {arctanh}\left (\frac {a \tanh \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (2 \sqrt {\left (a +b \right ) b}-a -2 b \right ) a}}\right )}{2 a \sqrt {\left (a +b \right ) b}\, \sqrt {\left (2 \sqrt {\left (a +b \right ) b}-a -2 b \right ) a}}\right )}{a +b}}{d}\) \(252\)
risch \(\frac {b \,{\mathrm e}^{d x +c} \left ({\mathrm e}^{2 d x +2 c}-1\right )}{\left (a +b \right ) a d \left ({\mathrm e}^{4 d x +4 c} a +b \,{\mathrm e}^{4 d x +4 c}+2 \,{\mathrm e}^{2 d x +2 c} a -2 \,{\mathrm e}^{2 d x +2 c} b +a +b \right )}-\frac {\ln \left ({\mathrm e}^{2 d x +2 c}-\frac {2 a \,{\mathrm e}^{d x +c}}{\sqrt {-a^{2}-a b}}-1\right )}{2 \sqrt {-a^{2}-a b}\, \left (a +b \right ) d}-\frac {\ln \left ({\mathrm e}^{2 d x +2 c}-\frac {2 a \,{\mathrm e}^{d x +c}}{\sqrt {-a^{2}-a b}}-1\right ) b}{4 \sqrt {-a^{2}-a b}\, \left (a +b \right ) d a}+\frac {\ln \left ({\mathrm e}^{2 d x +2 c}+\frac {2 a \,{\mathrm e}^{d x +c}}{\sqrt {-a^{2}-a b}}-1\right )}{2 \sqrt {-a^{2}-a b}\, \left (a +b \right ) d}+\frac {\ln \left ({\mathrm e}^{2 d x +2 c}+\frac {2 a \,{\mathrm e}^{d x +c}}{\sqrt {-a^{2}-a b}}-1\right ) b}{4 \sqrt {-a^{2}-a b}\, \left (a +b \right ) d a}\) \(311\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1037 vs. \(2 (71) = 142\).

Time = 0.13 (sec) , antiderivative size = 2049, normalized size of antiderivative = 24.69 \[ \int \frac {\text {sech}(c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\text {Too large to display} \] Input:

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

Output:

[1/4*(4*(a^2*b + a*b^2)*cosh(d*x + c)^3 + 12*(a^2*b + a*b^2)*cosh(d*x + c) 
*sinh(d*x + c)^2 + 4*(a^2*b + a*b^2)*sinh(d*x + c)^3 - ((2*a^2 + 3*a*b + b 
^2)*cosh(d*x + c)^4 + 4*(2*a^2 + 3*a*b + b^2)*cosh(d*x + c)*sinh(d*x + c)^ 
3 + (2*a^2 + 3*a*b + b^2)*sinh(d*x + c)^4 + 2*(2*a^2 - a*b - b^2)*cosh(d*x 
 + c)^2 + 2*(3*(2*a^2 + 3*a*b + b^2)*cosh(d*x + c)^2 + 2*a^2 - a*b - b^2)* 
sinh(d*x + c)^2 + 2*a^2 + 3*a*b + b^2 + 4*((2*a^2 + 3*a*b + b^2)*cosh(d*x 
+ c)^3 + (2*a^2 - a*b - b^2)*cosh(d*x + c))*sinh(d*x + c))*sqrt(-a^2 - a*b 
)*log(((a + b)*cosh(d*x + c)^4 + 4*(a + b)*cosh(d*x + c)*sinh(d*x + c)^3 + 
 (a + b)*sinh(d*x + c)^4 - 2*(3*a + b)*cosh(d*x + c)^2 + 2*(3*(a + b)*cosh 
(d*x + c)^2 - 3*a - b)*sinh(d*x + c)^2 + 4*((a + b)*cosh(d*x + c)^3 - (3*a 
 + b)*cosh(d*x + c))*sinh(d*x + c) - 4*(cosh(d*x + c)^3 + 3*cosh(d*x + c)* 
sinh(d*x + c)^2 + sinh(d*x + c)^3 + (3*cosh(d*x + c)^2 - 1)*sinh(d*x + c) 
- cosh(d*x + c))*sqrt(-a^2 - a*b) + a + b)/((a + b)*cosh(d*x + c)^4 + 4*(a 
 + b)*cosh(d*x + c)*sinh(d*x + c)^3 + (a + b)*sinh(d*x + c)^4 + 2*(a - b)* 
cosh(d*x + c)^2 + 2*(3*(a + b)*cosh(d*x + c)^2 + a - b)*sinh(d*x + c)^2 + 
4*((a + b)*cosh(d*x + c)^3 + (a - b)*cosh(d*x + c))*sinh(d*x + c) + a + b) 
) - 4*(a^2*b + a*b^2)*cosh(d*x + c) - 4*(a^2*b + a*b^2 - 3*(a^2*b + a*b^2) 
*cosh(d*x + c)^2)*sinh(d*x + c))/((a^5 + 3*a^4*b + 3*a^3*b^2 + a^2*b^3)*d* 
cosh(d*x + c)^4 + 4*(a^5 + 3*a^4*b + 3*a^3*b^2 + a^2*b^3)*d*cosh(d*x + c)* 
sinh(d*x + c)^3 + (a^5 + 3*a^4*b + 3*a^3*b^2 + a^2*b^3)*d*sinh(d*x + c)...
 

Sympy [F]

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

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F(-2)]

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

integrate(sech(d*x+c)/(a+b*tanh(d*x+c)^2)^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 [F(-1)]

Timed out. \[ \int \frac {\text {sech}(c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\int \frac {1}{\mathrm {cosh}\left (c+d\,x\right )\,{\left (b\,{\mathrm {tanh}\left (c+d\,x\right )}^2+a\right )}^2} \,d x \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 914, normalized size of antiderivative = 11.01 \[ \int \frac {\text {sech}(c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx =\text {Too large to display} \] Input:

int(sech(d*x+c)/(a+b*tanh(d*x+c)^2)^2,x)
 

Output:

(2*e**(4*c + 4*d*x)*sqrt(a)*sqrt(a + b)*atan((e**(c + d*x)*sqrt(a + b) - s 
qrt(b))/sqrt(a))*a**2 + 3*e**(4*c + 4*d*x)*sqrt(a)*sqrt(a + b)*atan((e**(c 
 + d*x)*sqrt(a + b) - sqrt(b))/sqrt(a))*a*b + e**(4*c + 4*d*x)*sqrt(a)*sqr 
t(a + b)*atan((e**(c + d*x)*sqrt(a + b) - sqrt(b))/sqrt(a))*b**2 + 4*e**(2 
*c + 2*d*x)*sqrt(a)*sqrt(a + b)*atan((e**(c + d*x)*sqrt(a + b) - sqrt(b))/ 
sqrt(a))*a**2 - 2*e**(2*c + 2*d*x)*sqrt(a)*sqrt(a + b)*atan((e**(c + d*x)* 
sqrt(a + b) - sqrt(b))/sqrt(a))*a*b - 2*e**(2*c + 2*d*x)*sqrt(a)*sqrt(a + 
b)*atan((e**(c + d*x)*sqrt(a + b) - sqrt(b))/sqrt(a))*b**2 + 2*sqrt(a)*sqr 
t(a + b)*atan((e**(c + d*x)*sqrt(a + b) - sqrt(b))/sqrt(a))*a**2 + 3*sqrt( 
a)*sqrt(a + b)*atan((e**(c + d*x)*sqrt(a + b) - sqrt(b))/sqrt(a))*a*b + sq 
rt(a)*sqrt(a + b)*atan((e**(c + d*x)*sqrt(a + b) - sqrt(b))/sqrt(a))*b**2 
+ 2*e**(4*c + 4*d*x)*sqrt(a)*sqrt(a + b)*atan((e**(c + d*x)*sqrt(a + b) + 
sqrt(b))/sqrt(a))*a**2 + 3*e**(4*c + 4*d*x)*sqrt(a)*sqrt(a + b)*atan((e**( 
c + d*x)*sqrt(a + b) + sqrt(b))/sqrt(a))*a*b + e**(4*c + 4*d*x)*sqrt(a)*sq 
rt(a + b)*atan((e**(c + d*x)*sqrt(a + b) + sqrt(b))/sqrt(a))*b**2 + 4*e**( 
2*c + 2*d*x)*sqrt(a)*sqrt(a + b)*atan((e**(c + d*x)*sqrt(a + b) + sqrt(b)) 
/sqrt(a))*a**2 - 2*e**(2*c + 2*d*x)*sqrt(a)*sqrt(a + b)*atan((e**(c + d*x) 
*sqrt(a + b) + sqrt(b))/sqrt(a))*a*b - 2*e**(2*c + 2*d*x)*sqrt(a)*sqrt(a + 
 b)*atan((e**(c + d*x)*sqrt(a + b) + sqrt(b))/sqrt(a))*b**2 + 2*sqrt(a)*sq 
rt(a + b)*atan((e**(c + d*x)*sqrt(a + b) + sqrt(b))/sqrt(a))*a**2 + 3*s...