\(\int \frac {9 x^2+e (-54 x+18 x^2)+(-54 x+18 x^2) \log (3-x)+(108 x-36 x^2) \log (x^2)+(54 x-18 x^2) \log ^2(x^2)}{-3+x} \, dx\) [5216]

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

Optimal result

Integrand size = 69, antiderivative size = 21 \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=9 x^2 \left (e+\log (3-x)-\log ^2\left (x^2\right )\right ) \]

[Out]

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

Rubi [A] (verified)

Time = 0.34 (sec) , antiderivative size = 42, normalized size of antiderivative = 2.00, number of steps used = 16, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.145, Rules used = {6873, 12, 6820, 6874, 14, 78, 2442, 45, 2341, 2342} \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=\frac {9}{2} (1+2 e) x^2-\frac {9 x^2}{2}-9 x^2 \log ^2\left (x^2\right )+9 x^2 \log (3-x) \]

[In]

Int[(9*x^2 + E*(-54*x + 18*x^2) + (-54*x + 18*x^2)*Log[3 - x] + (108*x - 36*x^2)*Log[x^2] + (54*x - 18*x^2)*Lo
g[x^2]^2)/(-3 + x),x]

[Out]

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

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, 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 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 2341

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

Rule 2342

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Lo
g[c*x^n])^p/(d*(m + 1))), x] - Dist[b*n*(p/(m + 1)), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rule 2442

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))*((f_.) + (g_.)*(x_))^(q_.), x_Symbol] :> Simp[(f + g*
x)^(q + 1)*((a + b*Log[c*(d + e*x)^n])/(g*(q + 1))), x] - Dist[b*e*(n/(g*(q + 1))), Int[(f + g*x)^(q + 1)/(d +
 e*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, n, q}, x] && NeQ[e*f - d*g, 0] && NeQ[q, -1]

Rule 6820

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

Rule 6873

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

Rule 6874

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

Rubi steps \begin{align*} \text {integral}& = \int \frac {9 x \left (6 e-(1+2 e) x+6 \log (3-x)-2 x \log (3-x)-12 \log \left (x^2\right )+4 x \log \left (x^2\right )-6 \log ^2\left (x^2\right )+2 x \log ^2\left (x^2\right )\right )}{3-x} \, dx \\ & = 9 \int \frac {x \left (6 e-(1+2 e) x+6 \log (3-x)-2 x \log (3-x)-12 \log \left (x^2\right )+4 x \log \left (x^2\right )-6 \log ^2\left (x^2\right )+2 x \log ^2\left (x^2\right )\right )}{3-x} \, dx \\ & = 9 \int \frac {x \left (6 e-(1+2 e) x-2 (-3+x) \log (3-x)+4 (-3+x) \log \left (x^2\right )+2 (-3+x) \log ^2\left (x^2\right )\right )}{3-x} \, dx \\ & = 9 \int \left (\frac {x (6 e-(1+2 e) x+6 \log (3-x)-2 x \log (3-x))}{3-x}-4 x \log \left (x^2\right )-2 x \log ^2\left (x^2\right )\right ) \, dx \\ & = 9 \int \frac {x (6 e-(1+2 e) x+6 \log (3-x)-2 x \log (3-x))}{3-x} \, dx-18 \int x \log ^2\left (x^2\right ) \, dx-36 \int x \log \left (x^2\right ) \, dx \\ & = 18 x^2-18 x^2 \log \left (x^2\right )-9 x^2 \log ^2\left (x^2\right )+9 \int x \left (2 e+\frac {x}{-3+x}+2 \log (3-x)\right ) \, dx+36 \int x \log \left (x^2\right ) \, dx \\ & = -9 x^2 \log ^2\left (x^2\right )+9 \int \left (\frac {x (6 e-(1+2 e) x)}{3-x}+2 x \log (3-x)\right ) \, dx \\ & = -9 x^2 \log ^2\left (x^2\right )+9 \int \frac {x (6 e-(1+2 e) x)}{3-x} \, dx+18 \int x \log (3-x) \, dx \\ & = 9 x^2 \log (3-x)-9 x^2 \log ^2\left (x^2\right )+9 \int \frac {x^2}{3-x} \, dx+9 \int \left (3+\frac {9}{-3+x}+(1+2 e) x\right ) \, dx \\ & = 27 x+\frac {9}{2} (1+2 e) x^2+81 \log (3-x)+9 x^2 \log (3-x)-9 x^2 \log ^2\left (x^2\right )+9 \int \left (-3-\frac {9}{-3+x}-x\right ) \, dx \\ & = -\frac {9 x^2}{2}+\frac {9}{2} (1+2 e) x^2+9 x^2 \log (3-x)-9 x^2 \log ^2\left (x^2\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.38 \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=9 \left (e x^2+x^2 \log (3-x)-x^2 \log ^2\left (x^2\right )\right ) \]

[In]

Integrate[(9*x^2 + E*(-54*x + 18*x^2) + (-54*x + 18*x^2)*Log[3 - x] + (108*x - 36*x^2)*Log[x^2] + (54*x - 18*x
^2)*Log[x^2]^2)/(-3 + x),x]

[Out]

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

Maple [A] (verified)

Time = 0.67 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.67

method result size
parallelrisch \(-9 x^{2} \ln \left (x^{2}\right )^{2}+9 x^{2} {\mathrm e}+9 \ln \left (-x +3\right ) x^{2}-81 \,{\mathrm e}\) \(35\)
default \(-9 x^{2} \ln \left (x^{2}\right )^{2}-54 \left (-x +3\right ) \ln \left (-x +3\right )+\frac {243}{2}+9 \ln \left (-x +3\right ) \left (-x +3\right )^{2}+9 x^{2} {\mathrm e}+81 \ln \left (-3+x \right )\) \(55\)
parts \(-9 x^{2} \ln \left (x^{2}\right )^{2}-54 \left (-x +3\right ) \ln \left (-x +3\right )+\frac {243}{2}+9 \ln \left (-x +3\right ) \left (-x +3\right )^{2}+9 x^{2} {\mathrm e}+81 \ln \left (-3+x \right )\) \(55\)
risch \(9 \ln \left (-x +3\right ) x^{2}-36 x^{2} \ln \left (x \right )^{2}+18 i \pi \,x^{2} \operatorname {csgn}\left (i x \right )^{2} \operatorname {csgn}\left (i x^{2}\right ) \ln \left (x \right )-36 i \pi \,x^{2} \operatorname {csgn}\left (i x \right ) \operatorname {csgn}\left (i x^{2}\right )^{2} \ln \left (x \right )+18 i \pi \,x^{2} \operatorname {csgn}\left (i x^{2}\right )^{3} \ln \left (x \right )+\frac {9 \pi ^{2} x^{2} \operatorname {csgn}\left (i x \right )^{4} \operatorname {csgn}\left (i x^{2}\right )^{2}}{4}-9 \pi ^{2} x^{2} \operatorname {csgn}\left (i x \right )^{3} \operatorname {csgn}\left (i x^{2}\right )^{3}+\frac {27 \pi ^{2} x^{2} \operatorname {csgn}\left (i x \right )^{2} \operatorname {csgn}\left (i x^{2}\right )^{4}}{2}-9 \pi ^{2} x^{2} \operatorname {csgn}\left (i x \right ) \operatorname {csgn}\left (i x^{2}\right )^{5}+\frac {9 \pi ^{2} x^{2} \operatorname {csgn}\left (i x^{2}\right )^{6}}{4}+9 x^{2} {\mathrm e}\) \(204\)

[In]

int(((-18*x^2+54*x)*ln(x^2)^2+(-36*x^2+108*x)*ln(x^2)+(18*x^2-54*x)*ln(-x+3)+(18*x^2-54*x)*exp(1)+9*x^2)/(-3+x
),x,method=_RETURNVERBOSE)

[Out]

-9*x^2*ln(x^2)^2+9*x^2*exp(1)+9*ln(-x+3)*x^2-81*exp(1)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.43 \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=-9 \, x^{2} \log \left (x^{2}\right )^{2} + 9 \, x^{2} e + 9 \, x^{2} \log \left (-x + 3\right ) \]

