3.38.29 \(\int \frac {-1+x-x^2+e^x (1+x^2-x^3)+(x^2-e^x x^2-x^3) \log (2-2 e^x-2 x)+(1-e^x-x) \log (x)+(-x^2+e^x x^2+x^3) \log (e x)}{-x^2+e^x x^2+x^3} \, dx\)

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

________________________________________________________________________________________

Rubi [A]  time = 0.82, antiderivative size = 26, normalized size of antiderivative = 0.90, number of steps used = 17, number of rules used = 4, integrand size = 104, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.038, Rules used = {6742, 14, 2334, 2548} \begin {gather*} x+x \left (-\log \left (2 \left (-x-e^x+1\right )\right )\right )+\left (x+\frac {1}{x}\right ) \log (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(-1 + x - x^2 + E^x*(1 + x^2 - x^3) + (x^2 - E^x*x^2 - x^3)*Log[2 - 2*E^x - 2*x] + (1 - E^x - x)*Log[x] +
(-x^2 + E^x*x^2 + x^3)*Log[E*x])/(-x^2 + E^x*x^2 + x^3),x]

[Out]

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

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2334

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*(x_)^(m_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol] :> With[{u = I
ntHide[x^m*(d + e*x^r)^q, x]}, Simp[u*(a + b*Log[c*x^n]), x] - Dist[b*n, Int[SimplifyIntegrand[u/x, x], x], x]
] /; FreeQ[{a, b, c, d, e, n, r}, x] && IGtQ[q, 0] && IntegerQ[m] &&  !(EqQ[q, 1] && EqQ[m, -1])

Rule 2548

Int[Log[u_], x_Symbol] :> Simp[x*Log[u], x] - Int[SimplifyIntegrand[(x*D[u, x])/u, x], x] /; InverseFunctionFr
eeQ[u, x]

Rule 6742

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

Rubi steps

\begin {gather*} \begin {aligned} \text {integral} &=\int \left (\frac {(-2+x) x}{-1+e^x+x}+\frac {1+2 x^2-x^3-\log (x)+x^2 \log (x)-x^2 \log \left (-2 \left (-1+e^x+x\right )\right )}{x^2}\right ) \, dx\\ &=\int \frac {(-2+x) x}{-1+e^x+x} \, dx+\int \frac {1+2 x^2-x^3-\log (x)+x^2 \log (x)-x^2 \log \left (-2 \left (-1+e^x+x\right )\right )}{x^2} \, dx\\ &=\int \left (-\frac {2 x}{-1+e^x+x}+\frac {x^2}{-1+e^x+x}\right ) \, dx+\int \left (\frac {1+2 x^2-x^3-\log (x)+x^2 \log (x)}{x^2}-\log \left (-2 \left (-1+e^x+x\right )\right )\right ) \, dx\\ &=-\left (2 \int \frac {x}{-1+e^x+x} \, dx\right )+\int \frac {x^2}{-1+e^x+x} \, dx+\int \frac {1+2 x^2-x^3-\log (x)+x^2 \log (x)}{x^2} \, dx-\int \log \left (-2 \left (-1+e^x+x\right )\right ) \, dx\\ &=-x \log \left (2 \left (1-e^x-x\right )\right )-2 \int \frac {x}{-1+e^x+x} \, dx+\int \frac {\left (1+e^x\right ) x}{-1+e^x+x} \, dx+\int \frac {x^2}{-1+e^x+x} \, dx+\int \left (\frac {1+2 x^2-x^3}{x^2}+\frac {\left (-1+x^2\right ) \log (x)}{x^2}\right ) \, dx\\ &=-x \log \left (2 \left (1-e^x-x\right )\right )-2 \int \frac {x}{-1+e^x+x} \, dx+\int \frac {x^2}{-1+e^x+x} \, dx+\int \frac {1+2 x^2-x^3}{x^2} \, dx+\int \left (x-\frac {(-2+x) x}{-1+e^x+x}\right ) \, dx+\int \frac {\left (-1+x^2\right ) \log (x)}{x^2} \, dx\\ &=\frac {x^2}{2}-x \log \left (2 \left (1-e^x-x\right )\right )+\left (\frac {1}{x}+x\right ) \log (x)-2 \int \frac {x}{-1+e^x+x} \, dx-\int \left (1+\frac {1}{x^2}\right ) \, dx+\int \left (2+\frac {1}{x^2}-x\right ) \, dx-\int \frac {(-2+x) x}{-1+e^x+x} \, dx+\int \frac {x^2}{-1+e^x+x} \, dx\\ &=x-x \log \left (2 \left (1-e^x-x\right )\right )+\left (\frac {1}{x}+x\right ) \log (x)-2 \int \frac {x}{-1+e^x+x} \, dx+\int \frac {x^2}{-1+e^x+x} \, dx-\int \left (-\frac {2 x}{-1+e^x+x}+\frac {x^2}{-1+e^x+x}\right ) \, dx\\ &=x-x \log \left (2 \left (1-e^x-x\right )\right )+\left (\frac {1}{x}+x\right ) \log (x)\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]  time = 0.30, size = 22, normalized size = 0.76 \begin {gather*} x+\left (\frac {1}{x}+x\right ) \log (x)-x \log \left (-2 \left (-1+e^x+x\right )\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(-1 + x - x^2 + E^x*(1 + x^2 - x^3) + (x^2 - E^x*x^2 - x^3)*Log[2 - 2*E^x - 2*x] + (1 - E^x - x)*Log
[x] + (-x^2 + E^x*x^2 + x^3)*Log[E*x])/(-x^2 + E^x*x^2 + x^3),x]

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.79, size = 34, normalized size = 1.17 \begin {gather*} -\frac {x^{2} \log \left (-2 \, x - 2 \, e^{x} + 2\right ) - x^{2} - {\left (x^{2} + 1\right )} \log \relax (x)}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-exp(x)*x^2-x^3+x^2)*log(-2*exp(x)-2*x+2)+(exp(x)*x^2+x^3-x^2)*log(x*exp(1))+(1-exp(x)-x)*log(x)+(
-x^3+x^2+1)*exp(x)-x^2+x-1)/(exp(x)*x^2+x^3-x^2),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.16, size = 31, normalized size = 1.07 \begin {gather*} \frac {x^{2} \log \relax (x) - x^{2} \log \left (-2 \, x - 2 \, e^{x} + 2\right ) + x^{2} + \log \relax (x)}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-exp(x)*x^2-x^3+x^2)*log(-2*exp(x)-2*x+2)+(exp(x)*x^2+x^3-x^2)*log(x*exp(1))+(1-exp(x)-x)*log(x)+(
-x^3+x^2+1)*exp(x)-x^2+x-1)/(exp(x)*x^2+x^3-x^2),x, algorithm="giac")

