\(\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx\) [371]
Optimal result
Integrand size = 18, antiderivative size = 143 \[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\frac {x^2 \arctan \left (e^{a+b x}\right )}{b}+\frac {\arctan (\sinh (a+b x))}{b^3}-\frac {i x \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b^2}+\frac {i x \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b^2}+\frac {i \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )}{b^3}-\frac {i \operatorname {PolyLog}\left (3,i e^{a+b x}\right )}{b^3}-\frac {x \text {sech}(a+b x)}{b^2}-\frac {x^2 \text {sech}(a+b x) \tanh (a+b x)}{2 b}
\]
[Out]
x^2*arctan(exp(b*x+a))/b+arctan(sinh(b*x+a))/b^3-I*x*polylog(2,-I*exp(b*x+a))/b^2+I*x*polylog(2,I*exp(b*x+a))/
b^2+I*polylog(3,-I*exp(b*x+a))/b^3-I*polylog(3,I*exp(b*x+a))/b^3-x*sech(b*x+a)/b^2-1/2*x^2*sech(b*x+a)*tanh(b*
x+a)/b
Rubi [A] (verified)
Time = 0.16 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.00, number of
steps used = 17, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.389, Rules used = {5563, 4265, 2611, 2320, 6724,
4271, 3855} \[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\frac {\arctan (\sinh (a+b x))}{b^3}+\frac {x^2 \arctan \left (e^{a+b x}\right )}{b}+\frac {i \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )}{b^3}-\frac {i \operatorname {PolyLog}\left (3,i e^{a+b x}\right )}{b^3}-\frac {i x \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b^2}+\frac {i x \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b^2}-\frac {x \text {sech}(a+b x)}{b^2}-\frac {x^2 \tanh (a+b x) \text {sech}(a+b x)}{2 b}
\]
[In]
Int[x^2*Sech[a + b*x]*Tanh[a + b*x]^2,x]
[Out]
(x^2*ArcTan[E^(a + b*x)])/b + ArcTan[Sinh[a + b*x]]/b^3 - (I*x*PolyLog[2, (-I)*E^(a + b*x)])/b^2 + (I*x*PolyLo
g[2, I*E^(a + b*x)])/b^2 + (I*PolyLog[3, (-I)*E^(a + b*x)])/b^3 - (I*PolyLog[3, I*E^(a + b*x)])/b^3 - (x*Sech[
a + b*x])/b^2 - (x^2*Sech[a + b*x]*Tanh[a + b*x])/(2*b)
Rule 2320
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] && !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] && !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]
Rule 2611
Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(-(
f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + b*x)))^n]/(b*c*n*Log[F])), x] + Dist[g*(m/(b*c*n*Log[F])), Int[(f + g*
x)^(m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e, f, g, n}, x] && GtQ[m, 0]
Rule 3855
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]
Rule 4265
Int[csc[(e_.) + Pi*(k_.) + (Complex[0, fz_])*(f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[-2*(c +
d*x)^m*(ArcTanh[E^((-I)*e + f*fz*x)/E^(I*k*Pi)]/(f*fz*I)), x] + (-Dist[d*(m/(f*fz*I)), Int[(c + d*x)^(m - 1)*
Log[1 - E^((-I)*e + f*fz*x)/E^(I*k*Pi)], x], x] + Dist[d*(m/(f*fz*I)), Int[(c + d*x)^(m - 1)*Log[1 + E^((-I)*e
+ f*fz*x)/E^(I*k*Pi)], x], x]) /; FreeQ[{c, d, e, f, fz}, x] && IntegerQ[2*k] && IGtQ[m, 0]
Rule 4271
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(n_)*((c_.) + (d_.)*(x_))^(m_), x_Symbol] :> Simp[(-b^2)*(c + d*x)^m*Cot[e
+ f*x]*((b*Csc[e + f*x])^(n - 2)/(f*(n - 1))), x] + (Dist[b^2*d^2*m*((m - 1)/(f^2*(n - 1)*(n - 2))), Int[(c +
d*x)^(m - 2)*(b*Csc[e + f*x])^(n - 2), x], x] + Dist[b^2*((n - 2)/(n - 1)), Int[(c + d*x)^m*(b*Csc[e + f*x])^
(n - 2), x], x] - Simp[b^2*d*m*(c + d*x)^(m - 1)*((b*Csc[e + f*x])^(n - 2)/(f^2*(n - 1)*(n - 2))), x]) /; Free
Q[{b, c, d, e, f}, x] && GtQ[n, 1] && NeQ[n, 2] && GtQ[m, 1]
Rule 5563
Int[((c_.) + (d_.)*(x_))^(m_.)*Sech[(a_.) + (b_.)*(x_)]*Tanh[(a_.) + (b_.)*(x_)]^(p_), x_Symbol] :> Int[(c + d
*x)^m*Sech[a + b*x]*Tanh[a + b*x]^(p - 2), x] - Int[(c + d*x)^m*Sech[a + b*x]^3*Tanh[a + b*x]^(p - 2), x] /; F
reeQ[{a, b, c, d, m}, x] && IGtQ[p/2, 0]
Rule 6724
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[PolyLog[n + 1, c*(a
+ b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d, e, n, p}, x] && EqQ[b*d, a*e]
Rubi steps \begin{align*}
\text {integral}& = \int x^2 \text {sech}(a+b x) \, dx-\int x^2 \text {sech}^3(a+b x) \, dx \\ & = \frac {2 x^2 \arctan \left (e^{a+b x}\right )}{b}-\frac {x \text {sech}(a+b x)}{b^2}-\frac {x^2 \text {sech}(a+b x) \tanh (a+b x)}{2 b}-\frac {1}{2} \int x^2 \text {sech}(a+b x) \, dx+\frac {\int \text {sech}(a+b x) \, dx}{b^2}-\frac {(2 i) \int x \log \left (1-i e^{a+b x}\right ) \, dx}{b}+\frac {(2 i) \int x \log \left (1+i e^{a+b x}\right ) \, dx}{b} \\ & = \frac {x^2 \arctan \left (e^{a+b x}\right )}{b}+\frac {\arctan (\sinh (a+b x))}{b^3}-\frac {2 i x \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b^2}+\frac {2 i x \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b^2}-\frac {x \text {sech}(a+b x)}{b^2}-\frac {x^2 \text {sech}(a+b x) \tanh (a+b x)}{2 b}+\frac {(2 i) \int \operatorname {PolyLog}\left (2,-i e^{a+b x}\right ) \, dx}{b^2}-\frac {(2 i) \int \operatorname {PolyLog}\left (2,i e^{a+b x}\right ) \, dx}{b^2}+\frac {i \int x \log \left (1-i e^{a+b x}\right ) \, dx}{b}-\frac {i \int x \log \left (1+i e^{a+b x}\right ) \, dx}{b} \\ & = \frac {x^2 \arctan \left (e^{a+b x}\right )}{b}+\frac {\arctan (\sinh (a+b x))}{b^3}-\frac {i x \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b^2}+\frac {i x \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b^2}-\frac {x \text {sech}(a+b x)}{b^2}-\frac {x^2 \text {sech}(a+b x) \tanh (a+b x)}{2 b}+\frac {(2 i) \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,-i x)}{x} \, dx,x,e^{a+b x}\right )}{b^3}-\frac {(2 i) \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,i x)}{x} \, dx,x,e^{a+b x}\right )}{b^3}-\frac {i \int \operatorname {PolyLog}\left (2,-i e^{a+b x}\right ) \, dx}{b^2}+\frac {i \int \operatorname {PolyLog}\left (2,i e^{a+b x}\right ) \, dx}{b^2} \\ & = \frac {x^2 \arctan \left (e^{a+b x}\right )}{b}+\frac {\arctan (\sinh (a+b x))}{b^3}-\frac {i x \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b^2}+\frac {i x \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b^2}+\frac {2 i \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )}{b^3}-\frac {2 i \operatorname {PolyLog}\left (3,i e^{a+b x}\right )}{b^3}-\frac {x \text {sech}(a+b x)}{b^2}-\frac {x^2 \text {sech}(a+b x) \tanh (a+b x)}{2 b}-\frac {i \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,-i x)}{x} \, dx,x,e^{a+b x}\right )}{b^3}+\frac {i \text {Subst}\left (\int \frac {\operatorname {PolyLog}(2,i x)}{x} \, dx,x,e^{a+b x}\right )}{b^3} \\ & = \frac {x^2 \arctan \left (e^{a+b x}\right )}{b}+\frac {\arctan (\sinh (a+b x))}{b^3}-\frac {i x \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b^2}+\frac {i x \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b^2}+\frac {i \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )}{b^3}-\frac {i \operatorname {PolyLog}\left (3,i e^{a+b x}\right )}{b^3}-\frac {x \text {sech}(a+b x)}{b^2}-\frac {x^2 \text {sech}(a+b x) \tanh (a+b x)}{2 b} \\
\end{align*}
Mathematica [A] (verified)
Time = 0.59 (sec) , antiderivative size = 180, normalized size of antiderivative = 1.26
\[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\frac {i \left (-4 i \arctan \left (e^{a+b x}\right )+b^2 x^2 \log \left (1-i e^{a+b x}\right )-b^2 x^2 \log \left (1+i e^{a+b x}\right )-2 b x \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )+2 b x \operatorname {PolyLog}\left (2,i e^{a+b x}\right )+2 \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )-2 \operatorname {PolyLog}\left (3,i e^{a+b x}\right )\right )}{2 b^3}-\frac {x \text {sech}(a) \text {sech}(a+b x) (2 \cosh (a)+b x \sinh (a))}{2 b^2}-\frac {x^2 \text {sech}(a) \text {sech}^2(a+b x) \sinh (b x)}{2 b}
\]
[In]
Integrate[x^2*Sech[a + b*x]*Tanh[a + b*x]^2,x]
[Out]
((I/2)*((-4*I)*ArcTan[E^(a + b*x)] + b^2*x^2*Log[1 - I*E^(a + b*x)] - b^2*x^2*Log[1 + I*E^(a + b*x)] - 2*b*x*P
olyLog[2, (-I)*E^(a + b*x)] + 2*b*x*PolyLog[2, I*E^(a + b*x)] + 2*PolyLog[3, (-I)*E^(a + b*x)] - 2*PolyLog[3,
I*E^(a + b*x)]))/b^3 - (x*Sech[a]*Sech[a + b*x]*(2*Cosh[a] + b*x*Sinh[a]))/(2*b^2) - (x^2*Sech[a]*Sech[a + b*x
]^2*Sinh[b*x])/(2*b)
Maple [F]
\[\int x^{2} \operatorname {sech}\left (b x +a \right )^{3} \sinh \left (b x +a \right )^{2}d x\]
[In]
int(x^2*sech(b*x+a)^3*sinh(b*x+a)^2,x)
[Out]
int(x^2*sech(b*x+a)^3*sinh(b*x+a)^2,x)
Fricas [B] (verification not implemented)
Both result and optimal contain complex but leaf count of result is larger than twice the leaf
count of optimal. 1577 vs. \(2 (118) = 236\).
Time = 0.29 (sec) , antiderivative size = 1577, normalized size of antiderivative = 11.03
\[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\text {Too large to display}
\]
[In]
integrate(x^2*sech(b*x+a)^3*sinh(b*x+a)^2,x, algorithm="fricas")
[Out]
-1/2*(2*(b^2*x^2 + 2*b*x)*cosh(b*x + a)^3 + 6*(b^2*x^2 + 2*b*x)*cosh(b*x + a)*sinh(b*x + a)^2 + 2*(b^2*x^2 + 2
*b*x)*sinh(b*x + a)^3 - 2*(b^2*x^2 - 2*b*x)*cosh(b*x + a) + 2*(-I*b*x*cosh(b*x + a)^4 - 4*I*b*x*cosh(b*x + a)*
sinh(b*x + a)^3 - I*b*x*sinh(b*x + a)^4 - 2*I*b*x*cosh(b*x + a)^2 + 2*(-3*I*b*x*cosh(b*x + a)^2 - I*b*x)*sinh(
b*x + a)^2 - I*b*x + 4*(-I*b*x*cosh(b*x + a)^3 - I*b*x*cosh(b*x + a))*sinh(b*x + a))*dilog(I*cosh(b*x + a) + I
*sinh(b*x + a)) + 2*(I*b*x*cosh(b*x + a)^4 + 4*I*b*x*cosh(b*x + a)*sinh(b*x + a)^3 + I*b*x*sinh(b*x + a)^4 + 2
*I*b*x*cosh(b*x + a)^2 + 2*(3*I*b*x*cosh(b*x + a)^2 + I*b*x)*sinh(b*x + a)^2 + I*b*x + 4*(I*b*x*cosh(b*x + a)^
3 + I*b*x*cosh(b*x + a))*sinh(b*x + a))*dilog(-I*cosh(b*x + a) - I*sinh(b*x + a)) - ((I*a^2 + 2*I)*cosh(b*x +
a)^4 - 4*(-I*a^2 - 2*I)*cosh(b*x + a)*sinh(b*x + a)^3 + (I*a^2 + 2*I)*sinh(b*x + a)^4 - 2*(-I*a^2 - 2*I)*cosh(
b*x + a)^2 - 2*(3*(-I*a^2 - 2*I)*cosh(b*x + a)^2 - I*a^2 - 2*I)*sinh(b*x + a)^2 + I*a^2 - 4*((-I*a^2 - 2*I)*co
sh(b*x + a)^3 + (-I*a^2 - 2*I)*cosh(b*x + a))*sinh(b*x + a) + 2*I)*log(cosh(b*x + a) + sinh(b*x + a) + I) - ((
-I*a^2 - 2*I)*cosh(b*x + a)^4 - 4*(I*a^2 + 2*I)*cosh(b*x + a)*sinh(b*x + a)^3 + (-I*a^2 - 2*I)*sinh(b*x + a)^4
- 2*(I*a^2 + 2*I)*cosh(b*x + a)^2 - 2*(3*(I*a^2 + 2*I)*cosh(b*x + a)^2 + I*a^2 + 2*I)*sinh(b*x + a)^2 - I*a^2
- 4*((I*a^2 + 2*I)*cosh(b*x + a)^3 + (I*a^2 + 2*I)*cosh(b*x + a))*sinh(b*x + a) - 2*I)*log(cosh(b*x + a) + si
nh(b*x + a) - I) - ((-I*b^2*x^2 + I*a^2)*cosh(b*x + a)^4 - 4*(I*b^2*x^2 - I*a^2)*cosh(b*x + a)*sinh(b*x + a)^3
+ (-I*b^2*x^2 + I*a^2)*sinh(b*x + a)^4 - I*b^2*x^2 - 2*(I*b^2*x^2 - I*a^2)*cosh(b*x + a)^2 - 2*(I*b^2*x^2 + 3
*(I*b^2*x^2 - I*a^2)*cosh(b*x + a)^2 - I*a^2)*sinh(b*x + a)^2 + I*a^2 - 4*((I*b^2*x^2 - I*a^2)*cosh(b*x + a)^3
+ (I*b^2*x^2 - I*a^2)*cosh(b*x + a))*sinh(b*x + a))*log(I*cosh(b*x + a) + I*sinh(b*x + a) + 1) - ((I*b^2*x^2
- I*a^2)*cosh(b*x + a)^4 - 4*(-I*b^2*x^2 + I*a^2)*cosh(b*x + a)*sinh(b*x + a)^3 + (I*b^2*x^2 - I*a^2)*sinh(b*x
+ a)^4 + I*b^2*x^2 - 2*(-I*b^2*x^2 + I*a^2)*cosh(b*x + a)^2 - 2*(-I*b^2*x^2 + 3*(-I*b^2*x^2 + I*a^2)*cosh(b*x
+ a)^2 + I*a^2)*sinh(b*x + a)^2 - I*a^2 - 4*((-I*b^2*x^2 + I*a^2)*cosh(b*x + a)^3 + (-I*b^2*x^2 + I*a^2)*cosh
(b*x + a))*sinh(b*x + a))*log(-I*cosh(b*x + a) - I*sinh(b*x + a) + 1) + 2*(I*cosh(b*x + a)^4 + 4*I*cosh(b*x +
a)*sinh(b*x + a)^3 + I*sinh(b*x + a)^4 + 2*(3*I*cosh(b*x + a)^2 + I)*sinh(b*x + a)^2 + 2*I*cosh(b*x + a)^2 + 4
*(I*cosh(b*x + a)^3 + I*cosh(b*x + a))*sinh(b*x + a) + I)*polylog(3, I*cosh(b*x + a) + I*sinh(b*x + a)) + 2*(-
I*cosh(b*x + a)^4 - 4*I*cosh(b*x + a)*sinh(b*x + a)^3 - I*sinh(b*x + a)^4 + 2*(-3*I*cosh(b*x + a)^2 - I)*sinh(
b*x + a)^2 - 2*I*cosh(b*x + a)^2 + 4*(-I*cosh(b*x + a)^3 - I*cosh(b*x + a))*sinh(b*x + a) - I)*polylog(3, -I*c
osh(b*x + a) - I*sinh(b*x + a)) - 2*(b^2*x^2 - 3*(b^2*x^2 + 2*b*x)*cosh(b*x + a)^2 - 2*b*x)*sinh(b*x + a))/(b^
3*cosh(b*x + a)^4 + 4*b^3*cosh(b*x + a)*sinh(b*x + a)^3 + b^3*sinh(b*x + a)^4 + 2*b^3*cosh(b*x + a)^2 + b^3 +
2*(3*b^3*cosh(b*x + a)^2 + b^3)*sinh(b*x + a)^2 + 4*(b^3*cosh(b*x + a)^3 + b^3*cosh(b*x + a))*sinh(b*x + a))
Sympy [F]
\[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\int x^{2} \sinh ^{2}{\left (a + b x \right )} \operatorname {sech}^{3}{\left (a + b x \right )}\, dx
\]
[In]
integrate(x**2*sech(b*x+a)**3*sinh(b*x+a)**2,x)
[Out]
Integral(x**2*sinh(a + b*x)**2*sech(a + b*x)**3, x)
Maxima [F]
\[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\int { x^{2} \operatorname {sech}\left (b x + a\right )^{3} \sinh \left (b x + a\right )^{2} \,d x }
\]
[In]
integrate(x^2*sech(b*x+a)^3*sinh(b*x+a)^2,x, algorithm="maxima")
[Out]
2*b^2*integrate(1/2*x^2*e^(b*x + a)/(b^2*e^(2*b*x + 2*a) + b^2), x) - ((b*x^2*e^(3*a) + 2*x*e^(3*a))*e^(3*b*x)
- (b*x^2*e^a - 2*x*e^a)*e^(b*x))/(b^2*e^(4*b*x + 4*a) + 2*b^2*e^(2*b*x + 2*a) + b^2) + 2*arctan(e^(b*x + a))/
b^3
Giac [F]
\[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\int { x^{2} \operatorname {sech}\left (b x + a\right )^{3} \sinh \left (b x + a\right )^{2} \,d x }
\]
[In]
integrate(x^2*sech(b*x+a)^3*sinh(b*x+a)^2,x, algorithm="giac")
[Out]
integrate(x^2*sech(b*x + a)^3*sinh(b*x + a)^2, x)
Mupad [F(-1)]
Timed out. \[
\int x^2 \text {sech}(a+b x) \tanh ^2(a+b x) \, dx=\int \frac {x^2\,{\mathrm {sinh}\left (a+b\,x\right )}^2}{{\mathrm {cosh}\left (a+b\,x\right )}^3} \,d x
\]
[In]
int((x^2*sinh(a + b*x)^2)/cosh(a + b*x)^3,x)
[Out]
int((x^2*sinh(a + b*x)^2)/cosh(a + b*x)^3, x)