\(\int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx\) [116]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (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 = 13, antiderivative size = 94 \[ \int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx=\frac {x}{a}+\frac {\left (2 a^2-3 b^2\right ) \arctan (\sinh (x))}{2 b^3}-\frac {2 (a-b)^{3/2} (a+b)^{3/2} \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a b^3}-\frac {a \tanh (x)}{b^2}+\frac {\text {sech}(x) \tanh (x)}{2 b} \] Output:

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

Mathematica [A] (verified)

Time = 0.35 (sec) , antiderivative size = 113, normalized size of antiderivative = 1.20 \[ \int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx=\frac {(b+a \cosh (x)) \text {sech}^2(x) \left (2 \left (b^3 x+a \left (2 a^2-3 b^2\right ) \arctan \left (\tanh \left (\frac {x}{2}\right )\right )+2 \left (a^2-b^2\right )^{3/2} \arctan \left (\frac {(-a+b) \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )\right ) \cosh (x)+a b (-2 a \sinh (x)+b \tanh (x))\right )}{2 a b^3 (a+b \text {sech}(x))} \] Input:

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

Output:

((b + a*Cosh[x])*Sech[x]^2*(2*(b^3*x + a*(2*a^2 - 3*b^2)*ArcTan[Tanh[x/2]] 
 + 2*(a^2 - b^2)^(3/2)*ArcTan[((-a + b)*Tanh[x/2])/Sqrt[a^2 - b^2]])*Cosh[ 
x] + a*b*(-2*a*Sinh[x] + b*Tanh[x])))/(2*a*b^3*(a + b*Sech[x]))
 

Rubi [A] (verified)

Time = 0.93 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.21, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.846, Rules used = {3042, 4386, 3042, 3372, 25, 3042, 3536, 3042, 3138, 218, 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 {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\cot \left (\frac {\pi }{2}+i x\right )^4}{a+b \csc \left (\frac {\pi }{2}+i x\right )}dx\)

\(\Big \downarrow \) 4386

\(\displaystyle \int \frac {\sinh (x) \tanh ^3(x)}{a \cosh (x)+b}dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3372

\(\displaystyle -\frac {\int -\frac {\left (2 a^2+b \cosh (x) a-3 b^2+2 b^2 \cosh ^2(x)\right ) \text {sech}(x)}{b+a \cosh (x)}dx}{2 b^2}-\frac {a \tanh (x)}{b^2}+\frac {\tanh (x) \text {sech}(x)}{2 b}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \frac {\left (2 a^2+b \cosh (x) a-3 b^2+2 b^2 \cosh ^2(x)\right ) \text {sech}(x)}{b+a \cosh (x)}dx}{2 b^2}-\frac {a \tanh (x)}{b^2}+\frac {\tanh (x) \text {sech}(x)}{2 b}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {2 a^2+b \sin \left (i x+\frac {\pi }{2}\right ) a-3 b^2+2 b^2 \sin \left (i x+\frac {\pi }{2}\right )^2}{\sin \left (i x+\frac {\pi }{2}\right ) \left (b+a \sin \left (i x+\frac {\pi }{2}\right )\right )}dx}{2 b^2}-\frac {a \tanh (x)}{b^2}+\frac {\tanh (x) \text {sech}(x)}{2 b}\)

\(\Big \downarrow \) 3536

\(\displaystyle \frac {-\frac {2 \left (a^2-b^2\right )^2 \int \frac {1}{b+a \cosh (x)}dx}{a b}+\frac {\left (2 a^2-3 b^2\right ) \int \text {sech}(x)dx}{b}+\frac {2 b^2 x}{a}}{2 b^2}-\frac {a \tanh (x)}{b^2}+\frac {\tanh (x) \text {sech}(x)}{2 b}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {-\frac {2 \left (a^2-b^2\right )^2 \int \frac {1}{b+a \sin \left (i x+\frac {\pi }{2}\right )}dx}{a b}+\frac {\left (2 a^2-3 b^2\right ) \int \csc \left (i x+\frac {\pi }{2}\right )dx}{b}+\frac {2 b^2 x}{a}}{2 b^2}-\frac {a \tanh (x)}{b^2}+\frac {\tanh (x) \text {sech}(x)}{2 b}\)

\(\Big \downarrow \) 3138

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

\(\Big \downarrow \) 218

\(\displaystyle \frac {\frac {\left (2 a^2-3 b^2\right ) \int \csc \left (i x+\frac {\pi }{2}\right )dx}{b}-\frac {4 \left (a^2-b^2\right )^2 \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a b \sqrt {a-b} \sqrt {a+b}}+\frac {2 b^2 x}{a}}{2 b^2}-\frac {a \tanh (x)}{b^2}+\frac {\tanh (x) \text {sech}(x)}{2 b}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {\frac {\left (2 a^2-3 b^2\right ) \arctan (\sinh (x))}{b}-\frac {4 \left (a^2-b^2\right )^2 \arctan \left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a b \sqrt {a-b} \sqrt {a+b}}+\frac {2 b^2 x}{a}}{2 b^2}-\frac {a \tanh (x)}{b^2}+\frac {\tanh (x) \text {sech}(x)}{2 b}\)

Input:

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

Output:

((2*b^2*x)/a + ((2*a^2 - 3*b^2)*ArcTan[Sinh[x]])/b - (4*(a^2 - b^2)^2*ArcT 
an[(Sqrt[a - b]*Tanh[x/2])/Sqrt[a + b]])/(a*Sqrt[a - b]*b*Sqrt[a + b]))/(2 
*b^2) - (a*Tanh[x])/b^2 + (Sech[x]*Tanh[x])/(2*b)
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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 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 3372
Int[cos[(e_.) + (f_.)*(x_)]^4*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + 
(b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Simp[Cos[e + f*x]*(a + b* 
Sin[e + f*x])^(m + 1)*((d*Sin[e + f*x])^(n + 1)/(a*d*f*(n + 1))), x] + (-Si 
mp[b*(m + n + 2)*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1)*((d*Sin[e + f*x] 
)^(n + 2)/(a^2*d^2*f*(n + 1)*(n + 2))), x] - Simp[1/(a^2*d^2*(n + 1)*(n + 2 
))   Int[(a + b*Sin[e + f*x])^m*(d*Sin[e + f*x])^(n + 2)*Simp[a^2*n*(n + 2) 
 - b^2*(m + n + 2)*(m + n + 3) + a*b*m*Sin[e + f*x] - (a^2*(n + 1)*(n + 2) 
- b^2*(m + n + 2)*(m + n + 4))*Sin[e + f*x]^2, x], x], x]) /; FreeQ[{a, b, 
d, e, f, m}, x] && NeQ[a^2 - b^2, 0] && (IGtQ[m, 0] || IntegersQ[2*m, 2*n]) 
 &&  !m < -1 && LtQ[n, -1] && (LtQ[n, -2] || EqQ[m + n + 4, 0])
 

rule 3536
Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^ 
2)/(((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.) 
*(x_)])), x_Symbol] :> Simp[C*(x/(b*d)), x] + (Simp[(A*b^2 - a*b*B + a^2*C) 
/(b*(b*c - a*d))   Int[1/(a + b*Sin[e + f*x]), x], x] - Simp[(c^2*C - B*c*d 
 + A*d^2)/(d*(b*c - a*d))   Int[1/(c + d*Sin[e + f*x]), x], x]) /; FreeQ[{a 
, b, c, d, e, f, A, B, C}, 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]
 

