3.30 \(\int \frac{\tan ^{-1}(1+x+x^2)}{x^2} \, dx\)

Optimal. Leaf size=50 \[ -\frac{1}{2} \log \left (x^2+1\right )+\frac{1}{4} \log \left (x^2+2 x+2\right )-\frac{\tan ^{-1}\left (x^2+x+1\right )}{x}+\frac{\log (x)}{2}+\frac{1}{2} \tan ^{-1}(x+1) \]

[Out]

ArcTan[1 + x]/2 - ArcTan[1 + x + x^2]/x + Log[x]/2 - Log[1 + x^2]/2 + Log[2 + 2*x + x^2]/4

________________________________________________________________________________________

Rubi [A]  time = 0.146014, antiderivative size = 50, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 7, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.636, Rules used = {5205, 6742, 260, 634, 617, 204, 628} \[ -\frac{1}{2} \log \left (x^2+1\right )+\frac{1}{4} \log \left (x^2+2 x+2\right )-\frac{\tan ^{-1}\left (x^2+x+1\right )}{x}+\frac{\log (x)}{2}+\frac{1}{2} \tan ^{-1}(x+1) \]

Antiderivative was successfully verified.

[In]

Int[ArcTan[1 + x + x^2]/x^2,x]

[Out]

ArcTan[1 + x]/2 - ArcTan[1 + x + x^2]/x + Log[x]/2 - Log[1 + x^2]/2 + Log[2 + 2*x + x^2]/4

Rule 5205

Int[((a_.) + ArcTan[u_]*(b_.))*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[((c + d*x)^(m + 1)*(a + b*ArcTan[
u]))/(d*(m + 1)), x] - Dist[b/(d*(m + 1)), Int[SimplifyIntegrand[((c + d*x)^(m + 1)*D[u, x])/(1 + u^2), x], x]
, x] /; FreeQ[{a, b, c, d, m}, x] && NeQ[m, -1] && InverseFunctionFreeQ[u, x] &&  !FunctionOfQ[(c + d*x)^(m +
1), u, x] && FalseQ[PowerVariableExpn[u, m + 1, x]]

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 634

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 617

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = 1 - 4*Simplify[(a*c)/b^2]}, Dist[-2/b, Sub
st[Int[1/(q - x^2), x], x, 1 + (2*c*x)/b], x] /; RationalQ[q] && (EqQ[q^2, 1] ||  !RationalQ[b^2 - 4*a*c])] /;
 FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

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

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rubi steps

\begin{align*} \int \frac{\tan ^{-1}\left (1+x+x^2\right )}{x^2} \, dx &=-\frac{\tan ^{-1}\left (1+x+x^2\right )}{x}+\int \frac{1+2 x}{x \left (2+2 x+3 x^2+2 x^3+x^4\right )} \, dx\\ &=-\frac{\tan ^{-1}\left (1+x+x^2\right )}{x}+\int \left (\frac{1}{2 x}-\frac{x}{1+x^2}+\frac{2+x}{2 \left (2+2 x+x^2\right )}\right ) \, dx\\ &=-\frac{\tan ^{-1}\left (1+x+x^2\right )}{x}+\frac{\log (x)}{2}+\frac{1}{2} \int \frac{2+x}{2+2 x+x^2} \, dx-\int \frac{x}{1+x^2} \, dx\\ &=-\frac{\tan ^{-1}\left (1+x+x^2\right )}{x}+\frac{\log (x)}{2}-\frac{1}{2} \log \left (1+x^2\right )+\frac{1}{4} \int \frac{2+2 x}{2+2 x+x^2} \, dx+\frac{1}{2} \int \frac{1}{2+2 x+x^2} \, dx\\ &=-\frac{\tan ^{-1}\left (1+x+x^2\right )}{x}+\frac{\log (x)}{2}-\frac{1}{2} \log \left (1+x^2\right )+\frac{1}{4} \log \left (2+2 x+x^2\right )-\frac{1}{2} \operatorname{Subst}\left (\int \frac{1}{-1-x^2} \, dx,x,1+x\right )\\ &=\frac{1}{2} \tan ^{-1}(1+x)-\frac{\tan ^{-1}\left (1+x+x^2\right )}{x}+\frac{\log (x)}{2}-\frac{1}{2} \log \left (1+x^2\right )+\frac{1}{4} \log \left (2+2 x+x^2\right )\\ \end{align*}

