3.45.4 \(\int \frac {-4 x+6 x^2-2 x^3+e^{x^2} (-2+x) (-1+5 x-6 x^2+2 x^3)+(-4 x+2 x^2) \log (-1+x)+(2-3 x+x^2) \log ^2(-1+x)}{2-3 x+x^2} \, dx\)

Optimal. Leaf size=24 \[ 3+e^{x^2} (-2+x)-x^2+x \log ^2(-1+x) \]

________________________________________________________________________________________

Rubi [A]  time = 0.24, antiderivative size = 39, normalized size of antiderivative = 1.62, number of steps used = 15, number of rules used = 11, integrand size = 78, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.141, Rules used = {6688, 2226, 2204, 2209, 2212, 2411, 2346, 2301, 2295, 2389, 2296} \begin {gather*} -x^2+e^{x^2} x-2 e^{x^2}-(1-x) \log ^2(x-1)+\log ^2(x-1) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 2204

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[(F^a*Sqrt[Pi]*Erfi[(c + d*x)*Rt[b*Log[F], 2
]])/(2*d*Rt[b*Log[F], 2]), x] /; FreeQ[{F, a, b, c, d}, x] && PosQ[b]

Rule 2209

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*((e_.) + (f_.)*(x_))^(m_.), x_Symbol] :> Simp[((e + f*x)^n*
F^(a + b*(c + d*x)^n))/(b*f*n*(c + d*x)^n*Log[F]), x] /; FreeQ[{F, a, b, c, d, e, f, n}, x] && EqQ[m, n - 1] &
& EqQ[d*e - c*f, 0]

Rule 2212

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[((c + d*x)^(m
 - n + 1)*F^(a + b*(c + d*x)^n))/(b*d*n*Log[F]), x] - Dist[(m - n + 1)/(b*n*Log[F]), Int[(c + d*x)^(m - n)*F^(
a + b*(c + d*x)^n), x], x] /; FreeQ[{F, a, b, c, d}, x] && IntegerQ[(2*(m + 1))/n] && LtQ[0, (m + 1)/n, 5] &&
IntegerQ[n] && (LtQ[0, n, m + 1] || LtQ[m, n, 0])

Rule 2226

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*(u_), x_Symbol] :> Int[ExpandLinearProduct[F^(a + b*(c + d*
x)^n), u, c, d, x], x] /; FreeQ[{F, a, b, c, d, n}, x] && PolynomialQ[u, x]

Rule 2295

Int[Log[(c_.)*(x_)^(n_.)], x_Symbol] :> Simp[x*Log[c*x^n], x] - Simp[n*x, x] /; FreeQ[{c, n}, x]

Rule 2296

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.), x_Symbol] :> Simp[x*(a + b*Log[c*x^n])^p, x] - Dist[b*n*p, In
t[(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b, c, n}, x] && GtQ[p, 0] && IntegerQ[2*p]

Rule 2301

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))/(x_), x_Symbol] :> Simp[(a + b*Log[c*x^n])^2/(2*b*n), x] /; FreeQ[{a
, b, c, n}, x]

Rule 2346

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

Rule 2389

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

Rule 2411

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))^(p_.)*((f_.) + (g_.)*(x_))^(q_.)*((h_.) + (i_.)*(x_))
^(r_.), x_Symbol] :> Dist[1/e, Subst[Int[((g*x)/e)^q*((e*h - d*i)/e + (i*x)/e)^r*(a + b*Log[c*x^n])^p, x], x,
d + e*x], x] /; FreeQ[{a, b, c, d, e, f, g, h, i, n, p, q, r}, x] && EqQ[e*f - d*g, 0] && (IGtQ[p, 0] || IGtQ[
r, 0]) && IntegerQ[2*r]

Rule 6688

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 23, normalized size = 0.96 \begin {gather*} e^{x^2} (-2+x)-x^2+x \log ^2(-1+x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 1.01, size = 23, normalized size = 0.96 \begin {gather*} x \log \left (x - 1\right )^{2} - x^{2} + e^{\left (x^{2} + \log \left (x - 2\right )\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.17, size = 23, normalized size = 0.96




method result size



risch \(\ln \left (x -1\right )^{2} x -x^{2}+\left (x -2\right ) {\mathrm e}^{x^{2}}\) \(23\)
default \(\left (x -1\right ) \ln \left (x -1\right )^{2}-2 \,{\mathrm e}^{x^{2}}+{\mathrm e}^{x^{2}} x -x^{2}+\ln \left (x -1\right )^{2}\) \(35\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.45, size = 26, normalized size = 1.08 \begin {gather*} x\,{\mathrm {e}}^{x^2}-2\,{\mathrm {e}}^{x^2}+x\,{\ln \left (x-1\right )}^2-x^2 \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 0.34, size = 19, normalized size = 0.79 \begin {gather*} - x^{2} + x \log {\left (x - 1 \right )}^{2} + \left (x - 2\right ) e^{x^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________