Optimal. Leaf size=82 \[ \frac {2 \tanh ^{-1}(\tanh (a+b x))^{n+3}}{b^3 (n+1) (n+2) (n+3)}-\frac {2 x \tanh ^{-1}(\tanh (a+b x))^{n+2}}{b^2 (n+1) (n+2)}+\frac {x^2 \tanh ^{-1}(\tanh (a+b x))^{n+1}}{b (n+1)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.05, antiderivative size = 82, normalized size of antiderivative = 1.00, 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]
[Out]
Rule 30
Rule 2157
Rule 2168
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.07, 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]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.67, size = 168, normalized size = 2.05 \[ -\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}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.14, size = 140, normalized size = 1.71 \[ \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}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.10, size = 315, normalized size = 3.84 \[ \frac {x^{3} {\mathrm e}^{n \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right )}}{3+n}+\frac {n \left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x \right ) x^{2} {\mathrm e}^{n \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right )}}{b \left (n^{2}+5 n +6\right )}+\frac {2 \,{\mathrm e}^{n \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right )} a^{3}}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}+\frac {6 \,{\mathrm e}^{n \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right )} a^{2} \left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x -a \right )}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}+\frac {6 \,{\mathrm e}^{n \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right )} a \left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x -a \right )^{2}}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}+\frac {2 \,{\mathrm e}^{n \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 )^{3}}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}-\frac {2 n \left (a^{2}+2 a \left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x -a \right )+\left (\arctanh \left (\tanh \left (b x +a \right )\right )-b x -a \right )^{2}\right ) x \,{\mathrm e}^{n \ln \left (\arctanh \left (\tanh \left (b x +a \right )\right )\right )}}{b^{2} \left (n^{3}+6 n^{2}+11 n +6\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.54, size = 68, normalized size = 0.83 \[ \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}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.29, size = 304, normalized size = 3.71 \[ -{\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 ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \begin {cases} \frac {x^{3} \operatorname {atanh}^{n}{\left (\tanh {\relax (a )} \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} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________