3.1.96 \(\int \frac {x^2}{\tanh ^{-1}(\tanh (a+b x))^2} \, dx\) [96]

Optimal. Leaf size=50 \[ \frac {2 x}{b^2}-\frac {x^2}{b \tanh ^{-1}(\tanh (a+b x))}+\frac {2 \left (b x-\tanh ^{-1}(\tanh (a+b x))\right ) \log \left (\tanh ^{-1}(\tanh (a+b x))\right )}{b^3} \]

[Out]

2*x/b^2-x^2/b/arctanh(tanh(b*x+a))+2*(b*x-arctanh(tanh(b*x+a)))*ln(arctanh(tanh(b*x+a)))/b^3

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {2199, 2189, 2188, 29} \begin {gather*} \frac {2 \left (b x-\tanh ^{-1}(\tanh (a+b x))\right ) \log \left (\tanh ^{-1}(\tanh (a+b x))\right )}{b^3}-\frac {x^2}{b \tanh ^{-1}(\tanh (a+b x))}+\frac {2 x}{b^2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

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 2189

Int[(v_)/(u_), x_Symbol] :> With[{a = Simplify[D[u, x]], b = Simplify[D[v, x]]}, Simp[b*(x/a), x] - Dist[(b*u
- a*v)/a, Int[1/u, x], x] /; NeQ[b*u - a*v, 0]] /; PiecewiseLinearQ[u, v, 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*} \int \frac {x^2}{\tanh ^{-1}(\tanh (a+b x))^2} \, dx &=-\frac {x^2}{b \tanh ^{-1}(\tanh (a+b x))}+\frac {2 \int \frac {x}{\tanh ^{-1}(\tanh (a+b x))} \, dx}{b}\\ &=\frac {2 x}{b^2}-\frac {x^2}{b \tanh ^{-1}(\tanh (a+b x))}-\frac {\left (2 \left (-b x+\tanh ^{-1}(\tanh (a+b x))\right )\right ) \int \frac {1}{\tanh ^{-1}(\tanh (a+b x))} \, dx}{b^2}\\ &=\frac {2 x}{b^2}-\frac {x^2}{b \tanh ^{-1}(\tanh (a+b x))}-\frac {\left (2 \left (-b x+\tanh ^{-1}(\tanh (a+b x))\right )\right ) \text {Subst}\left (\int \frac {1}{x} \, dx,x,\tanh ^{-1}(\tanh (a+b x))\right )}{b^3}\\ &=\frac {2 x}{b^2}-\frac {x^2}{b \tanh ^{-1}(\tanh (a+b x))}+\frac {2 \left (b x-\tanh ^{-1}(\tanh (a+b x))\right ) \log \left (\tanh ^{-1}(\tanh (a+b x))\right )}{b^3}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.05, size = 56, normalized size = 1.12 \begin {gather*} \frac {b x-\frac {\left (-b x+\tanh ^{-1}(\tanh (a+b x))\right )^2}{\tanh ^{-1}(\tanh (a+b x))}+2 \left (b x-\tanh ^{-1}(\tanh (a+b x))\right ) \log \left (\tanh ^{-1}(\tanh (a+b x))\right )}{b^3} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

(b*x - (-(b*x) + ArcTanh[Tanh[a + b*x]])^2/ArcTanh[Tanh[a + b*x]] + 2*(b*x - ArcTanh[Tanh[a + b*x]])*Log[ArcTa
nh[Tanh[a + b*x]]])/b^3

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(126\) vs. \(2(50)=100\).
time = 0.24, size = 127, normalized size = 2.54

method result size
default \(\frac {x}{b^{2}}-\frac {2 \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right ) a}{b^{3}}-\frac {2 \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right ) \left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x -a \right )}{b^{3}}-\frac {a^{2}}{b^{3} \arctanh \left (\tanh \left (b x +a \right )\right )}-\frac {2 a \left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x -a \right )}{b^{3} \arctanh \left (\tanh \left (b x +a \right )\right )}-\frac {\left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x -a \right )^{2}}{b^{3} \arctanh \left (\tanh \left (b x +a \right )\right )}\) \(127\)
risch \(\text {Expression too large to display}\) \(3133\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2/arctanh(tanh(b*x+a))^2,x,method=_RETURNVERBOSE)