Mathematica [A]  time = 0.0149432, size = 50, normalized size = 1. \[ -\frac{1}{2} \log \left (x^2+1\right )+\frac{1}{4} \log \left (x^2+2 x+2\right )-\frac{\tan ^{-1}\left (x^2+x+1\right )}{x}+\frac{\log (x)}{2}+\frac{1}{2} \tan ^{-1}(x+1) \]

Antiderivative was successfully verified.

[In]

Integrate[ArcTan[1 + x + x^2]/x^2,x]

[Out]

ArcTan[1 + x]/2 - ArcTan[1 + x + x^2]/x + Log[x]/2 - Log[1 + x^2]/2 + Log[2 + 2*x + x^2]/4

________________________________________________________________________________________

Maple [A]  time = 0.043, size = 43, normalized size = 0.9 \begin{align*}{\frac{\arctan \left ( x+1 \right ) }{2}}-{\frac{\arctan \left ({x}^{2}+x+1 \right ) }{x}}+{\frac{\ln \left ( x \right ) }{2}}-{\frac{\ln \left ({x}^{2}+1 \right ) }{2}}+{\frac{\ln \left ({x}^{2}+2\,x+2 \right ) }{4}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(arctan(x^2+x+1)/x^2,x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.47961, size = 57, normalized size = 1.14 \begin{align*} -\frac{\arctan \left (x^{2} + x + 1\right )}{x} + \frac{1}{2} \, \arctan \left (x + 1\right ) + \frac{1}{4} \, \log \left (x^{2} + 2 \, x + 2\right ) - \frac{1}{2} \, \log \left (x^{2} + 1\right ) + \frac{1}{2} \, \log \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(arctan(x^2+x+1)/x^2,x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.03198, size = 143, normalized size = 2.86 \begin{align*} \frac{2 \, x \arctan \left (x + 1\right ) + x \log \left (x^{2} + 2 \, x + 2\right ) - 2 \, x \log \left (x^{2} + 1\right ) + 2 \, x \log \left (x\right ) - 4 \, \arctan \left (x^{2} + x + 1\right )}{4 \, x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(arctan(x^2+x+1)/x^2,x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 1.07726, size = 41, normalized size = 0.82 \begin{align*} \frac{\log{\left (x \right )}}{2} - \frac{\log{\left (x^{2} + 1 \right )}}{2} + \frac{\log{\left (x^{2} + 2 x + 2 \right )}}{4} + \frac{\operatorname{atan}{\left (x + 1 \right )}}{2} - \frac{\operatorname{atan}{\left (x^{2} + x + 1 \right )}}{x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(atan(x**2+x+1)/x**2,x)

[Out]

log(x)/2 - log(x**2 + 1)/2 + log(x**2 + 2*x + 2)/4 + atan(x + 1)/2 - atan(x**2 + x + 1)/x

________________________________________________________________________________________

Giac [A]  time = 1.1258, size = 58, normalized size = 1.16 \begin{align*} -\frac{\arctan \left (x^{2} + x + 1\right )}{x} + \frac{1}{2} \, \arctan \left (x + 1\right ) + \frac{1}{4} \, \log \left (x^{2} + 2 \, x + 2\right ) - \frac{1}{2} \, \log \left (x^{2} + 1\right ) + \frac{1}{2} \, \log \left ({\left | x \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(arctan(x^2+x+1)/x^2,x, algorithm="giac")

[Out]

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