[In]

integrate(((-18*x^2+54*x)*log(x^2)^2+(-36*x^2+108*x)*log(x^2)+(18*x^2-54*x)*log(-x+3)+(18*x^2-54*x)*exp(1)+9*x
^2)/(-3+x),x, algorithm="fricas")

[Out]

-9*x^2*log(x^2)^2 + 9*x^2*e + 9*x^2*log(-x + 3)

Sympy [A] (verification not implemented)

Time = 0.24 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.76 \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=- 9 x^{2} \log {\left (x^{2} \right )}^{2} + 9 e x^{2} + \left (9 x^{2} - 27\right ) \log {\left (3 - x \right )} + 27 \log {\left (x - 3 \right )} \]

[In]

integrate(((-18*x**2+54*x)*ln(x**2)**2+(-36*x**2+108*x)*ln(x**2)+(18*x**2-54*x)*ln(-x+3)+(18*x**2-54*x)*exp(1)
+9*x**2)/(-3+x),x)

[Out]

-9*x**2*log(x**2)**2 + 9*E*x**2 + (9*x**2 - 27)*log(3 - x) + 27*log(x - 3)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (24) = 48\).

Time = 0.23 (sec) , antiderivative size = 76, normalized size of antiderivative = 3.62 \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=-36 \, x^{2} \log \left (x\right )^{2} + 9 \, {\left (x^{2} + 6 \, x + 18 \, \log \left (x - 3\right )\right )} e - 54 \, {\left (x + 3 \, \log \left (x - 3\right )\right )} e + 9 \, {\left (x^{2} + 6 \, x + 18 \, \log \left (x - 3\right )\right )} \log \left (-x + 3\right ) - 54 \, {\left (x + 3 \, \log \left (x - 3\right )\right )} \log \left (-x + 3\right ) \]

