\(\int \coth ^2(a+2 \log (x)) \, dx\) [161]

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

Optimal result

Integrand size = 9, antiderivative size = 60 \[ \int \coth ^2(a+2 \log (x)) \, dx=x+\frac {x}{1-e^{2 a} x^4}-\frac {1}{2} e^{-a/2} \arctan \left (e^{a/2} x\right )-\frac {1}{2} e^{-a/2} \text {arctanh}\left (e^{a/2} x\right ) \]

[Out]

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

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.667, Rules used = {5653, 398, 294, 218, 212, 209} \[ \int \coth ^2(a+2 \log (x)) \, dx=-\frac {1}{2} e^{-a/2} \arctan \left (e^{a/2} x\right )-\frac {1}{2} e^{-a/2} \text {arctanh}\left (e^{a/2} x\right )+\frac {x}{1-e^{2 a} x^4}+x \]

[In]

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

[Out]

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

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 212

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

Rule 218

Int[((a_) + (b_.)*(x_)^4)^(-1), x_Symbol] :> With[{r = Numerator[Rt[-a/b, 2]], s = Denominator[Rt[-a/b, 2]]},
Dist[r/(2*a), Int[1/(r - s*x^2), x], x] + Dist[r/(2*a), Int[1/(r + s*x^2), x], x]] /; FreeQ[{a, b}, x] &&  !Gt
Q[a/b, 0]

Rule 294

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

Rule 398

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 5653

Int[Coth[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[(-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, p}, x]

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

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 2.60 (sec) , antiderivative size = 153, normalized size of antiderivative = 2.55 \[ \int \coth ^2(a+2 \log (x)) \, dx=\frac {e^{-4 a} \left (-3645-6769 e^{2 a} x^4-1483 e^{4 a} x^8+681 e^{6 a} x^{12}+5 \left (729+1208 e^{2 a} x^4+102 e^{4 a} x^8-248 e^{6 a} x^{12}+e^{8 a} x^{16}\right ) \operatorname {Hypergeometric2F1}\left (\frac {1}{4},1,\frac {5}{4},e^{2 a} x^4\right )\right )}{640 x^7}+\frac {16}{585} e^{2 a} x^5 \left (1+e^{2 a} x^4\right )^2 \, _4F_3\left (\frac {5}{4},2,2,2;1,1,\frac {17}{4};e^{2 a} x^4\right ) \]

[In]

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

[Out]

(-3645 - 6769*E^(2*a)*x^4 - 1483*E^(4*a)*x^8 + 681*E^(6*a)*x^12 + 5*(729 + 1208*E^(2*a)*x^4 + 102*E^(4*a)*x^8
- 248*E^(6*a)*x^12 + E^(8*a)*x^16)*Hypergeometric2F1[1/4, 1, 5/4, E^(2*a)*x^4])/(640*E^(4*a)*x^7) + (16*E^(2*a
)*x^5*(1 + E^(2*a)*x^4)^2*HypergeometricPFQ[{5/4, 2, 2, 2}, {1, 1, 17/4}, E^(2*a)*x^4])/585

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.43

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

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 97 vs. \(2 (43) = 86\).

Time = 0.27 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.62 \[ \int \coth ^2(a+2 \log (x)) \, dx=\frac {4 \, x^{5} e^{\left (3 \, a\right )} - 2 \, {\left (x^{4} e^{\left (2 \, a\right )} - 1\right )} \arctan \left (x e^{\left (\frac {1}{2} \, a\right )}\right ) e^{\left (\frac {1}{2} \, a\right )} + {\left (x^{4} e^{\left (2 \, a\right )} - 1\right )} e^{\left (\frac {1}{2} \, a\right )} \log \left (\frac {x^{2} e^{a} - 2 \, x e^{\left (\frac {1}{2} \, a\right )} + 1}{x^{2} e^{a} - 1}\right ) - 8 \, x e^{a}}{4 \, {\left (x^{4} e^{\left (3 \, a\right )} - e^{a}\right )}} \]

[In]

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

[Out]

1/4*(4*x^5*e^(3*a) - 2*(x^4*e^(2*a) - 1)*arctan(x*e^(1/2*a))*e^(1/2*a) + (x^4*e^(2*a) - 1)*e^(1/2*a)*log((x^2*
e^a - 2*x*e^(1/2*a) + 1)/(x^2*e^a - 1)) - 8*x*e^a)/(x^4*e^(3*a) - e^a)

Sympy [F]

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

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.00 \[ \int \coth ^2(a+2 \log (x)) \, dx=-\frac {1}{2} \, \arctan \left (x e^{\left (\frac {1}{2} \, a\right )}\right ) e^{\left (-\frac {1}{2} \, a\right )} + \frac {1}{4} \, e^{\left (-\frac {1}{2} \, a\right )} \log \left (\frac {x e^{a} - e^{\left (\frac {1}{2} \, a\right )}}{x e^{a} + e^{\left (\frac {1}{2} \, a\right )}}\right ) + x - \frac {x}{x^{4} e^{\left (2 \, a\right )} - 1} \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.10 \[ \int \coth ^2(a+2 \log (x)) \, dx=-\frac {1}{2} \, \arctan \left (x e^{\left (\frac {1}{2} \, a\right )}\right ) e^{\left (-\frac {1}{2} \, a\right )} + \frac {1}{4} \, e^{\left (-\frac {1}{2} \, a\right )} \log \left (\frac {{\left | 2 \, x e^{a} - 2 \, e^{\left (\frac {1}{2} \, a\right )} \right |}}{{\left | 2 \, x e^{a} + 2 \, e^{\left (\frac {1}{2} \, a\right )} \right |}}\right ) + x - \frac {x}{x^{4} e^{\left (2 \, a\right )} - 1} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 1.89 (sec) , antiderivative size = 54, normalized size of antiderivative = 0.90 \[ \int \coth ^2(a+2 \log (x)) \, dx=x-\frac {\mathrm {atan}\left (x\,{\left ({\mathrm {e}}^{2\,a}\right )}^{1/4}\right )}{2\,{\left ({\mathrm {e}}^{2\,a}\right )}^{1/4}}-\frac {x}{x^4\,{\mathrm {e}}^{2\,a}-1}+\frac {\mathrm {atan}\left (x\,{\left ({\mathrm {e}}^{2\,a}\right )}^{1/4}\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,{\left ({\mathrm {e}}^{2\,a}\right )}^{1/4}} \]

[In]

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

[Out]

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