\(\int \frac {-16-8 x+9 x^2+(8+6 x-2 x^2) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx\) [7895]

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

Optimal result

Integrand size = 65, antiderivative size = 19 \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=-6-x+\frac {x^2}{4-\log (1+x)} \]

[Out]

-6-x+x^2/(4-ln(1+x))

Rubi [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(45\) vs. \(2(19)=38\).

Time = 0.33 (sec) , antiderivative size = 45, normalized size of antiderivative = 2.37, number of steps used = 22, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.215, Rules used = {6873, 6874, 2458, 2395, 2334, 2336, 2209, 2339, 30, 2343, 2346, 2446, 2436, 2437} \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=-x+\frac {(x+1)^2}{4-\log (x+1)}-\frac {2 (x+1)}{4-\log (x+1)}+\frac {1}{4-\log (x+1)} \]

[In]

Int[(-16 - 8*x + 9*x^2 + (8 + 6*x - 2*x^2)*Log[1 + x] + (-1 - x)*Log[1 + x]^2)/(16 + 16*x + (-8 - 8*x)*Log[1 +
 x] + (1 + x)*Log[1 + x]^2),x]

[Out]

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

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2209

Int[(F_)^((g_.)*((e_.) + (f_.)*(x_)))/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[(F^(g*(e - c*(f/d)))/d)*ExpInteg
ralEi[f*g*(c + d*x)*(Log[F]/d)], x] /; FreeQ[{F, c, d, e, f, g}, x] &&  !TrueQ[$UseGamma]

Rule 2334

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

Rule 2336

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

Rule 2339

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

Rule 2343

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log
[c*x^n])^(p + 1)/(b*d*n*(p + 1))), x] - Dist[(m + 1)/(b*n*(p + 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] && LtQ[p, -1]

Rule 2346

Int[((a_.) + Log[(c_.)*(x_)]*(b_.))^(p_)*(x_)^(m_.), x_Symbol] :> Dist[1/c^(m + 1), Subst[Int[E^((m + 1)*x)*(a
 + b*x)^p, x], x, Log[c*x]], x] /; FreeQ[{a, b, c, p}, x] && IntegerQ[m]

Rule 2395

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((f_.)*(x_))^(m_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol]
:> With[{u = ExpandIntegrand[(a + b*Log[c*x^n])^p, (f*x)^m*(d + e*x^r)^q, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[
{a, b, c, d, e, f, m, n, p, q, r}, x] && IntegerQ[q] && (GtQ[q, 0] || (IGtQ[p, 0] && IntegerQ[m] && IntegerQ[r
]))

Rule 2436

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 2437

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

Rule 2446

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

Rule 2458

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 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 {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{(1+x) (4-\log (1+x))^2} \, dx \\ & = \int \left (-1+\frac {x^2}{(1+x) (-4+\log (1+x))^2}-\frac {2 x}{-4+\log (1+x)}\right ) \, dx \\ & = -x-2 \int \frac {x}{-4+\log (1+x)} \, dx+\int \frac {x^2}{(1+x) (-4+\log (1+x))^2} \, dx \\ & = -x-2 \int \left (-\frac {1}{-4+\log (1+x)}+\frac {1+x}{-4+\log (1+x)}\right ) \, dx+\text {Subst}\left (\int \frac {(-1+x)^2}{x (-4+\log (x))^2} \, dx,x,1+x\right ) \\ & = -x+2 \int \frac {1}{-4+\log (1+x)} \, dx-2 \int \frac {1+x}{-4+\log (1+x)} \, dx+\text {Subst}\left (\int \left (-\frac {2}{(-4+\log (x))^2}+\frac {1}{x (-4+\log (x))^2}+\frac {x}{(-4+\log (x))^2}\right ) \, dx,x,1+x\right ) \\ & = -x-2 \text {Subst}\left (\int \frac {1}{(-4+\log (x))^2} \, dx,x,1+x\right )+2 \text {Subst}\left (\int \frac {1}{-4+\log (x)} \, dx,x,1+x\right )-2 \text {Subst}\left (\int \frac {x}{-4+\log (x)} \, dx,x,1+x\right )+\text {Subst}\left (\int \frac {1}{x (-4+\log (x))^2} \, dx,x,1+x\right )+\text {Subst}\left (\int \frac {x}{(-4+\log (x))^2} \, dx,x,1+x\right ) \\ & = -x-\frac {2 (1+x)}{4-\log (1+x)}+\frac {(1+x)^2}{4-\log (1+x)}+2 \text {Subst}\left (\int \frac {e^x}{-4+x} \, dx,x,\log (1+x)\right )-2 \text {Subst}\left (\int \frac {e^{2 x}}{-4+x} \, dx,x,\log (1+x)\right )-2 \text {Subst}\left (\int \frac {1}{-4+\log (x)} \, dx,x,1+x\right )+2 \text {Subst}\left (\int \frac {x}{-4+\log (x)} \, dx,x,1+x\right )+\text {Subst}\left (\int \frac {1}{x^2} \, dx,x,-4+\log (1+x)\right ) \\ & = -x-2 e^8 \operatorname {ExpIntegralEi}(-2 (4-\log (1+x)))+2 e^4 \operatorname {ExpIntegralEi}(-4+\log (1+x))-\frac {2 (1+x)}{4-\log (1+x)}+\frac {(1+x)^2}{4-\log (1+x)}-\frac {1}{-4+\log (1+x)}-2 \text {Subst}\left (\int \frac {e^x}{-4+x} \, dx,x,\log (1+x)\right )+2 \text {Subst}\left (\int \frac {e^{2 x}}{-4+x} \, dx,x,\log (1+x)\right ) \\ & = -x-\frac {2 (1+x)}{4-\log (1+x)}+\frac {(1+x)^2}{4-\log (1+x)}-\frac {1}{-4+\log (1+x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.18 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.89 \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=-x-\frac {x^2}{-4+\log (1+x)} \]

[In]

Integrate[(-16 - 8*x + 9*x^2 + (8 + 6*x - 2*x^2)*Log[1 + x] + (-1 - x)*Log[1 + x]^2)/(16 + 16*x + (-8 - 8*x)*L
og[1 + x] + (1 + x)*Log[1 + x]^2),x]

[Out]

-x - x^2/(-4 + Log[1 + x])

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.95

method result size
risch \(-x -\frac {x^{2}}{\ln \left (1+x \right )-4}\) \(18\)
norman \(\frac {4 x -x^{2}-\ln \left (1+x \right ) x}{\ln \left (1+x \right )-4}\) \(26\)
parallelrisch \(\frac {-8-x^{2}-\ln \left (1+x \right ) x +4 x +2 \ln \left (1+x \right )}{\ln \left (1+x \right )-4}\) \(33\)
derivativedivides \(-1-x +\frac {2+2 x}{\ln \left (1+x \right )-4}-\frac {1}{\ln \left (1+x \right )-4}-\frac {\left (1+x \right )^{2}}{\ln \left (1+x \right )-4}\) \(44\)
default \(-1-x +\frac {2+2 x}{\ln \left (1+x \right )-4}-\frac {1}{\ln \left (1+x \right )-4}-\frac {\left (1+x \right )^{2}}{\ln \left (1+x \right )-4}\) \(44\)

[In]

int(((-1-x)*ln(1+x)^2+(-2*x^2+6*x+8)*ln(1+x)+9*x^2-8*x-16)/((1+x)*ln(1+x)^2+(-8*x-8)*ln(1+x)+16*x+16),x,method
=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.21 \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=-\frac {x^{2} + x \log \left (x + 1\right ) - 4 \, x}{\log \left (x + 1\right ) - 4} \]

[In]

integrate(((-1-x)*log(1+x)^2+(-2*x^2+6*x+8)*log(1+x)+9*x^2-8*x-16)/((1+x)*log(1+x)^2+(-8*x-8)*log(1+x)+16*x+16
),x, algorithm="fricas")

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.63 \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=- \frac {x^{2}}{\log {\left (x + 1 \right )} - 4} - x \]

[In]

integrate(((-1-x)*ln(1+x)**2+(-2*x**2+6*x+8)*ln(1+x)+9*x**2-8*x-16)/((1+x)*ln(1+x)**2+(-8*x-8)*ln(1+x)+16*x+16
),x)

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.84 \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=-\frac {x^{2} + x \log \left (x + 1\right ) - 4 \, x + 16}{\log \left (x + 1\right ) - 4} + \frac {16}{\log \left (x + 1\right ) - 4} \]

[In]

integrate(((-1-x)*log(1+x)^2+(-2*x^2+6*x+8)*log(1+x)+9*x^2-8*x-16)/((1+x)*log(1+x)^2+(-8*x-8)*log(1+x)+16*x+16
),x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.89 \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=-x - \frac {x^{2}}{\log \left (x + 1\right ) - 4} \]

[In]

integrate(((-1-x)*log(1+x)^2+(-2*x^2+6*x+8)*log(1+x)+9*x^2-8*x-16)/((1+x)*log(1+x)^2+(-8*x-8)*log(1+x)+16*x+16
),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 12.18 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.89 \[ \int \frac {-16-8 x+9 x^2+\left (8+6 x-2 x^2\right ) \log (1+x)+(-1-x) \log ^2(1+x)}{16+16 x+(-8-8 x) \log (1+x)+(1+x) \log ^2(1+x)} \, dx=-x-\frac {x^2}{\ln \left (x+1\right )-4} \]

[In]

int(-(8*x - log(x + 1)*(6*x - 2*x^2 + 8) - 9*x^2 + log(x + 1)^2*(x + 1) + 16)/(16*x - log(x + 1)*(8*x + 8) + l
og(x + 1)^2*(x + 1) + 16),x)

[Out]

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