\(\int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx\) [187]

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

Optimal result

Integrand size = 13, antiderivative size = 82 \[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=\frac {x^2 \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {2 x \coth ^{-1}(\tanh (a+b x))^{2+n}}{b^2 (1+n) (2+n)}+\frac {2 \coth ^{-1}(\tanh (a+b x))^{3+n}}{b^3 (1+n) (2+n) (3+n)} \]

[Out]

x^2*arccoth(tanh(b*x+a))^(1+n)/b/(1+n)-2*x*arccoth(tanh(b*x+a))^(2+n)/b^2/(1+n)/(2+n)+2*arccoth(tanh(b*x+a))^(
3+n)/b^3/(3+n)/(n^2+3*n+2)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {2199, 2188, 30} \[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=\frac {2 \coth ^{-1}(\tanh (a+b x))^{n+3}}{b^3 (n+1) (n+2) (n+3)}-\frac {2 x \coth ^{-1}(\tanh (a+b x))^{n+2}}{b^2 (n+1) (n+2)}+\frac {x^2 \coth ^{-1}(\tanh (a+b x))^{n+1}}{b (n+1)} \]

[In]

Int[x^2*ArcCoth[Tanh[a + b*x]]^n,x]

[Out]

(x^2*ArcCoth[Tanh[a + b*x]]^(1 + n))/(b*(1 + n)) - (2*x*ArcCoth[Tanh[a + b*x]]^(2 + n))/(b^2*(1 + n)*(2 + n))
+ (2*ArcCoth[Tanh[a + b*x]]^(3 + n))/(b^3*(1 + n)*(2 + n)*(3 + n))

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2188

Int[(u_)^(m_.), x_Symbol] :> With[{c = Simplify[D[u, x]]}, Dist[1/c, Subst[Int[x^m, x], x, u], x]] /; FreeQ[m,
 x] && PiecewiseLinearQ[u, x]

Rule 2199

Int[(u_)^(m_)*(v_)^(n_.), x_Symbol] :> With[{a = Simplify[D[u, x]], b = Simplify[D[v, x]]}, Simp[u^(m + 1)*(v^
n/(a*(m + 1))), x] - Dist[b*(n/(a*(m + 1))), Int[u^(m + 1)*v^(n - 1), x], x] /; NeQ[b*u - a*v, 0]] /; FreeQ[{m
, n}, x] && PiecewiseLinearQ[u, v, x] && NeQ[m, -1] && ((LtQ[m, -1] && GtQ[n, 0] &&  !(ILtQ[m + n, -2] && (Fra
ctionQ[m] || GeQ[2*n + m + 1, 0]))) || (IGtQ[n, 0] && IGtQ[m, 0] && LeQ[n, m]) || (IGtQ[n, 0] &&  !IntegerQ[m]
) || (ILtQ[m, 0] &&  !IntegerQ[n]))

Rubi steps \begin{align*} \text {integral}& = \frac {x^2 \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {2 \int x \coth ^{-1}(\tanh (a+b x))^{1+n} \, dx}{b (1+n)} \\ & = \frac {x^2 \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {2 x \coth ^{-1}(\tanh (a+b x))^{2+n}}{b^2 (1+n) (2+n)}+\frac {2 \int \coth ^{-1}(\tanh (a+b x))^{2+n} \, dx}{b^2 (1+n) (2+n)} \\ & = \frac {x^2 \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {2 x \coth ^{-1}(\tanh (a+b x))^{2+n}}{b^2 (1+n) (2+n)}+\frac {2 \text {Subst}\left (\int x^{2+n} \, dx,x,\coth ^{-1}(\tanh (a+b x))\right )}{b^3 (1+n) (2+n)} \\ & = \frac {x^2 \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {2 x \coth ^{-1}(\tanh (a+b x))^{2+n}}{b^2 (1+n) (2+n)}+\frac {2 \coth ^{-1}(\tanh (a+b x))^{3+n}}{b^3 (1+n) (2+n) (3+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 71, normalized size of antiderivative = 0.87 \[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=\frac {\coth ^{-1}(\tanh (a+b x))^{1+n} \left (b^2 \left (6+5 n+n^2\right ) x^2-2 b (3+n) x \coth ^{-1}(\tanh (a+b x))+2 \coth ^{-1}(\tanh (a+b x))^2\right )}{b^3 (1+n) (2+n) (3+n)} \]

[In]

Integrate[x^2*ArcCoth[Tanh[a + b*x]]^n,x]

[Out]

(ArcCoth[Tanh[a + b*x]]^(1 + n)*(b^2*(6 + 5*n + n^2)*x^2 - 2*b*(3 + n)*x*ArcCoth[Tanh[a + b*x]] + 2*ArcCoth[Ta
nh[a + b*x]]^2))/(b^3*(1 + n)*(2 + n)*(3 + n))

Maple [A] (verified)

Time = 9.52 (sec) , antiderivative size = 163, normalized size of antiderivative = 1.99

method result size
parallelrisch \(-\frac {-2 \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{3}-6 \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} x^{2} \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right ) b^{2}+6 \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{2} x b -x^{2} \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right ) \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} b^{2} n^{2}-5 x^{2} \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right ) \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} b^{2} n +2 x \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{2} \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} b n}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}\) \(163\)
risch \(\text {Expression too large to display}\) \(25561\)

