3.103.35 \(\int \frac {-2-2 x+e^x (-6+x^2)}{1+2 e^x+e^{2 x}} \, dx\)

Optimal. Leaf size=21 \[ \frac {5+e^x-2 x-x^2}{1+e^x} \]

________________________________________________________________________________________

Rubi [A]  time = 0.60, antiderivative size = 32, normalized size of antiderivative = 1.52, number of steps used = 40, number of rules used = 15, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.517, Rules used = {6741, 6742, 2282, 36, 29, 31, 2184, 2190, 2531, 6589, 44, 2185, 2279, 2391, 2191} \begin {gather*} -\frac {x^2}{e^x+1}-\frac {2 x}{e^x+1}+\frac {4}{e^x+1} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 36

Int[1/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[b/(b*c - a*d), Int[1/(a + b*x), x], x] -
Dist[d/(b*c - a*d), Int[1/(c + d*x), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0]

Rule 44

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}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && L
tQ[m + n + 2, 0])

Rule 2184

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

Rule 2185

Int[((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.))^(p_)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Dis
t[1/a, Int[(c + d*x)^m*(a + b*(F^(g*(e + f*x)))^n)^(p + 1), x], x] - Dist[b/a, Int[(c + d*x)^m*(F^(g*(e + f*x)
))^n*(a + b*(F^(g*(e + f*x)))^n)^p, x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && ILtQ[p, 0] && IGtQ[m, 0
]

Rule 2190

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

Rule 2191

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

Rule 2279

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

Rule 2282

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]

Rule 2391

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> -Simp[PolyLog[2, -(c*e*x^n)]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2531

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

Rule 6589

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

Rule 6741

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

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 \frac {-2-2 x+e^x \left (-6+x^2\right )}{\left (1+e^x\right )^2} \, dx\\ &=\int \left (\frac {-6+x^2}{1+e^x}-\frac {-4+2 x+x^2}{\left (1+e^x\right )^2}\right ) \, dx\\ &=\int \frac {-6+x^2}{1+e^x} \, dx-\int \frac {-4+2 x+x^2}{\left (1+e^x\right )^2} \, dx\\ &=-\int \left (-\frac {4}{\left (1+e^x\right )^2}+\frac {2 x}{\left (1+e^x\right )^2}+\frac {x^2}{\left (1+e^x\right )^2}\right ) \, dx+\int \left (-\frac {6}{1+e^x}+\frac {x^2}{1+e^x}\right ) \, dx\\ &=-\left (2 \int \frac {x}{\left (1+e^x\right )^2} \, dx\right )+4 \int \frac {1}{\left (1+e^x\right )^2} \, dx-6 \int \frac {1}{1+e^x} \, dx-\int \frac {x^2}{\left (1+e^x\right )^2} \, dx+\int \frac {x^2}{1+e^x} \, dx\\ &=\frac {x^3}{3}+2 \int \frac {e^x x}{\left (1+e^x\right )^2} \, dx-2 \int \frac {x}{1+e^x} \, dx+4 \operatorname {Subst}\left (\int \frac {1}{x (1+x)^2} \, dx,x,e^x\right )-6 \operatorname {Subst}\left (\int \frac {1}{x (1+x)} \, dx,x,e^x\right )+\int \frac {e^x x^2}{\left (1+e^x\right )^2} \, dx-\int \frac {x^2}{1+e^x} \, dx-\int \frac {e^x x^2}{1+e^x} \, dx\\ &=-\frac {2 x}{1+e^x}-x^2-\frac {x^2}{1+e^x}-x^2 \log \left (1+e^x\right )+2 \int \frac {1}{1+e^x} \, dx+2 \int \frac {x}{1+e^x} \, dx+2 \int \frac {e^x x}{1+e^x} \, dx+2 \int x \log \left (1+e^x\right ) \, dx+4 \operatorname {Subst}\left (\int \left (\frac {1}{-1-x}+\frac {1}{x}-\frac {1}{(1+x)^2}\right ) \, dx,x,e^x\right )-6 \operatorname {Subst}\left (\int \frac {1}{x} \, dx,x,e^x\right )+6 \operatorname {Subst}\left (\int \frac {1}{1+x} \, dx,x,e^x\right )+\int \frac {e^x x^2}{1+e^x} \, dx\\ &=\frac {4}{1+e^x}-2 x-\frac {2 x}{1+e^x}-\frac {x^2}{1+e^x}+2 \log \left (1+e^x\right )+2 x \log \left (1+e^x\right )-2 x \text {Li}_2\left (-e^x\right )-2 \int \frac {e^x x}{1+e^x} \, dx-2 \int \log \left (1+e^x\right ) \, dx-2 \int x \log \left (1+e^x\right ) \, dx+2 \int \text {Li}_2\left (-e^x\right ) \, dx+2 \operatorname {Subst}\left (\int \frac {1}{x (1+x)} \, dx,x,e^x\right )\\ &=\frac {4}{1+e^x}-2 x-\frac {2 x}{1+e^x}-\frac {x^2}{1+e^x}+2 \log \left (1+e^x\right )+2 \int \log \left (1+e^x\right ) \, dx-2 \int \text {Li}_2\left (-e^x\right ) \, dx+2 \operatorname {Subst}\left (\int \frac {1}{x} \, dx,x,e^x\right )-2 \operatorname {Subst}\left (\int \frac {1}{1+x} \, dx,x,e^x\right )-2 \operatorname {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^x\right )+2 \operatorname {Subst}\left (\int \frac {\text {Li}_2(-x)}{x} \, dx,x,e^x\right )\\ &=\frac {4}{1+e^x}-\frac {2 x}{1+e^x}-\frac {x^2}{1+e^x}+2 \text {Li}_2\left (-e^x\right )+2 \text {Li}_3\left (-e^x\right )+2 \operatorname {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^x\right )-2 \operatorname {Subst}\left (\int \frac {\text {Li}_2(-x)}{x} \, dx,x,e^x\right )\\ &=\frac {4}{1+e^x}-\frac {2 x}{1+e^x}-\frac {x^2}{1+e^x}\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]  time = 0.10, size = 18, normalized size = 0.86 \begin {gather*} \frac {4-2 x-x^2}{1+e^x} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.83, size = 16, normalized size = 0.76 \begin {gather*} -\frac {x^{2} + 2 \, x - 4}{e^{x} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.15, size = 16, normalized size = 0.76 \begin {gather*} -\frac {x^{2} + 2 \, x - 4}{e^{x} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.08, size = 17, normalized size = 0.81




method result size



risch \(-\frac {x^{2}+2 x -4}{{\mathrm e}^{x}+1}\) \(17\)
norman \(\frac {-x^{2}-2 x +4}{{\mathrm e}^{x}+1}\) \(18\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.38, size = 30, normalized size = 1.43 \begin {gather*} -2 \, x - \frac {x^{2} - 2 \, x e^{x} - 6}{e^{x} + 1} - \frac {2}{e^{x} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 5.77, size = 16, normalized size = 0.76 \begin {gather*} -\frac {x^2+2\,x-4}{{\mathrm {e}}^x+1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 0.10, size = 12, normalized size = 0.57 \begin {gather*} \frac {- x^{2} - 2 x + 4}{e^{x} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________