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

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

Optimal result

Integrand size = 14, antiderivative size = 119 \[ \int (c+d x)^2 \text {sech}(a+b x) \, dx=\frac {2 (c+d x)^2 \arctan \left (e^{a+b x}\right )}{b}-\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b^2}+\frac {2 i d (c+d x) \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b^2}+\frac {2 i d^2 \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )}{b^3}-\frac {2 i d^2 \operatorname {PolyLog}\left (3,i e^{a+b x}\right )}{b^3} \] Output:

2*(d*x+c)^2*arctan(exp(b*x+a))/b-2*I*d*(d*x+c)*polylog(2,-I*exp(b*x+a))/b^ 
2+2*I*d*(d*x+c)*polylog(2,I*exp(b*x+a))/b^2+2*I*d^2*polylog(3,-I*exp(b*x+a 
))/b^3-2*I*d^2*polylog(3,I*exp(b*x+a))/b^3
 

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.67 \[ \int (c+d x)^2 \text {sech}(a+b x) \, dx=\frac {i \left (-2 i b^2 c^2 \arctan \left (e^{a+b x}\right )+2 b^2 c d x \log \left (1-i e^{a+b x}\right )+b^2 d^2 x^2 \log \left (1-i e^{a+b x}\right )-2 b^2 c d x \log \left (1+i e^{a+b x}\right )-b^2 d^2 x^2 \log \left (1+i e^{a+b x}\right )-2 b d (c+d x) \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )+2 b d (c+d x) \operatorname {PolyLog}\left (2,i e^{a+b x}\right )+2 d^2 \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )-2 d^2 \operatorname {PolyLog}\left (3,i e^{a+b x}\right )\right )}{b^3} \] Input:

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

Output:

(I*((-2*I)*b^2*c^2*ArcTan[E^(a + b*x)] + 2*b^2*c*d*x*Log[1 - I*E^(a + b*x) 
] + b^2*d^2*x^2*Log[1 - I*E^(a + b*x)] - 2*b^2*c*d*x*Log[1 + I*E^(a + b*x) 
] - b^2*d^2*x^2*Log[1 + I*E^(a + b*x)] - 2*b*d*(c + d*x)*PolyLog[2, (-I)*E 
^(a + b*x)] + 2*b*d*(c + d*x)*PolyLog[2, I*E^(a + b*x)] + 2*d^2*PolyLog[3, 
 (-I)*E^(a + b*x)] - 2*d^2*PolyLog[3, I*E^(a + b*x)]))/b^3
 

Rubi [A] (verified)

Time = 0.83 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.02, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {3042, 4668, 3011, 2720, 7143}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4668

\(\displaystyle -\frac {2 i d \int (c+d x) \log \left (1-i e^{a+b x}\right )dx}{b}+\frac {2 i d \int (c+d x) \log \left (1+i e^{a+b x}\right )dx}{b}+\frac {2 (c+d x)^2 \arctan \left (e^{a+b x}\right )}{b}\)

\(\Big \downarrow \) 3011

\(\displaystyle \frac {2 i d \left (\frac {d \int \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )dx}{b}-\frac {(c+d x) \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b}\right )}{b}-\frac {2 i d \left (\frac {d \int \operatorname {PolyLog}\left (2,i e^{a+b x}\right )dx}{b}-\frac {(c+d x) \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b}\right )}{b}+\frac {2 (c+d x)^2 \arctan \left (e^{a+b x}\right )}{b}\)

\(\Big \downarrow \) 2720

\(\displaystyle \frac {2 i d \left (\frac {d \int e^{-a-b x} \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )de^{a+b x}}{b^2}-\frac {(c+d x) \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b}\right )}{b}-\frac {2 i d \left (\frac {d \int e^{-a-b x} \operatorname {PolyLog}\left (2,i e^{a+b x}\right )de^{a+b x}}{b^2}-\frac {(c+d x) \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b}\right )}{b}+\frac {2 (c+d x)^2 \arctan \left (e^{a+b x}\right )}{b}\)

\(\Big \downarrow \) 7143

\(\displaystyle \frac {2 (c+d x)^2 \arctan \left (e^{a+b x}\right )}{b}+\frac {2 i d \left (\frac {d \operatorname {PolyLog}\left (3,-i e^{a+b x}\right )}{b^2}-\frac {(c+d x) \operatorname {PolyLog}\left (2,-i e^{a+b x}\right )}{b}\right )}{b}-\frac {2 i d \left (\frac {d \operatorname {PolyLog}\left (3,i e^{a+b x}\right )}{b^2}-\frac {(c+d x) \operatorname {PolyLog}\left (2,i e^{a+b x}\right )}{b}\right )}{b}\)