[In]

int(x^2*arccoth(tanh(b*x+a))^n,x,method=_RETURNVERBOSE)

[Out]

-(-2*arccoth(tanh(b*x+a))^n*arccoth(tanh(b*x+a))^3-6*arccoth(tanh(b*x+a))^n*x^2*arccoth(tanh(b*x+a))*b^2+6*arc
coth(tanh(b*x+a))^n*arccoth(tanh(b*x+a))^2*x*b-x^2*arccoth(tanh(b*x+a))*arccoth(tanh(b*x+a))^n*b^2*n^2-5*x^2*a
rccoth(tanh(b*x+a))*arccoth(tanh(b*x+a))^n*b^2*n+2*x*arccoth(tanh(b*x+a))^2*arccoth(tanh(b*x+a))^n*b*n)/b^3/(n
^3+6*n^2+11*n+6)

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.26 (sec) , antiderivative size = 276, normalized size of antiderivative = 3.37 \[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=-\frac {{\left (8 \, a^{2} b n x - 4 \, {\left (b^{3} n^{2} + 3 \, b^{3} n + 2 \, b^{3}\right )} x^{3} + i \, \pi ^{3} - 2 \, \pi ^{2} {\left (b n x - 3 \, a\right )} - 8 \, a^{3} - 4 \, {\left (a b^{2} n^{2} + a b^{2} n\right )} x^{2} + 2 i \, \pi {\left (4 \, a b n x - {\left (b^{2} n^{2} + b^{2} n\right )} x^{2} - 6 \, a^{2}\right )}\right )} \cosh \left (n \log \left (\frac {1}{2} i \, \pi + b x + a\right )\right ) + {\left (8 \, a^{2} b n x - 4 \, {\left (b^{3} n^{2} + 3 \, b^{3} n + 2 \, b^{3}\right )} x^{3} + i \, \pi ^{3} - 2 \, \pi ^{2} {\left (b n x - 3 \, a\right )} - 8 \, a^{3} - 4 \, {\left (a b^{2} n^{2} + a b^{2} n\right )} x^{2} + 2 i \, \pi {\left (4 \, a b n x - {\left (b^{2} n^{2} + b^{2} n\right )} x^{2} - 6 \, a^{2}\right )}\right )} \sinh \left (n \log \left (\frac {1}{2} i \, \pi + b x + a\right )\right )}{4 \, {\left (b^{3} n^{3} + 6 \, b^{3} n^{2} + 11 \, b^{3} n + 6 \, b^{3}\right )}} \]

[In]

integrate(x^2*arccoth(tanh(b*x+a))^n,x, algorithm="fricas")

[Out]

