3.3.68 \(\int x^2 \text {arctanh}(\tanh (a+b x))^n \, dx\) [268]

3.3.68.1 Optimal result
3.3.68.2 Mathematica [A] (verified)
3.3.68.3 Rubi [A] (verified)
3.3.68.4 Maple [A] (verified)
3.3.68.5 Fricas [B] (verification not implemented)
3.3.68.6 Sympy [F]
3.3.68.7 Maxima [A] (verification not implemented)
3.3.68.8 Giac [A] (verification not implemented)
3.3.68.9 Mupad [B] (verification not implemented)

3.3.68.1 Optimal result

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

output
x^2*arctanh(tanh(b*x+a))^(1+n)/b/(1+n)-2*x*arctanh(tanh(b*x+a))^(2+n)/b^2/ 
(1+n)/(2+n)+2*arctanh(tanh(b*x+a))^(3+n)/b^3/(3+n)/(n^2+3*n+2)
 
3.3.68.2 Mathematica [A] (verified)

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

input
Integrate[x^2*ArcTanh[Tanh[a + b*x]]^n,x]
 
output
(ArcTanh[Tanh[a + b*x]]^(1 + n)*(b^2*(6 + 5*n + n^2)*x^2 - 2*b*(3 + n)*x*A 
rcTanh[Tanh[a + b*x]] + 2*ArcTanh[Tanh[a + b*x]]^2))/(b^3*(1 + n)*(2 + n)* 
(3 + n))
 
3.3.68.3 Rubi [A] (verified)

Time = 0.28 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {2599, 2599, 2588, 15}

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 \text {arctanh}(\tanh (a+b x))^n \, dx\)

\(\Big \downarrow \) 2599

\(\displaystyle \frac {x^2 \text {arctanh}(\tanh (a+b x))^{n+1}}{b (n+1)}-\frac {2 \int x \text {arctanh}(\tanh (a+b x))^{n+1}dx}{b (n+1)}\)

\(\Big \downarrow \) 2599

\(\displaystyle \frac {x^2 \text {arctanh}(\tanh (a+b x))^{n+1}}{b (n+1)}-\frac {2 \left (\frac {x \text {arctanh}(\tanh (a+b x))^{n+2}}{b (n+2)}-\frac {\int \text {arctanh}(\tanh (a+b x))^{n+2}dx}{b (n+2)}\right )}{b (n+1)}\)

\(\Big \downarrow \) 2588

\(\displaystyle \frac {x^2 \text {arctanh}(\tanh (a+b x))^{n+1}}{b (n+1)}-\frac {2 \left (\frac {x \text {arctanh}(\tanh (a+b x))^{n+2}}{b (n+2)}-\frac {\int \text {arctanh}(\tanh (a+b x))^{n+2}d\text {arctanh}(\tanh (a+b x))}{b^2 (n+2)}\right )}{b (n+1)}\)

\(\Big \downarrow \) 15

\(\displaystyle \frac {x^2 \text {arctanh}(\tanh (a+b x))^{n+1}}{b (n+1)}-\frac {2 \left (\frac {x \text {arctanh}(\tanh (a+b x))^{n+2}}{b (n+2)}-\frac {\text {arctanh}(\tanh (a+b x))^{n+3}}{b^2 (n+2) (n+3)}\right )}{b (n+1)}\)

input
Int[x^2*ArcTanh[Tanh[a + b*x]]^n,x]
 
output
(x^2*ArcTanh[Tanh[a + b*x]]^(1 + n))/(b*(1 + n)) - (2*((x*ArcTanh[Tanh[a + 
 b*x]]^(2 + n))/(b*(2 + n)) - ArcTanh[Tanh[a + b*x]]^(3 + n)/(b^2*(2 + n)* 
(3 + n))))/(b*(1 + n))
 

3.3.68.3.1 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 2588
Int[(u_)^(m_.), x_Symbol] :> With[{c = Simplify[D[u, x]]}, Simp[1/c   Subst 
[Int[x^m, x], x, u], x]] /; FreeQ[m, x] && PiecewiseLinearQ[u, x]
 