Input:

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

Output:

(2*(c + d*x)^2*ArcTan[E^(a + b*x)])/b + ((2*I)*d*(-(((c + d*x)*PolyLog[2, 
(-I)*E^(a + b*x)])/b) + (d*PolyLog[3, (-I)*E^(a + b*x)])/b^2))/b - ((2*I)* 
d*(-(((c + d*x)*PolyLog[2, I*E^(a + b*x)])/b) + (d*PolyLog[3, I*E^(a + b*x 
)])/b^2))/b
 

Defintions of rubi rules used

rule 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{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 3011
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] + Simp[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 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4668
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] + (-Simp[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] + Simp[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 7143
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S 
ymbol] :> 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]
 
Maple [F]

\[\int \left (d x +c \right )^{2} \operatorname {sech}\left (b x +a \right )d x\]

Input:

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

Output:

int((d*x+c)^2*sech(b*x+a),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. 305 vs. \(2 (96) = 192\).

Time = 0.09 (sec) , antiderivative size = 305, normalized size of antiderivative = 2.56 \[ \int (c+d x)^2 \text {sech}(a+b x) \, dx=\frac {-2 i \, d^{2} {\rm polylog}\left (3, i \, \cosh \left (b x + a\right ) + i \, \sinh \left (b x + a\right )\right ) + 2 i \, d^{2} {\rm polylog}\left (3, -i \, \cosh \left (b x + a\right ) - i \, \sinh \left (b x + a\right )\right ) - 2 \, {\left (-i \, b d^{2} x - i \, b c d\right )} {\rm Li}_2\left (i \, \cosh \left (b x + a\right ) + i \, \sinh \left (b x + a\right )\right ) - 2 \, {\left (i \, b d^{2} x + i \, b c d\right )} {\rm Li}_2\left (-i \, \cosh \left (b x + a\right ) - i \, \sinh \left (b x + a\right )\right ) + {\left (i \, b^{2} c^{2} - 2 i \, a b c d + i \, a^{2} d^{2}\right )} \log \left (\cosh \left (b x + a\right ) + \sinh \left (b x + a\right ) + i\right ) + {\left (-i \, b^{2} c^{2} + 2 i \, a b c d - i \, a^{2} d^{2}\right )} \log \left (\cosh \left (b x + a\right ) + \sinh \left (b x + a\right ) - i\right ) + {\left (-i \, b^{2} d^{2} x^{2} - 2 i \, b^{2} c d x - 2 i \, a b c d + i \, a^{2} d^{2}\right )} \log \left (i \, \cosh \left (b x + a\right ) + i \, \sinh \left (b x + a\right ) + 1\right ) + {\left (i \, b^{2} d^{2} x^{2} + 2 i \, b^{2} c d x + 2 i \, a b c d - i \, a^{2} d^{2}\right )} \log \left (-i \, \cosh \left (b x + a\right ) - i \, \sinh \left (b x + a\right ) + 1\right )}{b^{3}} \] Input:

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

Output:

(-2*I*d^2*polylog(3, I*cosh(b*x + a) + I*sinh(b*x + a)) + 2*I*d^2*polylog( 
3, -I*cosh(b*x + a) - I*sinh(b*x + a)) - 2*(-I*b*d^2*x - I*b*c*d)*dilog(I* 
cosh(b*x + a) + I*sinh(b*x + a)) - 2*(I*b*d^2*x + I*b*c*d)*dilog(-I*cosh(b 
*x + a) - I*sinh(b*x + a)) + (I*b^2*c^2 - 2*I*a*b*c*d + I*a^2*d^2)*log(cos 
h(b*x + a) + sinh(b*x + a) + I) + (-I*b^2*c^2 + 2*I*a*b*c*d - I*a^2*d^2)*l 
og(cosh(b*x + a) + sinh(b*x + a) - I) + (-I*b^2*d^2*x^2 - 2*I*b^2*c*d*x - 
2*I*a*b*c*d + I*a^2*d^2)*log(I*cosh(b*x + a) + I*sinh(b*x + a) + 1) + (I*b 
^2*d^2*x^2 + 2*I*b^2*c*d*x + 2*I*a*b*c*d - I*a^2*d^2)*log(-I*cosh(b*x + a) 
 - I*sinh(b*x + a) + 1))/b^3
 

Sympy [F]

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

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

(2*atan(e**(a + b*x))*c**2 + int(sech(a + b*x)*x**2,x)*b*d**2 + 2*int(sech 
(a + b*x)*x,x)*b*c*d)/b