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

   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 = 11, antiderivative size = 48 \[ \int x \coth ^{-1}(\tanh (a+b x))^n \, dx=\frac {x \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {\coth ^{-1}(\tanh (a+b x))^{2+n}}{b^2 (1+n) (2+n)} \]

[Out]

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

Rubi [A] (verified)

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

[In]

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

[Out]

(x*ArcCoth[Tanh[a + b*x]]^(1 + n))/(b*(1 + n)) - ArcCoth[Tanh[a + b*x]]^(2 + n)/(b^2*(1 + n)*(2 + 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 \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {\int \coth ^{-1}(\tanh (a+b x))^{1+n} \, dx}{b (1+n)} \\ & = \frac {x \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {\text {Subst}\left (\int x^{1+n} \, dx,x,\coth ^{-1}(\tanh (a+b x))\right )}{b^2 (1+n)} \\ & = \frac {x \coth ^{-1}(\tanh (a+b x))^{1+n}}{b (1+n)}-\frac {\coth ^{-1}(\tanh (a+b x))^{2+n}}{b^2 (1+n) (2+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.85 \[ \int x \coth ^{-1}(\tanh (a+b x))^n \, dx=\frac {\left (b (2+n) x-\coth ^{-1}(\tanh (a+b x))\right ) \coth ^{-1}(\tanh (a+b x))^{1+n}}{b^2 (1+n) (2+n)} \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 9.10 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.60

method result size
parallelrisch \(-\frac {\operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{2}-x \,\operatorname {arccoth}\left (\tanh \left (b x +a \right )\right ) \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} b n -2 \operatorname {arccoth}\left (\tanh \left (b x +a \right )\right )^{n} x \,\operatorname {arccoth}\left (\tanh \left (b x +a \right )\right ) b}{b^{2} \left (1+n \right ) \left (2+n \right )}\) \(77\)
risch \(\frac {\left (\frac {1}{2}\right )^{n} {\left (2 \ln \left ({\mathrm e}^{b x +a}\right )-\frac {i \pi \,\operatorname {csgn}\left (i {\mathrm e}^{2 b x +2 a}\right ) {\left (-\operatorname {csgn}\left (i {\mathrm e}^{2 b x +2 a}\right )+\operatorname {csgn}\left (i {\mathrm e}^{b x +a}\right )\right )}^{2}}{2}-\frac {i \pi \,\operatorname {csgn}\left (\frac {i {\mathrm e}^{2 b x +2 a}}{{\mathrm e}^{2 b x +2 a}+1}\right ) \left (-\operatorname {csgn}\left (\frac {i {\mathrm e}^{2 b x +2 a}}{{\mathrm e}^{2 b x +2 a}+1}\right )+\operatorname {csgn}\left (i {\mathrm e}^{2 b x +2 a}\right )\right ) \left (-\operatorname {csgn}\left (\frac {i {\mathrm e}^{2 b x +2 a}}{{\mathrm e}^{2 b x +2 a}+1}\right )+\operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 b x +2 a}+1}\right )\right )}{2}-i \pi -i \pi \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 b x +2 a}+1}\right )^{2} \left (\operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 b x +2 a}+1}\right )-1\right )\right )}^{1+n} x}{2 b \left (1+n \right )}-\frac {\left (\frac {1}{2}\right )^{n} {\left (2 \ln \left ({\mathrm e}^{b x +a}\right )-\frac {i \pi \,\operatorname {csgn}\left (i {\mathrm e}^{2 b x +2 a}\right ) {\left (-\operatorname {csgn}\left (i {\mathrm e}^{2 b x +2 a}\right )+\operatorname {csgn}\left (i {\mathrm e}^{b x +a}\right )\right )}^{2}}{2}-\frac {i \pi \,\operatorname {csgn}\left (\frac {i {\mathrm e}^{2 b x +2 a}}{{\mathrm e}^{2 b x +2 a}+1}\right ) \left (-\operatorname {csgn}\left (\frac {i {\mathrm e}^{2 b x +2 a}}{{\mathrm e}^{2 b x +2 a}+1}\right )+\operatorname {csgn}\left (i {\mathrm e}^{2 b x +2 a}\right )\right ) \left (-\operatorname {csgn}\left (\frac {i {\mathrm e}^{2 b x +2 a}}{{\mathrm e}^{2 b x +2 a}+1}\right )+\operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 b x +2 a}+1}\right )\right )}{2}-i \pi -i \pi \operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 b x +2 a}+1}\right )^{2} \left (\operatorname {csgn}\left (\frac {i}{{\mathrm e}^{2 b x +2 a}+1}\right )-1\right )\right )}^{2+n}}{4 b^{2} \left (1+n \right ) \left (2+n \right )}\) \(480\)

[In]

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

[Out]

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

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

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

[In]

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

[Out]

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

Sympy [F]

\[ \int x \coth ^{-1}(\tanh (a+b x))^n \, dx=\begin {cases} \frac {x^{2} \operatorname {acoth}^{n}{\left (\tanh {\left (a \right )} \right )}}{2} & \text {for}\: b = 0 \\- \frac {x}{b \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^{2}} & \text {for}\: n = -2 \\\int \frac {x}{\operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )}}\, dx & \text {for}\: n = -1 \\\frac {b n x \operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{2} n^{2} + 3 b^{2} n + 2 b^{2}} + \frac {2 b x \operatorname {acoth}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{2} n^{2} + 3 b^{2} n + 2 b^{2}} - \frac {\operatorname {acoth}^{2}{\left (\tanh {\left (a + b x \right )} \right )} \operatorname {acoth}^{n}{\left (\tanh {\left (a + b x \right )} \right )}}{b^{2} n^{2} + 3 b^{2} n + 2 b^{2}} & \text {otherwise} \end {cases} \]

[In]

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

[Out]

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

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.44 (sec) , antiderivative size = 102, normalized size of antiderivative = 2.12 \[ \int x \coth ^{-1}(\tanh (a+b x))^n \, dx=\frac {{\left (4 \, b^{2} {\left (n + 1\right )} x^{2} + \pi ^{2} + 4 i \, \pi a - 4 \, a^{2} - 2 \, {\left (i \, \pi b n - 2 \, a 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^{2} + 3 \cdot 2^{n + 2} n + 2^{n + 3}\right )} b^{2}} \]

[In]

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

[Out]

(4*b^2*(n + 1)*x^2 + pi^2 + 4*I*pi*a - 4*a^2 - 2*(I*pi*b*n - 2*a*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^2 + 3*2^(n + 2)*n + 2^(n + 3))*b^2)

Giac [F]

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 3.91 (sec) , antiderivative size = 205, normalized size of antiderivative = 4.27 \[ \int x \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 )}^2}{4\,b^2\,\left (n^2+3\,n+2\right )}-\frac {x^2\,\left (n+1\right )}{n^2+3\,n+2}+\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\,b\,\left (n^2+3\,n+2\right )}\right ) \]

[In]

int(x*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)^2/(4*b^2*(3*n + n^
2 + 2)) - (x^2*(n + 1))/(3*n + n^2 + 2) + (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*b*(3*n + n^2 + 2)))