rule 2599
Int[(u_)^(m_)*(v_)^(n_.), x_Symbol] :> With[{a = Simplify[D[u, x]], b = Sim 
plify[D[v, x]]}, Simp[u^(m + 1)*(v^n/(a*(m + 1))), x] - Simp[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] && (FractionQ[m] || GeQ[2*n + m + 1, 0]))) || (IGtQ 
[n, 0] && IGtQ[m, 0] && LeQ[n, m]) || (IGtQ[n, 0] &&  !IntegerQ[m]) || (ILt 
Q[m, 0] &&  !IntegerQ[n]))
 
3.3.68.4 Maple [A] (verified)

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

method result size
parallelrisch \(-\frac {-2 \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{n} \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{3}+6 \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{n} \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{2} x b -6 \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{n} x^{2} \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right ) b^{2}-x^{2} \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right ) \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{n} b^{2} n^{2}-5 x^{2} \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right ) \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{n} b^{2} n +2 x \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{2} \operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )^{n} b n}{\left (1+n \right ) \left (n^{2}+5 n +6\right ) b^{3}}\) \(163\)
default \(\frac {x^{3} {\mathrm e}^{n \ln \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )\right )}}{3+n}+\frac {n \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )-b x \right ) x^{2} {\mathrm e}^{n \ln \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )\right )}}{b \left (n^{2}+5 n +6\right )}+\frac {2 \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )-b x \right ) \left (a^{2}+2 a \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )-b x -a \right )+\left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )-b x -a \right )^{2}\right ) {\mathrm e}^{n \ln \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )\right )}}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}-\frac {2 n \left (a^{2}+2 a \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )-b x -a \right )+\left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )-b x -a \right )^{2}\right ) x \,{\mathrm e}^{n \ln \left (\operatorname {arctanh}\left (\tanh \left (b x +a \right )\right )\right )}}{b^{2} \left (n^{3}+6 n^{2}+11 n +6\right )}\) \(217\)
risch \(\text {Expression too large to display}\) \(12980\)

input
int(x^2*arctanh(tanh(b*x+a))^n,x,method=_RETURNVERBOSE)
 
output
-(-2*arctanh(tanh(b*x+a))^n*arctanh(tanh(b*x+a))^3+6*arctanh(tanh(b*x+a))^ 
n*arctanh(tanh(b*x+a))^2*x*b-6*arctanh(tanh(b*x+a))^n*x^2*arctanh(tanh(b*x 
+a))*b^2-x^2*arctanh(tanh(b*x+a))*arctanh(tanh(b*x+a))^n*b^2*n^2-5*x^2*arc 
tanh(tanh(b*x+a))*arctanh(tanh(b*x+a))^n*b^2*n+2*x*arctanh(tanh(b*x+a))^2* 
arctanh(tanh(b*x+a))^n*b*n)/(1+n)/(n^2+5*n+6)/b^3
 
3.3.68.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 168 vs. \(2 (82) = 164\).

Time = 0.27 (sec) , antiderivative size = 168, normalized size of antiderivative = 2.05 \[ \int x^2 \text {arctanh}(\tanh (a+b x))^n \, dx=-\frac {{\left (2 \, a^{2} b n x - {\left (b^{3} n^{2} + 3 \, b^{3} n + 2 \, b^{3}\right )} x^{3} - 2 \, a^{3} - {\left (a b^{2} n^{2} + a b^{2} n\right )} x^{2}\right )} \cosh \left (n \log \left (b x + a\right )\right ) + {\left (2 \, a^{2} b n x - {\left (b^{3} n^{2} + 3 \, b^{3} n + 2 \, b^{3}\right )} x^{3} - 2 \, a^{3} - {\left (a b^{2} n^{2} + a b^{2} n\right )} x^{2}\right )} \sinh \left (n \log \left (b x + a\right )\right )}{b^{3} n^{3} + 6 \, b^{3} n^{2} + 11 \, b^{3} n + 6 \, b^{3}} \]

input
integrate(x^2*arctanh(tanh(b*x+a))^n,x, algorithm="fricas")
 
output
-((2*a^2*b*n*x - (b^3*n^2 + 3*b^3*n + 2*b^3)*x^3 - 2*a^3 - (a*b^2*n^2 + a* 
b^2*n)*x^2)*cosh(n*log(b*x + a)) + (2*a^2*b*n*x - (b^3*n^2 + 3*b^3*n + 2*b 
^3)*x^3 - 2*a^3 - (a*b^2*n^2 + a*b^2*n)*x^2)*sinh(n*log(b*x + a)))/(b^3*n^ 
3 + 6*b^3*n^2 + 11*b^3*n + 6*b^3)
 
