\(\int x \tanh ^2(a+2 \log (x)) \, dx\) [155]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [C] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 11, antiderivative size = 40 \[ \int x \tanh ^2(a+2 \log (x)) \, dx=\frac {x^2}{2}+\frac {x^2}{1+e^{2 a} x^4}-e^{-a} \arctan \left (e^a x^2\right ) \]

[Out]

1/2*x^2+x^2/(1+exp(2*a)*x^4)-arctan(exp(a)*x^2)/exp(a)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.455, Rules used = {5656, 474, 470, 281, 209} \[ \int x \tanh ^2(a+2 \log (x)) \, dx=-e^{-a} \arctan \left (e^a x^2\right )+\frac {x^2}{e^{2 a} x^4+1}+\frac {x^2}{2} \]

[In]

Int[x*Tanh[a + 2*Log[x]]^2,x]

[Out]

x^2/2 + x^2/(1 + E^(2*a)*x^4) - ArcTan[E^a*x^2]/E^a

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 281

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> With[{k = GCD[m + 1, n]}, Dist[1/k, Subst[Int[x^((m
 + 1)/k - 1)*(a + b*x^(n/k))^p, x], x, x^k], x] /; k != 1] /; FreeQ[{a, b, p}, x] && IGtQ[n, 0] && IntegerQ[m]

Rule 470

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(b*e*(m + n*(p + 1) + 1))), x] - Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(b*(m +
 n*(p + 1) + 1)), Int[(e*x)^m*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, m, n, p}, x] && NeQ[b*c - a*d, 0]
 && NeQ[m + n*(p + 1) + 1, 0]

Rule 474

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^2, x_Symbol] :> Simp[(-(b*c - a*
d)^2)*(e*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*b^2*e*n*(p + 1))), x] + Dist[1/(a*b^2*n*(p + 1)), Int[(e*x)^m*(a +
 b*x^n)^(p + 1)*Simp[(b*c - a*d)^2*(m + 1) + b^2*c^2*n*(p + 1) + a*b*d^2*n*(p + 1)*x^n, x], x], x] /; FreeQ[{a
, b, c, d, e, m, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[p, -1]

Rule 5656

Int[((e_.)*(x_))^(m_.)*Tanh[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[(e*x)^m*((-1 + E^(2*a*d)*x^
(2*b*d))^p/(1 + E^(2*a*d)*x^(2*b*d))^p), x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {x \left (-1+e^{2 a} x^4\right )^2}{\left (1+e^{2 a} x^4\right )^2} \, dx \\ & = \frac {x^2}{1+e^{2 a} x^4}-\frac {1}{4} e^{-4 a} \int \frac {x \left (4 e^{4 a}-4 e^{6 a} x^4\right )}{1+e^{2 a} x^4} \, dx \\ & = \frac {x^2}{2}+\frac {x^2}{1+e^{2 a} x^4}-2 \int \frac {x}{1+e^{2 a} x^4} \, dx \\ & = \frac {x^2}{2}+\frac {x^2}{1+e^{2 a} x^4}-\text {Subst}\left (\int \frac {1}{1+e^{2 a} x^2} \, dx,x,x^2\right ) \\ & = \frac {x^2}{2}+\frac {x^2}{1+e^{2 a} x^4}-e^{-a} \arctan \left (e^a x^2\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.31 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.02 \[ \int x \tanh ^2(a+2 \log (x)) \, dx=\frac {x^2}{2}+\frac {x^2}{1+e^{2 (a+2 \log (x))}}-e^{-a} \arctan \left (e^a x^2\right ) \]

[In]

Integrate[x*Tanh[a + 2*Log[x]]^2,x]

[Out]

x^2/2 + x^2/(1 + E^(2*(a + 2*Log[x]))) - ArcTan[E^a*x^2]/E^a

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 0.07 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.42

method result size
risch \(\frac {x^{2}}{2}+\frac {x^{2}}{1+{\mathrm e}^{2 a} x^{4}}+\frac {i {\mathrm e}^{-a} \ln \left ({\mathrm e}^{a} x^{2}-i\right )}{2}-\frac {i {\mathrm e}^{-a} \ln \left ({\mathrm e}^{a} x^{2}+i\right )}{2}\) \(57\)

[In]

int(x*tanh(a+2*ln(x))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*x^2+x^2/(exp(a)^2*x^4+1)+1/2*I/exp(a)*ln(exp(a)*x^2-I)-1/2*I/exp(a)*ln(exp(a)*x^2+I)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.25 \[ \int x \tanh ^2(a+2 \log (x)) \, dx=\frac {x^{6} e^{\left (3 \, a\right )} + 3 \, x^{2} e^{a} - 2 \, {\left (x^{4} e^{\left (2 \, a\right )} + 1\right )} \arctan \left (x^{2} e^{a}\right )}{2 \, {\left (x^{4} e^{\left (3 \, a\right )} + e^{a}\right )}} \]

[In]

integrate(x*tanh(a+2*log(x))^2,x, algorithm="fricas")

[Out]

1/2*(x^6*e^(3*a) + 3*x^2*e^a - 2*(x^4*e^(2*a) + 1)*arctan(x^2*e^a))/(x^4*e^(3*a) + e^a)

Sympy [F]

\[ \int x \tanh ^2(a+2 \log (x)) \, dx=\int x \tanh ^{2}{\left (a + 2 \log {\left (x \right )} \right )}\, dx \]

[In]

integrate(x*tanh(a+2*ln(x))**2,x)

[Out]

Integral(x*tanh(a + 2*log(x))**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.88 \[ \int x \tanh ^2(a+2 \log (x)) \, dx=\frac {1}{2} \, x^{2} - \arctan \left (x^{2} e^{a}\right ) e^{\left (-a\right )} + \frac {x^{2}}{x^{4} e^{\left (2 \, a\right )} + 1} \]

[In]

integrate(x*tanh(a+2*log(x))^2,x, algorithm="maxima")

[Out]

1/2*x^2 - arctan(x^2*e^a)*e^(-a) + x^2/(x^4*e^(2*a) + 1)

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.88 \[ \int x \tanh ^2(a+2 \log (x)) \, dx=\frac {1}{2} \, x^{2} - \arctan \left (x^{2} e^{a}\right ) e^{\left (-a\right )} + \frac {x^{2}}{x^{4} e^{\left (2 \, a\right )} + 1} \]

[In]

integrate(x*tanh(a+2*log(x))^2,x, algorithm="giac")

[Out]

1/2*x^2 - arctan(x^2*e^a)*e^(-a) + x^2/(x^4*e^(2*a) + 1)

Mupad [B] (verification not implemented)

Time = 1.72 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.02 \[ \int x \tanh ^2(a+2 \log (x)) \, dx=\frac {x^2}{{\mathrm {e}}^{2\,a}\,x^4+1}-\frac {\mathrm {atan}\left (x^2\,\sqrt {{\mathrm {e}}^{2\,a}}\right )}{\sqrt {{\mathrm {e}}^{2\,a}}}+\frac {x^2}{2} \]

[In]

int(x*tanh(a + 2*log(x))^2,x)

[Out]

x^2/(x^4*exp(2*a) + 1) - atan(x^2*exp(2*a)^(1/2))/exp(2*a)^(1/2) + x^2/2