[In]

integrate(((-18*x^2+54*x)*log(x^2)^2+(-36*x^2+108*x)*log(x^2)+(18*x^2-54*x)*log(-x+3)+(18*x^2-54*x)*exp(1)+9*x
^2)/(-3+x),x, algorithm="maxima")

[Out]

-36*x^2*log(x)^2 + 9*(x^2 + 6*x + 18*log(x - 3))*e - 54*(x + 3*log(x - 3))*e + 9*(x^2 + 6*x + 18*log(x - 3))*l
og(-x + 3) - 54*(x + 3*log(x - 3))*log(-x + 3)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.43 \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=-9 \, x^{2} \log \left (x^{2}\right )^{2} + 9 \, x^{2} e + 9 \, x^{2} \log \left (-x + 3\right ) \]

[In]

integrate(((-18*x^2+54*x)*log(x^2)^2+(-36*x^2+108*x)*log(x^2)+(18*x^2-54*x)*log(-x+3)+(18*x^2-54*x)*exp(1)+9*x
^2)/(-3+x),x, algorithm="giac")

[Out]

-9*x^2*log(x^2)^2 + 9*x^2*e + 9*x^2*log(-x + 3)

Mupad [B] (verification not implemented)

Time = 11.83 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.05 \[ \int \frac {9 x^2+e \left (-54 x+18 x^2\right )+\left (-54 x+18 x^2\right ) \log (3-x)+\left (108 x-36 x^2\right ) \log \left (x^2\right )+\left (54 x-18 x^2\right ) \log ^2\left (x^2\right )}{-3+x} \, dx=9\,x^2\,\left (-{\ln \left (x^2\right )}^2+\mathrm {e}+\ln \left (3-x\right )\right ) \]

[In]

int((log(x^2)*(108*x - 36*x^2) - exp(1)*(54*x - 18*x^2) - log(3 - x)*(54*x - 18*x^2) + log(x^2)^2*(54*x - 18*x
^2) + 9*x^2)/(x - 3),x)

[Out]

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