\(\int x^2 \coth ^2(a+b x) \, dx\) [7]

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

Optimal result

Integrand size = 12, antiderivative size = 65 \[ \int x^2 \coth ^2(a+b x) \, dx=-\frac {x^2}{b}+\frac {x^3}{3}-\frac {x^2 \coth (a+b x)}{b}+\frac {2 x \log \left (1-e^{2 (a+b x)}\right )}{b^2}+\frac {\operatorname {PolyLog}\left (2,e^{2 (a+b x)}\right )}{b^3} \] Output:

-x^2/b+1/3*x^3-x^2*coth(b*x+a)/b+2*x*ln(1-exp(2*b*x+2*a))/b^2+polylog(2,ex 
p(2*b*x+2*a))/b^3
 

Mathematica [A] (verified)

Time = 0.96 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.80 \[ \int x^2 \coth ^2(a+b x) \, dx=-\frac {2 \operatorname {PolyLog}\left (2,-e^{-a-b x}\right )}{b^3}-\frac {2 \operatorname {PolyLog}\left (2,e^{-a-b x}\right )}{b^3}+\frac {1}{3} x \left (\frac {6 x}{b-b e^{2 a}}+x^2+\frac {6 \log \left (1-e^{-a-b x}\right )}{b^2}+\frac {6 \log \left (1+e^{-a-b x}\right )}{b^2}+\frac {3 x \text {csch}(a) \text {csch}(a+b x) \sinh (b x)}{b}\right ) \] Input:

Integrate[x^2*Coth[a + b*x]^2,x]
 

Output:

(-2*PolyLog[2, -E^(-a - b*x)])/b^3 - (2*PolyLog[2, E^(-a - b*x)])/b^3 + (x 
*((6*x)/(b - b*E^(2*a)) + x^2 + (6*Log[1 - E^(-a - b*x)])/b^2 + (6*Log[1 + 
 E^(-a - b*x)])/b^2 + (3*x*Csch[a]*Csch[a + b*x]*Sinh[b*x])/b))/3
 

Rubi [C] (verified)

Result contains complex when optimal does not.

Time = 0.73 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.48, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.917, Rules used = {3042, 25, 4203, 15, 26, 3042, 26, 4201, 2620, 2715, 2838}

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 x^2 \coth ^2(a+b x) \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 4203

\(\displaystyle -\frac {2 i \int i x \coth (a+b x)dx}{b}+\int x^2dx-\frac {x^2 \coth (a+b x)}{b}\)

\(\Big \downarrow \) 15