rule 4386
Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n 
_), x_Symbol] :> Int[Cos[c + d*x]^m*((b + a*Sin[c + d*x])^n/Sin[c + d*x]^(m 
 + n)), x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0] && IntegerQ[n] && 
 IntegerQ[m] && (IntegerQ[m/2] || LeQ[m, 1])
 
Maple [A] (verified)

Time = 0.72 (sec) , antiderivative size = 152, normalized size of antiderivative = 1.62

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

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 587 vs. \(2 (80) = 160\).

Time = 0.21 (sec) , antiderivative size = 1254, normalized size of antiderivative = 13.34 \[ \int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx=\text {Too large to display} \] Input:

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

Output:

[(b^3*x*cosh(x)^4 + b^3*x*sinh(x)^4 + a*b^2*cosh(x)^3 + b^3*x - a*b^2*cosh 
(x) + (4*b^3*x*cosh(x) + a*b^2)*sinh(x)^3 + 2*a^2*b + 2*(b^3*x + a^2*b)*co 
sh(x)^2 + (6*b^3*x*cosh(x)^2 + 2*b^3*x + 3*a*b^2*cosh(x) + 2*a^2*b)*sinh(x 
)^2 - ((a^2 - b^2)*cosh(x)^4 + 4*(a^2 - b^2)*cosh(x)*sinh(x)^3 + (a^2 - b^ 
2)*sinh(x)^4 + 2*(a^2 - b^2)*cosh(x)^2 + 2*(3*(a^2 - b^2)*cosh(x)^2 + a^2 
- b^2)*sinh(x)^2 + a^2 - b^2 + 4*((a^2 - b^2)*cosh(x)^3 + (a^2 - b^2)*cosh 
(x))*sinh(x))*sqrt(-a^2 + b^2)*log((a^2*cosh(x)^2 + a^2*sinh(x)^2 + 2*a*b* 
cosh(x) - a^2 + 2*b^2 + 2*(a^2*cosh(x) + a*b)*sinh(x) + 2*sqrt(-a^2 + b^2) 
*(a*cosh(x) + a*sinh(x) + b))/(a*cosh(x)^2 + a*sinh(x)^2 + 2*b*cosh(x) + 2 
*(a*cosh(x) + b)*sinh(x) + a)) + ((2*a^3 - 3*a*b^2)*cosh(x)^4 + 4*(2*a^3 - 
 3*a*b^2)*cosh(x)*sinh(x)^3 + (2*a^3 - 3*a*b^2)*sinh(x)^4 + 2*a^3 - 3*a*b^ 
2 + 2*(2*a^3 - 3*a*b^2)*cosh(x)^2 + 2*(2*a^3 - 3*a*b^2 + 3*(2*a^3 - 3*a*b^ 
2)*cosh(x)^2)*sinh(x)^2 + 4*((2*a^3 - 3*a*b^2)*cosh(x)^3 + (2*a^3 - 3*a*b^ 
2)*cosh(x))*sinh(x))*arctan(cosh(x) + sinh(x)) + (4*b^3*x*cosh(x)^3 + 3*a* 
b^2*cosh(x)^2 - a*b^2 + 4*(b^3*x + a^2*b)*cosh(x))*sinh(x))/(a*b^3*cosh(x) 
^4 + 4*a*b^3*cosh(x)*sinh(x)^3 + a*b^3*sinh(x)^4 + 2*a*b^3*cosh(x)^2 + a*b 
^3 + 2*(3*a*b^3*cosh(x)^2 + a*b^3)*sinh(x)^2 + 4*(a*b^3*cosh(x)^3 + a*b^3* 
cosh(x))*sinh(x)), (b^3*x*cosh(x)^4 + b^3*x*sinh(x)^4 + a*b^2*cosh(x)^3 + 
b^3*x - a*b^2*cosh(x) + (4*b^3*x*cosh(x) + a*b^2)*sinh(x)^3 + 2*a^2*b + 2* 
(b^3*x + a^2*b)*cosh(x)^2 + (6*b^3*x*cosh(x)^2 + 2*b^3*x + 3*a*b^2*cosh...
 

Sympy [F]

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

integrate(tanh(x)**4/(a+b*sech(x)),x)
 

Output:

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

Maxima [F(-2)]

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

integrate(tanh(x)^4/(a+b*sech(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*b^2-4*a^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.18 \[ \int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx=\frac {x}{a} + \frac {{\left (2 \, a^{2} - 3 \, b^{2}\right )} \arctan \left (e^{x}\right )}{b^{3}} - \frac {2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \arctan \left (\frac {a e^{x} + b}{\sqrt {a^{2} - b^{2}}}\right )}{\sqrt {a^{2} - b^{2}} a b^{3}} + \frac {b e^{\left (3 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - b e^{x} + 2 \, a}{b^{2} {\left (e^{\left (2 \, x\right )} + 1\right )}^{2}} \] Input:

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

Output:

x/a + (2*a^2 - 3*b^2)*arctan(e^x)/b^3 - 2*(a^4 - 2*a^2*b^2 + b^4)*arctan(( 
a*e^x + b)/sqrt(a^2 - b^2))/(sqrt(a^2 - b^2)*a*b^3) + (b*e^(3*x) + 2*a*e^( 
2*x) - b*e^x + 2*a)/(b^2*(e^(2*x) + 1)^2)
 

Mupad [B] (verification not implemented)

Time = 7.56 (sec) , antiderivative size = 700, normalized size of antiderivative = 7.45 \[ \int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx =\text {Too large to display} \] Input:

int(tanh(x)^4/(a + b/cosh(x)),x)
 

Output:

((2*a)/b^2 + exp(x)/b)/(exp(2*x) + 1) + x/a - (log(exp(x) - 1i)*(a^2*2i - 
b^2*3i))/(2*b^3) + (log(exp(x) + 1i)*(a^2*2i - b^2*3i))/(2*b^3) - (2*exp(x 
))/(b*(2*exp(2*x) + exp(4*x) + 1)) + (log((((64*a^8 + 32*b^8 - 272*a^2*b^6 
 + 456*a^4*b^4 - 288*a^6*b^2 - 288*a*b^7*exp(x) + 96*a^7*b*exp(x) + 600*a^ 
3*b^5*exp(x) - 416*a^5*b^3*exp(x))/(a^6*b^4) - (((16*(a^2 - b^2)*(4*a*b^2 
- 4*a^3 + 8*b^3*exp(x) - 7*a^2*b*exp(x)))/a^6 + (32*(-(a + b)^3*(a - b)^3) 
^(1/2)*(3*a*b^2 - 2*a^3 + 4*b^3*exp(x) - 3*a^2*b*exp(x)))/(a^6*b))*(-(a + 
b)^3*(a - b)^3)^(1/2))/(a*b^3))*(-(a + b)^3*(a - b)^3)^(1/2))/(a*b^3) - (8 
*(a^2 - b^2)^2*(2*a^2 - 3*b^2)*(6*a*b^2 - 4*a^3 + 10*b^3*exp(x) - 7*a^2*b* 
exp(x)))/(a^6*b^6))*(-(a + b)^3*(a - b)^3)^(1/2))/(a*b^3) - (log(- (((64*a 
^8 + 32*b^8 - 272*a^2*b^6 + 456*a^4*b^4 - 288*a^6*b^2 - 288*a*b^7*exp(x) + 
 96*a^7*b*exp(x) + 600*a^3*b^5*exp(x) - 416*a^5*b^3*exp(x))/(a^6*b^4) + (( 
(16*(a^2 - b^2)*(4*a*b^2 - 4*a^3 + 8*b^3*exp(x) - 7*a^2*b*exp(x)))/a^6 - ( 
32*(-(a + b)^3*(a - b)^3)^(1/2)*(3*a*b^2 - 2*a^3 + 4*b^3*exp(x) - 3*a^2*b* 
exp(x)))/(a^6*b))*(-(a + b)^3*(a - b)^3)^(1/2))/(a*b^3))*(-(a + b)^3*(a - 
b)^3)^(1/2))/(a*b^3) - (8*(a^2 - b^2)^2*(2*a^2 - 3*b^2)*(6*a*b^2 - 4*a^3 + 
 10*b^3*exp(x) - 7*a^2*b*exp(x)))/(a^6*b^6))*(-(a + b)^3*(a - b)^3)^(1/2)) 
/(a*b^3)
 

Reduce [B] (verification not implemented)

Time = 0.24 (sec) , antiderivative size = 398, normalized size of antiderivative = 4.23 \[ \int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx=\frac {2 e^{4 x} \mathit {atan} \left (e^{x}\right ) a^{3}-3 e^{4 x} \mathit {atan} \left (e^{x}\right ) a \,b^{2}+4 e^{2 x} \mathit {atan} \left (e^{x}\right ) a^{3}-6 e^{2 x} \mathit {atan} \left (e^{x}\right ) a \,b^{2}+2 \mathit {atan} \left (e^{x}\right ) a^{3}-3 \mathit {atan} \left (e^{x}\right ) a \,b^{2}-2 e^{4 x} \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) a^{2}+2 e^{4 x} \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) b^{2}-4 e^{2 x} \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) a^{2}+4 e^{2 x} \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) b^{2}-2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) a^{2}+2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +b}{\sqrt {a^{2}-b^{2}}}\right ) b^{2}-e^{4 x} a^{2} b +e^{4 x} b^{3} x +e^{3 x} a \,b^{2}+2 e^{2 x} b^{3} x -e^{x} a \,b^{2}+a^{2} b +b^{3} x}{a \,b^{3} \left (e^{4 x}+2 e^{2 x}+1\right )} \] Input:

int(tanh(x)^4/(a+b*sech(x)),x)
 

Output:

(2*e**(4*x)*atan(e**x)*a**3 - 3*e**(4*x)*atan(e**x)*a*b**2 + 4*e**(2*x)*at 
an(e**x)*a**3 - 6*e**(2*x)*atan(e**x)*a*b**2 + 2*atan(e**x)*a**3 - 3*atan( 
e**x)*a*b**2 - 2*e**(4*x)*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - 
b**2))*a**2 + 2*e**(4*x)*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - b 
**2))*b**2 - 4*e**(2*x)*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - b* 
*2))*a**2 + 4*e**(2*x)*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - b** 
2))*b**2 - 2*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - b**2))*a**2 + 
 2*sqrt(a**2 - b**2)*atan((e**x*a + b)/sqrt(a**2 - b**2))*b**2 - e**(4*x)* 
a**2*b + e**(4*x)*b**3*x + e**(3*x)*a*b**2 + 2*e**(2*x)*b**3*x - e**x*a*b* 
*2 + a**2*b + b**3*x)/(a*b**3*(e**(4*x) + 2*e**(2*x) + 1))