\(\int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx\) [6321]

   Optimal result
   Rubi [A] (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 = 47, antiderivative size = 13 \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=4+\frac {1}{3-e+e^x}+x \]

[Out]

4+x+1/(exp(x)+3-exp(1))

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.92, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.043, Rules used = {2320, 907} \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=x+\frac {1}{e^x+3-e} \]

[In]

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

[Out]

(3 - E + E^x)^(-1) + x

Rule 907

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :
> Int[ExpandIntegrand[(d + e*x)^m*(f + g*x)^n*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] &
& NeQ[e*f - d*g, 0] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && IntegerQ[p] && ((EqQ[p, 1] && I
ntegersQ[m, n]) || (ILtQ[m, 0] && ILtQ[n, 0]))

Rule 2320

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]]]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {(-3+e)^2+(5-2 e) x+x^2}{x (3-e+x)^2} \, dx,x,e^x\right ) \\ & = \text {Subst}\left (\int \left (-\frac {1}{(-3+e-x)^2}+\frac {1}{x}\right ) \, dx,x,e^x\right ) \\ & = \frac {1}{3-e+e^x}+x \\ \end{align*}

Mathematica [A] (verified)

Time = 0.21 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.92 \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=\frac {1}{3-e+e^x}+x \]

[In]

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

[Out]

(3 - E + E^x)^(-1) + x

Maple [A] (verified)

Time = 0.52 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.15

method result size
risch \(x -\frac {1}{-{\mathrm e}^{x}+{\mathrm e}-3}\) \(15\)
norman \(\frac {\left ({\mathrm e}-3\right ) x -{\mathrm e}^{x} x -1}{-{\mathrm e}^{x}+{\mathrm e}-3}\) \(25\)
parallelrisch \(\frac {x \,{\mathrm e}-{\mathrm e}^{x} x -3 x -1}{-{\mathrm e}^{x}+{\mathrm e}-3}\) \(26\)
default \(\frac {\frac {{\mathrm e}^{2} x}{{\mathrm e}-3}+\frac {{\mathrm e}^{2}}{{\mathrm e}-3}-\frac {{\mathrm e}^{2} x \,{\mathrm e}^{x}}{{\mathrm e}^{2}-6 \,{\mathrm e}+9}}{-{\mathrm e}^{x}+{\mathrm e}-3}-\frac {{\mathrm e}^{2} \ln \left (-{\mathrm e}^{x}+{\mathrm e}-3\right )}{{\mathrm e}^{2}-6 \,{\mathrm e}+9}+\frac {{\mathrm e}-3}{-{\mathrm e}^{x}+{\mathrm e}-3}+\ln \left (-{\mathrm e}^{x}+{\mathrm e}-3\right )+\frac {\frac {9 x}{{\mathrm e}-3}+\frac {9}{{\mathrm e}-3}-\frac {9 x \,{\mathrm e}^{x}}{{\mathrm e}^{2}-6 \,{\mathrm e}+9}}{-{\mathrm e}^{x}+{\mathrm e}-3}-\frac {9 \ln \left (-{\mathrm e}^{x}+{\mathrm e}-3\right )}{{\mathrm e}^{2}-6 \,{\mathrm e}+9}+\frac {-\frac {6 \,{\mathrm e}}{{\mathrm e}-3}-\frac {6 \,{\mathrm e} x}{{\mathrm e}-3}+\frac {6 \,{\mathrm e} x \,{\mathrm e}^{x}}{{\mathrm e}^{2}-6 \,{\mathrm e}+9}}{-{\mathrm e}^{x}+{\mathrm e}-3}+\frac {6 \,{\mathrm e} \ln \left (-{\mathrm e}^{x}+{\mathrm e}-3\right )}{{\mathrm e}^{2}-6 \,{\mathrm e}+9}+\frac {5}{-{\mathrm e}^{x}+{\mathrm e}-3}-\frac {2 \,{\mathrm e}}{-{\mathrm e}^{x}+{\mathrm e}-3}\) \(281\)

[In]

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

[Out]

x-1/(-exp(x)+exp(1)-3)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.92 \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=\frac {x e - x e^{x} - 3 \, x - 1}{e - e^{x} - 3} \]

[In]

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

[Out]

(x*e - x*e^x - 3*x - 1)/(e - e^x - 3)

Sympy [A] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.77 \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=x + \frac {1}{e^{x} - e + 3} \]

[In]

integrate((exp(x)**2+(-2*exp(1)+5)*exp(x)+exp(1)**2-6*exp(1)+9)/(exp(x)**2+(-2*exp(1)+6)*exp(x)+exp(1)**2-6*ex
p(1)+9),x)

[Out]

x + 1/(exp(x) - E + 3)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.08 \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=x - \frac {1}{e - e^{x} - 3} \]

[In]

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

[Out]

x - 1/(e - e^x - 3)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.08 \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=x - \frac {1}{e - e^{x} - 3} \]

[In]

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

[Out]

x - 1/(e - e^x - 3)

Mupad [B] (verification not implemented)

Time = 11.23 (sec) , antiderivative size = 28, normalized size of antiderivative = 2.15 \[ \int \frac {9-6 e+e^2+(5-2 e) e^x+e^{2 x}}{9-6 e+e^2+(6-2 e) e^x+e^{2 x}} \, dx=\frac {1}{{\mathrm {e}}^x-\mathrm {e}+3}-\frac {3\,x-x\,\mathrm {e}}{\mathrm {e}-3} \]

[In]

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

[Out]

1/(exp(x) - exp(1) + 3) - (3*x - x*exp(1))/(exp(1) - 3)