3.268 \(\int x^2 \tanh ^{-1}(\tanh (a+b x))^n \, dx\)

Optimal. Leaf size=82 \[ -\frac{2 x \tanh ^{-1}(\tanh (a+b x))^{n+2}}{b^2 (n+1) (n+2)}+\frac{2 \tanh ^{-1}(\tanh (a+b x))^{n+3}}{b^3 (n+1) (n+2) (n+3)}+\frac{x^2 \tanh ^{-1}(\tanh (a+b x))^{n+1}}{b (n+1)} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0461799, antiderivative size = 82, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.231, Rules used = {2168, 2157, 30} \[ -\frac{2 x \tanh ^{-1}(\tanh (a+b x))^{n+2}}{b^2 (n+1) (n+2)}+\frac{2 \tanh ^{-1}(\tanh (a+b x))^{n+3}}{b^3 (n+1) (n+2) (n+3)}+\frac{x^2 \tanh ^{-1}(\tanh (a+b x))^{n+1}}{b (n+1)} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 2168

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]))

Rule 2157

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 30

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

Rubi steps

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

Mathematica [A]  time = 0.0576271, size = 71, normalized size = 0.87 \[ \frac{\tanh ^{-1}(\tanh (a+b x))^{n+1} \left (-2 b (n+3) x \tanh ^{-1}(\tanh (a+b x))+2 \tanh ^{-1}(\tanh (a+b x))^2+b^2 \left (n^2+5 n+6\right ) x^2\right )}{b^3 (n+1) (n+2) (n+3)} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B]  time = 0.044, size = 315, normalized size = 3.8 \begin{align*}{\frac{{x}^{3}{{\rm e}^{n\ln \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) \right ) }}}{3+n}}+{\frac{n \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) -bx \right ){x}^{2}{{\rm e}^{n\ln \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) \right ) }}}{b \left ({n}^{2}+5\,n+6 \right ) }}+2\,{\frac{{{\rm e}^{n\ln \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) \right ) }}{a}^{3}}{{b}^{3} \left ({n}^{3}+6\,{n}^{2}+11\,n+6 \right ) }}+6\,{\frac{{{\rm e}^{n\ln \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) \right ) }}{a}^{2} \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) -bx-a \right ) }{{b}^{3} \left ({n}^{3}+6\,{n}^{2}+11\,n+6 \right ) }}+6\,{\frac{{{\rm e}^{n\ln \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) \right ) }}a \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) -bx-a \right ) ^{2}}{{b}^{3} \left ({n}^{3}+6\,{n}^{2}+11\,n+6 \right ) }}+2\,{\frac{{{\rm e}^{n\ln \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) \right ) }} \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) -bx-a \right ) ^{3}}{{b}^{3} \left ({n}^{3}+6\,{n}^{2}+11\,n+6 \right ) }}-2\,{\frac{n \left ({a}^{2}+2\,a \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) -bx-a \right ) + \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) -bx-a \right ) ^{2} \right ) x{{\rm e}^{n\ln \left ({\it Artanh} \left ( \tanh \left ( bx+a \right ) \right ) \right ) }}}{{b}^{2} \left ({n}^{3}+6\,{n}^{2}+11\,n+6 \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/(3+n)*x^3*exp(n*ln(arctanh(tanh(b*x+a))))+n/b*(arctanh(tanh(b*x+a))-b*x)/(n^2+5*n+6)*x^2*exp(n*ln(arctanh(ta
nh(b*x+a))))+2/b^3/(n^3+6*n^2+11*n+6)*exp(n*ln(arctanh(tanh(b*x+a))))*a^3+6/b^3/(n^3+6*n^2+11*n+6)*exp(n*ln(ar
ctanh(tanh(b*x+a))))*a^2*(arctanh(tanh(b*x+a))-b*x-a)+6/b^3/(n^3+6*n^2+11*n+6)*exp(n*ln(arctanh(tanh(b*x+a))))
*a*(arctanh(tanh(b*x+a))-b*x-a)^2+2/b^3/(n^3+6*n^2+11*n+6)*exp(n*ln(arctanh(tanh(b*x+a))))*(arctanh(tanh(b*x+a
))-b*x-a)^3-2*n*(a^2+2*a*(arctanh(tanh(b*x+a))-b*x-a)+(arctanh(tanh(b*x+a))-b*x-a)^2)/b^2/(n^3+6*n^2+11*n+6)*x
*exp(n*ln(arctanh(tanh(b*x+a))))

________________________________________________________________________________________

Maxima [A]  time = 1.7989, size = 92, normalized size = 1.12 \begin{align*} \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}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

((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)

________________________________________________________________________________________

Fricas [B]  time = 2.12992, size = 347, normalized size = 4.23 \begin{align*} -\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}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-((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)

________________________________________________________________________________________

Sympy [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: TypeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: TypeError

________________________________________________________________________________________

Giac [A]  time = 1.17005, size = 189, normalized size = 2.3 \begin{align*} \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}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

((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)