3.3.68.6 Sympy [F]

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

input
integrate(x**2*atanh(tanh(b*x+a))**n,x)
 
output
Piecewise((x**3*atanh(tanh(a))**n/3, Eq(b, 0)), (-x**2/(2*b*atanh(tanh(a + 
 b*x))**2) - x/(b**2*atanh(tanh(a + b*x))) + log(atanh(tanh(a + b*x)))/b** 
3, Eq(n, -3)), (Integral(x**2/atanh(tanh(a + b*x))**2, x), Eq(n, -2)), (In 
tegral(x**2/atanh(tanh(a + b*x)), x), Eq(n, -1)), (b**2*n**2*x**2*atanh(ta 
nh(a + b*x))*atanh(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*atanh(tanh(a + b*x))*atanh(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*atanh(tanh(a + b 
*x))*atanh(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*atanh(tanh(a + b*x))**2*atanh(tanh(a + b*x))**n/(b**3*n**3 + 6 
*b**3*n**2 + 11*b**3*n + 6*b**3) - 6*b*x*atanh(tanh(a + b*x))**2*atanh(tan 
h(a + b*x))**n/(b**3*n**3 + 6*b**3*n**2 + 11*b**3*n + 6*b**3) + 2*atanh(ta 
nh(a + b*x))**3*atanh(tanh(a + b*x))**n/(b**3*n**3 + 6*b**3*n**2 + 11*b**3 
*n + 6*b**3), True))
 
3.3.68.7 Maxima [A] (verification not implemented)

Time = 0.39 (sec) , antiderivative size = 68, normalized size of antiderivative = 0.83 \[ \int x^2 \text {arctanh}(\tanh (a+b x))^n \, dx=\frac {{\left ({\left (n^{2} + 3 \, n + 2\right )} b^{3} x^{3} + {\left (n^{2} + n\right )} a b^{2} x^{2} - 2 \, a^{2} b n x + 2 \, a^{3}\right )} {\left (b x + a\right )}^{n}}{{\left (n^{3} + 6 \, n^{2} + 11 \, n + 6\right )} b^{3}} \]

input
integrate(x^2*arctanh(tanh(b*x+a))^n,x, algorithm="maxima")
 
output
((n^2 + 3*n + 2)*b^3*x^3 + (n^2 + n)*a*b^2*x^2 - 2*a^2*b*n*x + 2*a^3)*(b*x 
 + a)^n/((n^3 + 6*n^2 + 11*n + 6)*b^3)
 
3.3.68.8 Giac [A] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.71 \[ \int x^2 \text {arctanh}(\tanh (a+b x))^n \, dx=\frac {{\left (b x + a\right )}^{n} b^{3} n^{2} x^{3} + {\left (b x + a\right )}^{n} a b^{2} n^{2} x^{2} + 3 \, {\left (b x + a\right )}^{n} b^{3} n x^{3} + {\left (b x + a\right )}^{n} a b^{2} n x^{2} + 2 \, {\left (b x + a\right )}^{n} b^{3} x^{3} - 2 \, {\left (b x + a\right )}^{n} a^{2} b n x + 2 \, {\left (b x + a\right )}^{n} a^{3}}{b^{3} n^{3} + 6 \, b^{3} n^{2} + 11 \, b^{3} n + 6 \, b^{3}} \]

input
integrate(x^2*arctanh(tanh(b*x+a))^n,x, algorithm="giac")
 
output
((b*x + a)^n*b^3*n^2*x^3 + (b*x + a)^n*a*b^2*n^2*x^2 + 3*(b*x + a)^n*b^3*n 
*x^3 + (b*x + a)^n*a*b^2*n*x^2 + 2*(b*x + a)^n*b^3*x^3 - 2*(b*x + a)^n*a^2 
*b*n*x + 2*(b*x + a)^n*a^3)/(b^3*n^3 + 6*b^3*n^2 + 11*b^3*n + 6*b^3)
 
3.3.68.9 Mupad [B] (verification not implemented)

Time = 4.61 (sec) , antiderivative size = 304, normalized size of antiderivative = 3.71 \[ \int x^2 \text {arctanh}(\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 ) \]

input
int(x^2*atanh(tanh(a + b*x))^n,x)
 
output
-(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)))