-1/4*((8*a^2*b*n*x - 4*(b^3*n^2 + 3*b^3*n + 2*b^3)*x^3 + I*pi^3 - 2*pi^2*(b*n*x - 3*a) - 8*a^3 - 4*(a*b^2*n^2
+ a*b^2*n)*x^2 + 2*I*pi*(4*a*b*n*x - (b^2*n^2 + b^2*n)*x^2 - 6*a^2))*cosh(n*log(1/2*I*pi + b*x + a)) + (8*a^2*
b*n*x - 4*(b^3*n^2 + 3*b^3*n + 2*b^3)*x^3 + I*pi^3 - 2*pi^2*(b*n*x - 3*a) - 8*a^3 - 4*(a*b^2*n^2 + a*b^2*n)*x^
2 + 2*I*pi*(4*a*b*n*x - (b^2*n^2 + b^2*n)*x^2 - 6*a^2))*sinh(n*log(1/2*I*pi + b*x + a)))/(b^3*n^3 + 6*b^3*n^2
+ 11*b^3*n + 6*b^3)

Sympy [F]

\[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=\begin {cases} \frac {x^{3} \operatorname {acoth}^{n}{\left (\tanh {\left (a \right )} \right )}}{3} & \text {for}\: b = 0 \\- \frac {x^{2}}{2 b \operatorname {acoth}^{2}{\left (\tanh {\left (a + b x \right )} \right )}} - \frac {x}{b^{2} \operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )}} + \frac {\log {\left (\operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )} \right )}}{b^{3}} & \text {for}\: n = -3 \\\int \frac {x^{2}}{\operatorname {acoth}^{2}{\left (\tanh {\left (a + b x \right )} \right )}}\, dx & \text {for}\: n = -2 \\\int \frac {x^{2}}{\operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )}}\, dx & \text {for}\: n = -1 \\\frac {b^{2} n^{2} x^{2} \operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {5 b^{2} n x^{2} \operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {6 b^{2} x^{2} \operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} - \frac {2 b n x \operatorname {acoth}^{2}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} - \frac {6 b x \operatorname {acoth}^{2}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {2 \operatorname {acoth}^{3}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} & \text {otherwise} \end {cases} \]

[In]

integrate(x**2*acoth(tanh(b*x+a))**n,x)

[Out]

Piecewise((x**3*acoth(tanh(a))**n/3, Eq(b, 0)), (-x**2/(2*b*acoth(tanh(a + b*x))**2) - x/(b**2*acoth(tanh(a +
b*x))) + log(acoth(tanh(a + b*x)))/b**3, Eq(n, -3)), (Integral(x**2/acoth(tanh(a + b*x))**2, x), Eq(n, -2)), (
Integral(x**2/acoth(tanh(a + b*x)), x), Eq(n, -1)), (b**2*n**2*x**2*acoth(tanh(a + b*x))*acoth(tanh(a + b*x))*
*n/(b**3*n**3 + 6*b**3*n**2 + 11*b**3*n + 6*b**3) + 5*b**2*n*x**2*acoth(tanh(a + b*x))*acoth(tanh(a + b*x))**n
/(b**3*n**3 + 6*b**3*n**2 + 11*b**3*n + 6*b**3) + 6*b**2*x**2*acoth(tanh(a + b*x))*acoth(tanh(a + b*x))**n/(b*
*3*n**3 + 6*b**3*n**2 + 11*b**3*n + 6*b**3) - 2*b*n*x*acoth(tanh(a + b*x))**2*acoth(tanh(a + b*x))**n/(b**3*n*
*3 + 6*b**3*n**2 + 11*b**3*n + 6*b**3) - 6*b*x*acoth(tanh(a + b*x))**2*acoth(tanh(a + b*x))**n/(b**3*n**3 + 6*
b**3*n**2 + 11*b**3*n + 6*b**3) + 2*acoth(tanh(a + b*x))**3*acoth(tanh(a + b*x))**n/(b**3*n**3 + 6*b**3*n**2 +
 11*b**3*n + 6*b**3), True))

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.37 (sec) , antiderivative size = 166, normalized size of antiderivative = 2.02 \[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=\frac {{\left (4 \, {\left (n^{2} + 3 \, n + 2\right )} b^{3} x^{3} + i \, \pi ^{3} - 6 \, \pi ^{2} a - 12 i \, \pi a^{2} + 8 \, a^{3} - 2 \, {\left (i \, \pi {\left (n^{2} + n\right )} b^{2} - 2 \, {\left (n^{2} + n\right )} a b^{2}\right )} x^{2} + 2 \, {\left (\pi ^{2} b n + 4 i \, \pi a b n - 4 \, a^{2} b n\right )} x\right )} {\left (\cosh \left (-n \log \left (-i \, \pi + 2 \, b x + 2 \, a\right )\right ) - \sinh \left (-n \log \left (-i \, \pi + 2 \, b x + 2 \, a\right )\right )\right )}}{{\left (2^{n + 2} n^{3} + 3 \cdot 2^{n + 3} n^{2} + 11 \cdot 2^{n + 2} n + 3 \cdot 2^{n + 3}\right )} b^{3}} \]

[In]

integrate(x^2*arccoth(tanh(b*x+a))^n,x, algorithm="maxima")

[Out]

(4*(n^2 + 3*n + 2)*b^3*x^3 + I*pi^3 - 6*pi^2*a - 12*I*pi*a^2 + 8*a^3 - 2*(I*pi*(n^2 + n)*b^2 - 2*(n^2 + n)*a*b
^2)*x^2 + 2*(pi^2*b*n + 4*I*pi*a*b*n - 4*a^2*b*n)*x)*(cosh(-n*log(-I*pi + 2*b*x + 2*a)) - sinh(-n*log(-I*pi +
2*b*x + 2*a)))/((2^(n + 2)*n^3 + 3*2^(n + 3)*n^2 + 11*2^(n + 2)*n + 3*2^(n + 3))*b^3)

Giac [F]

\[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=\int { x^{2} \operatorname {arcoth}\left (\tanh \left (b x + a\right )\right )^{n} \,d x } \]

[In]

integrate(x^2*arccoth(tanh(b*x+a))^n,x, algorithm="giac")

[Out]

integrate(x^2*arccoth(tanh(b*x + a))^n, x)

Mupad [B] (verification not implemented)

Time = 3.98 (sec) , antiderivative size = 304, normalized size of antiderivative = 3.71 \[ \int x^2 \coth ^{-1}(\tanh (a+b x))^n \, dx=-{\left (\frac {\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )}{2}-\frac {\ln \left (-\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )}{2}\right )}^n\,\left (\frac {{\left (\ln \left (-\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )-\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )+2\,b\,x\right )}^3}{4\,b^3\,\left (n^3+6\,n^2+11\,n+6\right )}-\frac {x^3\,\left (n^2+3\,n+2\right )}{n^3+6\,n^2+11\,n+6}+\frac {n\,x\,{\left (\ln \left (-\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )-\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )+2\,b\,x\right )}^2}{2\,b^2\,\left (n^3+6\,n^2+11\,n+6\right )}+\frac {n\,x^2\,\left (n+1\right )\,\left (\ln \left (-\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )-\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1}\right )+2\,b\,x\right )}{2\,b\,\left (n^3+6\,n^2+11\,n+6\right )}\right ) \]

[In]

int(x^2*acoth(tanh(a + b*x))^n,x)

[Out]

-(log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) - 1))/2 - log(-2/(exp(2*a)*exp(2*b*x) - 1))/2)^n*((log(-2/(
exp(2*a)*exp(2*b*x) - 1)) - log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) - 1)) + 2*b*x)^3/(4*b^3*(11*n + 6
*n^2 + n^3 + 6)) - (x^3*(3*n + n^2 + 2))/(11*n + 6*n^2 + n^3 + 6) + (n*x*(log(-2/(exp(2*a)*exp(2*b*x) - 1)) -
log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) - 1)) + 2*b*x)^2)/(2*b^2*(11*n + 6*n^2 + n^3 + 6)) + (n*x^2*(
n + 1)*(log(-2/(exp(2*a)*exp(2*b*x) - 1)) - log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) - 1)) + 2*b*x))/(
2*b*(11*n + 6*n^2 + n^3 + 6)))