[Out]

x/b^2-2/b^3*ln(arctanh(tanh(b*x+a)))*a-2/b^3*ln(arctanh(tanh(b*x+a)))*(arctanh(tanh(b*x+a))-b*x-a)-1/b^3/arcta
nh(tanh(b*x+a))*a^2-2/b^3/arctanh(tanh(b*x+a))*a*(arctanh(tanh(b*x+a))-b*x-a)-1/b^3/arctanh(tanh(b*x+a))*(arct
anh(tanh(b*x+a))-b*x-a)^2

________________________________________________________________________________________

Maxima [A]
time = 0.68, size = 44, normalized size = 0.88 \begin {gather*} \frac {b^{2} x^{2} + a b x - a^{2}}{b^{4} x + a b^{3}} - \frac {2 \, a \log \left (b x + a\right )}{b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(b^2*x^2 + a*b*x - a^2)/(b^4*x + a*b^3) - 2*a*log(b*x + a)/b^3

________________________________________________________________________________________

Fricas [A]
time = 0.34, size = 47, normalized size = 0.94 \begin {gather*} \frac {b^{2} x^{2} + a b x - a^{2} - 2 \, {\left (a b x + a^{2}\right )} \log \left (b x + a\right )}{b^{4} x + a b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(b^2*x^2 + a*b*x - a^2 - 2*(a*b*x + a^2)*log(b*x + a))/(b^4*x + a*b^3)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {x^{2}}{\operatorname {atanh}^{2}{\left (\tanh {\left (a + b x \right )} \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral(x**2/atanh(tanh(a + b*x))**2, x)

________________________________________________________________________________________

Giac [A]
time = 0.39, size = 34, normalized size = 0.68 \begin {gather*} \frac {x}{b^{2}} - \frac {2 \, a \log \left ({\left | b x + a \right |}\right )}{b^{3}} - \frac {a^{2}}{{\left (b x + a\right )} b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x/b^2 - 2*a*log(abs(b*x + a))/b^3 - a^2/((b*x + a)*b^3)

________________________________________________________________________________________

Mupad [B]
time = 1.06, size = 302, normalized size = 6.04 \begin {gather*} \frac {x}{b^2}-\frac {{\left (2\,a-\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )+\ln \left (\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )+2\,b\,x\right )}^2-4\,a\,\left (2\,a-\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )+\ln \left (\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )+2\,b\,x\right )+4\,a^2}{2\,b\,\left (2\,a\,b^2+2\,b^3\,x-b^2\,\left (2\,a-\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )+\ln \left (\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )+2\,b\,x\right )\right )}+\frac {\ln \left (\ln \left (\frac {2\,{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )-\ln \left (\frac {2}{{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}+1}\right )\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 )}{b^3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2/atanh(tanh(a + b*x))^2,x)

[Out]

x/b^2 - ((2*a - log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) + 1)) + log(2/(exp(2*a)*exp(2*b*x) + 1)) + 2*
b*x)^2 - 4*a*(2*a - log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) + 1)) + log(2/(exp(2*a)*exp(2*b*x) + 1))
+ 2*b*x) + 4*a^2)/(2*b*(2*a*b^2 + 2*b^3*x - b^2*(2*a - log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) + 1))
+ log(2/(exp(2*a)*exp(2*b*x) + 1)) + 2*b*x))) + (log(log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*exp(2*b*x) + 1)) -
log(2/(exp(2*a)*exp(2*b*x) + 1)))*(log(2/(exp(2*a)*exp(2*b*x) + 1)) - log((2*exp(2*a)*exp(2*b*x))/(exp(2*a)*ex
p(2*b*x) + 1)) + 2*b*x))/b^3

________________________________________________________________________________________