[Out]

(x^2*log(x) - x^2*log(-2*x - 2*e^x + 2) + x^2 + log(x))/x

________________________________________________________________________________________

maple [A]  time = 0.07, size = 37, normalized size = 1.28




method result size



risch \(-x \ln \left (-2 \,{\mathrm e}^{x}-2 x +2\right )+\frac {2 x^{2} \ln \relax (x )+2 x^{2}+2 \ln \relax (x )}{2 x}\) \(37\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((-exp(x)*x^2-x^3+x^2)*ln(-2*exp(x)-2*x+2)+(exp(x)*x^2+x^3-x^2)*ln(x*exp(1))+(1-exp(x)-x)*ln(x)+(-x^3+x^2+
1)*exp(x)-x^2+x-1)/(exp(x)*x^2+x^3-x^2),x,method=_RETURNVERBOSE)

[Out]

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

________________________________________________________________________________________

maxima [C]  time = 0.52, size = 36, normalized size = 1.24 \begin {gather*} -\frac {{\left (i \, \pi + \log \relax (2) - 1\right )} x^{2} + x^{2} \log \left (x + e^{x} - 1\right ) - {\left (x^{2} + 1\right )} \log \relax (x)}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-exp(x)*x^2-x^3+x^2)*log(-2*exp(x)-2*x+2)+(exp(x)*x^2+x^3-x^2)*log(x*exp(1))+(1-exp(x)-x)*log(x)+(
-x^3+x^2+1)*exp(x)-x^2+x-1)/(exp(x)*x^2+x^3-x^2),x, algorithm="maxima")

[Out]

-((I*pi + log(2) - 1)*x^2 + x^2*log(x + e^x - 1) - (x^2 + 1)*log(x))/x

________________________________________________________________________________________

mupad [B]  time = 2.35, size = 32, normalized size = 1.10 \begin {gather*} x-x\,\ln \left (2-2\,{\mathrm {e}}^x-2\,x\right )+\ln \relax (x)\,\left (2\,x-\frac {x^2-1}{x}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x - x*log(2 - 2*exp(x) - 2*x) + log(x)*(2*x - (x^2 - 1)/x)

________________________________________________________________________________________

sympy [A]  time = 0.74, size = 24, normalized size = 0.83 \begin {gather*} - x \log {\left (- 2 x - 2 e^{x} + 2 \right )} + x + \frac {\left (x^{2} + 1\right ) \log {\relax (x )}}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((-exp(x)*x**2-x**3+x**2)*ln(-2*exp(x)-2*x+2)+(exp(x)*x**2+x**3-x**2)*ln(x*exp(1))+(1-exp(x)-x)*ln(x
)+(-x**3+x**2+1)*exp(x)-x**2+x-1)/(exp(x)*x**2+x**3-x**2),x)

[Out]

-x*log(-2*x - 2*exp(x) + 2) + x + (x**2 + 1)*log(x)/x

________________________________________________________________________________________