3.3.46 \(\int \frac {3+x}{(1+x^2) \sqrt {1+x+x^2}} \, dx\) [246]

Optimal. Leaf size=56 \[ -2 \sqrt {2} \tan ^{-1}\left (\frac {1-x}{\sqrt {2} \sqrt {1+x+x^2}}\right )+\sqrt {2} \tanh ^{-1}\left (\frac {1+x}{\sqrt {2} \sqrt {1+x+x^2}}\right ) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 56, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {1050, 1044, 213, 209} \begin {gather*} \sqrt {2} \tanh ^{-1}\left (\frac {x+1}{\sqrt {2} \sqrt {x^2+x+1}}\right )-2 \sqrt {2} \text {ArcTan}\left (\frac {1-x}{\sqrt {2} \sqrt {x^2+x+1}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(3 + x)/((1 + x^2)*Sqrt[1 + x + x^2]),x]

[Out]

-2*Sqrt[2]*ArcTan[(1 - x)/(Sqrt[2]*Sqrt[1 + x + x^2])] + Sqrt[2]*ArcTanh[(1 + x)/(Sqrt[2]*Sqrt[1 + x + x^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 213

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

Rule 1044

Int[((g_) + (h_.)*(x_))/(((a_) + (c_.)*(x_)^2)*Sqrt[(d_.) + (e_.)*(x_) + (f_.)*(x_)^2]), x_Symbol] :> Dist[-2*
a*g*h, Subst[Int[1/Simp[2*a^2*g*h*c + a*e*x^2, x], x], x, Simp[a*h - g*c*x, x]/Sqrt[d + e*x + f*x^2]], x] /; F
reeQ[{a, c, d, e, f, g, h}, x] && EqQ[a*h^2*e + 2*g*h*(c*d - a*f) - g^2*c*e, 0]

Rule 1050

Int[((g_.) + (h_.)*(x_))/(((a_) + (c_.)*(x_)^2)*Sqrt[(d_.) + (e_.)*(x_) + (f_.)*(x_)^2]), x_Symbol] :> With[{q
 = Rt[(c*d - a*f)^2 + a*c*e^2, 2]}, Dist[1/(2*q), Int[Simp[(-a)*h*e - g*(c*d - a*f - q) + (h*(c*d - a*f + q) -
 g*c*e)*x, x]/((a + c*x^2)*Sqrt[d + e*x + f*x^2]), x], x] - Dist[1/(2*q), Int[Simp[(-a)*h*e - g*(c*d - a*f + q
) + (h*(c*d - a*f - q) - g*c*e)*x, x]/((a + c*x^2)*Sqrt[d + e*x + f*x^2]), x], x]] /; FreeQ[{a, c, d, e, f, g,
 h}, x] && NeQ[e^2 - 4*d*f, 0] && NegQ[(-a)*c]

Rubi steps

\begin {align*} \int \frac {3+x}{\left (1+x^2\right ) \sqrt {1+x+x^2}} \, dx &=-\left (\frac {1}{2} \int \frac {-4-4 x}{\left (1+x^2\right ) \sqrt {1+x+x^2}} \, dx\right )+\frac {1}{2} \int \frac {2-2 x}{\left (1+x^2\right ) \sqrt {1+x+x^2}} \, dx\\ &=4 \text {Subst}\left (\int \frac {1}{-8+x^2} \, dx,x,\frac {-2-2 x}{\sqrt {1+x+x^2}}\right )+16 \text {Subst}\left (\int \frac {1}{32+x^2} \, dx,x,\frac {-4+4 x}{\sqrt {1+x+x^2}}\right )\\ &=-2 \sqrt {2} \tan ^{-1}\left (\frac {1-x}{\sqrt {2} \sqrt {1+x+x^2}}\right )+\sqrt {2} \tanh ^{-1}\left (\frac {1+x}{\sqrt {2} \sqrt {1+x+x^2}}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains higher order function than in optimal. Order 9 vs. order 3 in optimal.
time = 0.13, size = 103, normalized size = 1.84 \begin {gather*} \frac {1}{2} \text {RootSum}\left [2-4 \text {$\#$1}+2 \text {$\#$1}^2+\text {$\#$1}^4\&,\frac {2 \log \left (-x+\sqrt {1+x+x^2}-\text {$\#$1}\right )-6 \log \left (-x+\sqrt {1+x+x^2}-\text {$\#$1}\right ) \text {$\#$1}+\log \left (-x+\sqrt {1+x+x^2}-\text {$\#$1}\right ) \text {$\#$1}^2}{-1+\text {$\#$1}+\text {$\#$1}^3}\&\right ] \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(3 + x)/((1 + x^2)*Sqrt[1 + x + x^2]),x]

[Out]

RootSum[2 - 4*#1 + 2*#1^2 + #1^4 & , (2*Log[-x + Sqrt[1 + x + x^2] - #1] - 6*Log[-x + Sqrt[1 + x + x^2] - #1]*
#1 + Log[-x + Sqrt[1 + x + x^2] - #1]*#1^2)/(-1 + #1 + #1^3) & ]/2

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(127\) vs. \(2(46)=92\).
time = 0.45, size = 128, normalized size = 2.29

method result size
default \(\frac {\sqrt {\frac {\left (-1+x \right )^{2}}{\left (-1-x \right )^{2}}+3}\, \sqrt {2}\, \left (\arctanh \left (\frac {\sqrt {\frac {\left (-1+x \right )^{2}}{\left (-1-x \right )^{2}}+3}\, \sqrt {2}}{2}\right )-2 \arctan \left (\frac {\sqrt {2}\, \left (-1+x \right )}{\sqrt {\frac {\left (-1+x \right )^{2}}{\left (-1-x \right )^{2}}+3}\, \left (-1-x \right )}\right )\right )}{\sqrt {\frac {\frac {\left (-1+x \right )^{2}}{\left (-1-x \right )^{2}}+3}{\left (\frac {-1+x}{-1-x}+1\right )^{2}}}\, \left (\frac {-1+x}{-1-x}+1\right )}\) \(128\)
trager \(-\frac {2 \ln \left (\frac {-12 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{5} x -172 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{3} x +320 \sqrt {x^{2}+x +1}\, \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{2}+40 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{3}+217 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right ) x +960 \sqrt {x^{2}+x +1}+620 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )}{2 x \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{2}+3 x -4}\right ) \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{3}}{5}-\frac {6 \ln \left (\frac {-12 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{5} x -172 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{3} x +320 \sqrt {x^{2}+x +1}\, \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{2}+40 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{3}+217 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right ) x +960 \sqrt {x^{2}+x +1}+620 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )}{2 x \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{2}+3 x -4}\right ) \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )}{5}+\RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right ) \ln \left (-\frac {12 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{4} x +92 x \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{2}+64 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right ) \sqrt {x^{2}+x +1}+40 \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{2}+175 x +140}{2 x \RootOf \left (4 \textit {\_Z}^{4}+12 \textit {\_Z}^{2}+25\right )^{2}+3 x +4}\right )\) \(451\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((3+x)/(x^2+1)/(x^2+x+1)^(1/2),x,method=_RETURNVERBOSE)

[Out]

((-1+x)^2/(-1-x)^2+3)^(1/2)*2^(1/2)*(arctanh(1/2*((-1+x)^2/(-1-x)^2+3)^(1/2)*2^(1/2))-2*arctan(2^(1/2)/((-1+x)
^2/(-1-x)^2+3)^(1/2)*(-1+x)/(-1-x)))/(((-1+x)^2/(-1-x)^2+3)/((-1+x)/(-1-x)+1)^2)^(1/2)/((-1+x)/(-1-x)+1)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

integrate((x + 3)/(sqrt(x^2 + x + 1)*(x^2 + 1)), x)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 303 vs. \(2 (44) = 88\).
time = 0.42, size = 303, normalized size = 5.41 \begin {gather*} \frac {4}{5} \, \sqrt {10} \sqrt {5} \arctan \left (\frac {1}{25} \, \sqrt {5} \sqrt {\sqrt {10} \sqrt {5} {\left (x - 1\right )} + 10 \, x^{2} - \sqrt {x^{2} + x + 1} {\left (\sqrt {10} \sqrt {5} + 10 \, x\right )} + 5 \, x + 15} {\left (\sqrt {10} \sqrt {5} + 10\right )} + \frac {1}{5} \, \sqrt {10} \sqrt {5} {\left (x + 1\right )} - \frac {1}{5} \, \sqrt {x^{2} + x + 1} {\left (\sqrt {10} \sqrt {5} + 10\right )} + 2 \, x + 1\right ) + \frac {4}{5} \, \sqrt {10} \sqrt {5} \arctan \left (\frac {1}{5} \, \sqrt {10} \sqrt {5} {\left (x + 1\right )} + \frac {1}{50} \, \sqrt {-20 \, \sqrt {10} \sqrt {5} {\left (x - 1\right )} + 200 \, x^{2} + 20 \, \sqrt {x^{2} + x + 1} {\left (\sqrt {10} \sqrt {5} - 10 \, x\right )} + 100 \, x + 300} {\left (\sqrt {10} \sqrt {5} - 10\right )} - \frac {1}{5} \, \sqrt {x^{2} + x + 1} {\left (\sqrt {10} \sqrt {5} - 10\right )} - 2 \, x - 1\right ) - \frac {1}{10} \, \sqrt {10} \sqrt {5} \log \left (20 \, \sqrt {10} \sqrt {5} {\left (x - 1\right )} + 200 \, x^{2} - 20 \, \sqrt {x^{2} + x + 1} {\left (\sqrt {10} \sqrt {5} + 10 \, x\right )} + 100 \, x + 300\right ) + \frac {1}{10} \, \sqrt {10} \sqrt {5} \log \left (-20 \, \sqrt {10} \sqrt {5} {\left (x - 1\right )} + 200 \, x^{2} + 20 \, \sqrt {x^{2} + x + 1} {\left (\sqrt {10} \sqrt {5} - 10 \, x\right )} + 100 \, x + 300\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

4/5*sqrt(10)*sqrt(5)*arctan(1/25*sqrt(5)*sqrt(sqrt(10)*sqrt(5)*(x - 1) + 10*x^2 - sqrt(x^2 + x + 1)*(sqrt(10)*
sqrt(5) + 10*x) + 5*x + 15)*(sqrt(10)*sqrt(5) + 10) + 1/5*sqrt(10)*sqrt(5)*(x + 1) - 1/5*sqrt(x^2 + x + 1)*(sq
rt(10)*sqrt(5) + 10) + 2*x + 1) + 4/5*sqrt(10)*sqrt(5)*arctan(1/5*sqrt(10)*sqrt(5)*(x + 1) + 1/50*sqrt(-20*sqr
t(10)*sqrt(5)*(x - 1) + 200*x^2 + 20*sqrt(x^2 + x + 1)*(sqrt(10)*sqrt(5) - 10*x) + 100*x + 300)*(sqrt(10)*sqrt
(5) - 10) - 1/5*sqrt(x^2 + x + 1)*(sqrt(10)*sqrt(5) - 10) - 2*x - 1) - 1/10*sqrt(10)*sqrt(5)*log(20*sqrt(10)*s
qrt(5)*(x - 1) + 200*x^2 - 20*sqrt(x^2 + x + 1)*(sqrt(10)*sqrt(5) + 10*x) + 100*x + 300) + 1/10*sqrt(10)*sqrt(
5)*log(-20*sqrt(10)*sqrt(5)*(x - 1) + 200*x^2 + 20*sqrt(x^2 + x + 1)*(sqrt(10)*sqrt(5) - 10*x) + 100*x + 300)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {x + 3}{\left (x^{2} + 1\right ) \sqrt {x^{2} + x + 1}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral((x + 3)/((x**2 + 1)*sqrt(x**2 + x + 1)), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 152 vs. \(2 (44) = 88\).
time = 0.49, size = 152, normalized size = 2.71 \begin {gather*} -\frac {1}{2} \, \sqrt {2} {\left (\pi + 4 \, \arctan \left (-{\left (x - \sqrt {x^{2} + x + 1}\right )} {\left (\sqrt {2} + 2\right )} - \sqrt {2} - 1\right )\right )} + \frac {1}{2} \, \sqrt {2} {\left (\pi + 4 \, \arctan \left ({\left (x - \sqrt {x^{2} + x + 1}\right )} {\left (\sqrt {2} - 2\right )} + \sqrt {2} - 1\right )\right )} - \frac {1}{2} \, \sqrt {2} \log \left ({\left (x + \sqrt {2} - \sqrt {x^{2} + x + 1} - 1\right )}^{2} + {\left (x - \sqrt {x^{2} + x + 1} + 1\right )}^{2}\right ) + \frac {1}{2} \, \sqrt {2} \log \left ({\left (x - \sqrt {2} - \sqrt {x^{2} + x + 1} - 1\right )}^{2} + {\left (x - \sqrt {x^{2} + x + 1} + 1\right )}^{2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/2*sqrt(2)*(pi + 4*arctan(-(x - sqrt(x^2 + x + 1))*(sqrt(2) + 2) - sqrt(2) - 1)) + 1/2*sqrt(2)*(pi + 4*arcta
n((x - sqrt(x^2 + x + 1))*(sqrt(2) - 2) + sqrt(2) - 1)) - 1/2*sqrt(2)*log((x + sqrt(2) - sqrt(x^2 + x + 1) - 1
)^2 + (x - sqrt(x^2 + x + 1) + 1)^2) + 1/2*sqrt(2)*log((x - sqrt(2) - sqrt(x^2 + x + 1) - 1)^2 + (x - sqrt(x^2
 + x + 1) + 1)^2)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \frac {x+3}{\left (x^2+1\right )\,\sqrt {x^2+x+1}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x + 3)/((x^2 + 1)*(x + x^2 + 1)^(1/2)),x)

[Out]

int((x + 3)/((x^2 + 1)*(x + x^2 + 1)^(1/2)), x)

________________________________________________________________________________________