\(\displaystyle -\frac {2 i \int i x \coth (a+b x)dx}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

\(\Big \downarrow \) 26

\(\displaystyle \frac {2 \int x \coth (a+b x)dx}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {2 \int -i x \tan \left (i a+i b x+\frac {\pi }{2}\right )dx}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

\(\Big \downarrow \) 26

\(\displaystyle -\frac {2 i \int x \tan \left (\frac {1}{2} (2 i a+\pi )+i b x\right )dx}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

\(\Big \downarrow \) 4201

\(\displaystyle -\frac {2 i \left (2 i \int \frac {e^{2 a+2 b x-i \pi } x}{1+e^{2 a+2 b x-i \pi }}dx-\frac {i x^2}{2}\right )}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

\(\Big \downarrow \) 2620

\(\displaystyle -\frac {2 i \left (2 i \left (\frac {x \log \left (1+e^{2 a+2 b x-i \pi }\right )}{2 b}-\frac {\int \log \left (1+e^{2 a+2 b x-i \pi }\right )dx}{2 b}\right )-\frac {i x^2}{2}\right )}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

\(\Big \downarrow \) 2715

\(\displaystyle -\frac {2 i \left (2 i \left (\frac {x \log \left (1+e^{2 a+2 b x-i \pi }\right )}{2 b}-\frac {\int e^{-2 a-2 b x+i \pi } \log \left (1+e^{2 a+2 b x-i \pi }\right )de^{2 a+2 b x-i \pi }}{4 b^2}\right )-\frac {i x^2}{2}\right )}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

\(\Big \downarrow \) 2838

\(\displaystyle -\frac {2 i \left (2 i \left (\frac {\operatorname {PolyLog}\left (2,-e^{2 a+2 b x-i \pi }\right )}{4 b^2}+\frac {x \log \left (1+e^{2 a+2 b x-i \pi }\right )}{2 b}\right )-\frac {i x^2}{2}\right )}{b}-\frac {x^2 \coth (a+b x)}{b}+\frac {x^3}{3}\)

Input:

Int[x^2*Coth[a + b*x]^2,x]
 

Output:

x^3/3 - (x^2*Coth[a + b*x])/b - ((2*I)*((-1/2*I)*x^2 + (2*I)*((x*Log[1 + E 
^(2*a - I*Pi + 2*b*x)])/(2*b) + PolyLog[2, -E^(2*a - I*Pi + 2*b*x)]/(4*b^2 
))))/b
 

Defintions of rubi rules used

rule 15
Int[(a_.)*(x_)^(m_.), x_Symbol] :> Simp[a*(x^(m + 1)/(m + 1)), x] /; FreeQ[ 
{a, m}, x] && NeQ[m, -1]
 

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

rule 26
Int[(Complex[0, a_])*(Fx_), x_Symbol] :> Simp[(Complex[Identity[0], a])   I 
nt[Fx, x], x] /; FreeQ[a, x] && EqQ[a^2, 1]
 

rule 2620
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ 
((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp 
[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si 
mp[d*(m/(b*f*g*n*Log[F]))   Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x 
)))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
 

rule 2715
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] 
:> Simp[1/(d*e*n*Log[F])   Subst[Int[Log[a + b*x]/x, x], x, (F^(e*(c + d*x) 
))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]
 

rule 2838
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 
, (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
 

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

rule 4201
Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (Complex[0, fz_])*(f_.)*(x_)], x 
_Symbol] :> Simp[(-I)*((c + d*x)^(m + 1)/(d*(m + 1))), x] + Simp[2*I   Int[ 
(c + d*x)^m*(E^(2*((-I)*e + f*fz*x))/(1 + E^(2*((-I)*e + f*fz*x)))), x], x] 
 /; FreeQ[{c, d, e, f, fz}, x] && IGtQ[m, 0]
 

rule 4203
Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symb 
ol] :> Simp[b*(c + d*x)^m*((b*Tan[e + f*x])^(n - 1)/(f*(n - 1))), x] + (-Si 
mp[b*d*(m/(f*(n - 1)))   Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1), x] 
, x] - Simp[b^2   Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; Free 
Q[{b, c, d, e, f}, x] && GtQ[n, 1] && GtQ[m, 0]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(155\) vs. \(2(63)=126\).

Time = 0.07 (sec) , antiderivative size = 156, normalized size of antiderivative = 2.40

method result size
risch \(\frac {x^{3}}{3}-\frac {2 x^{2}}{b \left ({\mathrm e}^{2 b x +2 a}-1\right )}-\frac {2 x^{2}}{b}-\frac {4 a x}{b^{2}}-\frac {2 a^{2}}{b^{3}}+\frac {2 \ln \left (1+{\mathrm e}^{b x +a}\right ) x}{b^{2}}+\frac {2 \operatorname {polylog}\left (2, -{\mathrm e}^{b x +a}\right )}{b^{3}}+\frac {2 \ln \left (1-{\mathrm e}^{b x +a}\right ) x}{b^{2}}+\frac {2 \ln \left (1-{\mathrm e}^{b x +a}\right ) a}{b^{3}}+\frac {2 \operatorname {polylog}\left (2, {\mathrm e}^{b x +a}\right )}{b^{3}}-\frac {2 a \ln \left ({\mathrm e}^{b x +a}-1\right )}{b^{3}}+\frac {4 a \ln \left ({\mathrm e}^{b x +a}\right )}{b^{3}}\) \(156\)

Input:

int(x^2*coth(b*x+a)^2,x,method=_RETURNVERBOSE)
 

Output:

1/3*x^3-2*x^2/b/(exp(2*b*x+2*a)-1)-2*x^2/b-4/b^2*a*x-2/b^3*a^2+2/b^2*ln(1+ 
exp(b*x+a))*x+2/b^3*polylog(2,-exp(b*x+a))+2/b^2*ln(1-exp(b*x+a))*x+2/b^3* 
ln(1-exp(b*x+a))*a+2/b^3*polylog(2,exp(b*x+a))-2/b^3*a*ln(exp(b*x+a)-1)+4/ 
b^3*a*ln(exp(b*x+a))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 453 vs. \(2 (62) = 124\).

Time = 0.10 (sec) , antiderivative size = 453, normalized size of antiderivative = 6.97 \[ \int x^2 \coth ^2(a+b x) \, dx=-\frac {b^{3} x^{3} - {\left (b^{3} x^{3} - 6 \, b^{2} x^{2} + 6 \, a^{2}\right )} \cosh \left (b x + a\right )^{2} - 2 \, {\left (b^{3} x^{3} - 6 \, b^{2} x^{2} + 6 \, a^{2}\right )} \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) - {\left (b^{3} x^{3} - 6 \, b^{2} x^{2} + 6 \, a^{2}\right )} \sinh \left (b x + a\right )^{2} + 6 \, a^{2} - 6 \, {\left (\cosh \left (b x + a\right )^{2} + 2 \, \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + \sinh \left (b x + a\right )^{2} - 1\right )} {\rm Li}_2\left (\cosh \left (b x + a\right ) + \sinh \left (b x + a\right )\right ) - 6 \, {\left (\cosh \left (b x + a\right )^{2} + 2 \, \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + \sinh \left (b x + a\right )^{2} - 1\right )} {\rm Li}_2\left (-\cosh \left (b x + a\right ) - \sinh \left (b x + a\right )\right ) - 6 \, {\left (b x \cosh \left (b x + a\right )^{2} + 2 \, b x \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + b x \sinh \left (b x + a\right )^{2} - b x\right )} \log \left (\cosh \left (b x + a\right ) + \sinh \left (b x + a\right ) + 1\right ) + 6 \, {\left (a \cosh \left (b x + a\right )^{2} + 2 \, a \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + a \sinh \left (b x + a\right )^{2} - a\right )} \log \left (\cosh \left (b x + a\right ) + \sinh \left (b x + a\right ) - 1\right ) - 6 \, {\left ({\left (b x + a\right )} \cosh \left (b x + a\right )^{2} + 2 \, {\left (b x + a\right )} \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + {\left (b x + a\right )} \sinh \left (b x + a\right )^{2} - b x - a\right )} \log \left (-\cosh \left (b x + a\right ) - \sinh \left (b x + a\right ) + 1\right )}{3 \, {\left (b^{3} \cosh \left (b x + a\right )^{2} + 2 \, b^{3} \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + b^{3} \sinh \left (b x + a\right )^{2} - b^{3}\right )}} \] Input:

integrate(x^2*coth(b*x+a)^2,x, algorithm="fricas")
 

Output:

-1/3*(b^3*x^3 - (b^3*x^3 - 6*b^2*x^2 + 6*a^2)*cosh(b*x + a)^2 - 2*(b^3*x^3 
 - 6*b^2*x^2 + 6*a^2)*cosh(b*x + a)*sinh(b*x + a) - (b^3*x^3 - 6*b^2*x^2 + 
 6*a^2)*sinh(b*x + a)^2 + 6*a^2 - 6*(cosh(b*x + a)^2 + 2*cosh(b*x + a)*sin 
h(b*x + a) + sinh(b*x + a)^2 - 1)*dilog(cosh(b*x + a) + sinh(b*x + a)) - 6 
*(cosh(b*x + a)^2 + 2*cosh(b*x + a)*sinh(b*x + a) + sinh(b*x + a)^2 - 1)*d 
ilog(-cosh(b*x + a) - sinh(b*x + a)) - 6*(b*x*cosh(b*x + a)^2 + 2*b*x*cosh 
(b*x + a)*sinh(b*x + a) + b*x*sinh(b*x + a)^2 - b*x)*log(cosh(b*x + a) + s 
inh(b*x + a) + 1) + 6*(a*cosh(b*x + a)^2 + 2*a*cosh(b*x + a)*sinh(b*x + a) 
 + a*sinh(b*x + a)^2 - a)*log(cosh(b*x + a) + sinh(b*x + a) - 1) - 6*((b*x 
 + a)*cosh(b*x + a)^2 + 2*(b*x + a)*cosh(b*x + a)*sinh(b*x + a) + (b*x + a 
)*sinh(b*x + a)^2 - b*x - a)*log(-cosh(b*x + a) - sinh(b*x + a) + 1))/(b^3 
*cosh(b*x + a)^2 + 2*b^3*cosh(b*x + a)*sinh(b*x + a) + b^3*sinh(b*x + a)^2 
 - b^3)
 

Sympy [F]

\[ \int x^2 \coth ^2(a+b x) \, dx=\int x^{2} \coth ^{2}{\left (a + b x \right )}\, dx \] Input:

integrate(x**2*coth(b*x+a)**2,x)
 

Output:

Integral(x**2*coth(a + b*x)**2, x)
                                                                                    
                                                                                    
 

Maxima [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.66 \[ \int x^2 \coth ^2(a+b x) \, dx=-\frac {2 \, x^{2}}{b} + \frac {b x^{3} e^{\left (2 \, b x + 2 \, a\right )} - b x^{3} - 6 \, x^{2}}{3 \, {\left (b e^{\left (2 \, b x + 2 \, a\right )} - b\right )}} + \frac {2 \, {\left (b x \log \left (e^{\left (b x + a\right )} + 1\right ) + {\rm Li}_2\left (-e^{\left (b x + a\right )}\right )\right )}}{b^{3}} + \frac {2 \, {\left (b x \log \left (-e^{\left (b x + a\right )} + 1\right ) + {\rm Li}_2\left (e^{\left (b x + a\right )}\right )\right )}}{b^{3}} \] Input:

integrate(x^2*coth(b*x+a)^2,x, algorithm="maxima")
 

Output:

-2*x^2/b + 1/3*(b*x^3*e^(2*b*x + 2*a) - b*x^3 - 6*x^2)/(b*e^(2*b*x + 2*a) 
- b) + 2*(b*x*log(e^(b*x + a) + 1) + dilog(-e^(b*x + a)))/b^3 + 2*(b*x*log 
(-e^(b*x + a) + 1) + dilog(e^(b*x + a)))/b^3
 

Giac [F]

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

integrate(x^2*coth(b*x+a)^2,x, algorithm="giac")
 

Output:

integrate(x^2*coth(b*x + a)^2, x)
 

Mupad [F(-1)]

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

int(x^2*coth(a + b*x)^2,x)
 

Output:

int(x^2*coth(a + b*x)^2, x)
 

Reduce [F]

\[ \int x^2 \coth ^2(a+b x) \, dx=\frac {-12 e^{2 b x +2 a} \left (\int \frac {x}{e^{4 b x +4 a}-2 e^{2 b x +2 a}+1}d x \right ) b^{2}+3 e^{2 b x +2 a} \mathrm {log}\left (e^{b x +a}-1\right )+3 e^{2 b x +2 a} \mathrm {log}\left (e^{b x +a}+1\right )+e^{2 b x +2 a} b^{3} x^{3}-6 e^{2 b x +2 a} b x +12 \left (\int \frac {x}{e^{4 b x +4 a}-2 e^{2 b x +2 a}+1}d x \right ) b^{2}-3 \,\mathrm {log}\left (e^{b x +a}-1\right )-3 \,\mathrm {log}\left (e^{b x +a}+1\right )-b^{3} x^{3}-6 b^{2} x^{2}}{3 b^{3} \left (e^{2 b x +2 a}-1\right )} \] Input:

int(x^2*coth(b*x+a)^2,x)
 

Output:

( - 12*e**(2*a + 2*b*x)*int(x/(e**(4*a + 4*b*x) - 2*e**(2*a + 2*b*x) + 1), 
x)*b**2 + 3*e**(2*a + 2*b*x)*log(e**(a + b*x) - 1) + 3*e**(2*a + 2*b*x)*lo 
g(e**(a + b*x) + 1) + e**(2*a + 2*b*x)*b**3*x**3 - 6*e**(2*a + 2*b*x)*b*x 
+ 12*int(x/(e**(4*a + 4*b*x) - 2*e**(2*a + 2*b*x) + 1),x)*b**2 - 3*log(e** 
(a + b*x) - 1) - 3*log(e**(a + b*x) + 1) - b**3*x**3 - 6*b**2*x**2)/(3*b** 
3*(e**(2*a + 2*b*x) - 1))