3.5.97 \(\int (-e^{-x}+e^x)^2 \, dx\) [497]

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 22, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {2320, 272, 45} \begin {gather*} -2 x-\frac {e^{-2 x}}{2}+\frac {e^{2 x}}{2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(-E^(-x) + E^x)^2,x]

[Out]

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

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 272

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

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*} \int \left (-e^{-x}+e^x\right )^2 \, dx &=\text {Subst}\left (\int \frac {\left (1-x^2\right )^2}{x^3} \, dx,x,e^x\right )\\ &=\frac {1}{2} \text {Subst}\left (\int \frac {(1-x)^2}{x^2} \, dx,x,e^{2 x}\right )\\ &=\frac {1}{2} \text {Subst}\left (\int \left (1+\frac {1}{x^2}-\frac {2}{x}\right ) \, dx,x,e^{2 x}\right )\\ &=-\frac {1}{2} e^{-2 x}+\frac {e^{2 x}}{2}-2 x\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 22, normalized size = 1.00 \begin {gather*} -\frac {1}{2} e^{-2 x}+\frac {e^{2 x}}{2}-2 x \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(-E^(-x) + E^x)^2,x]

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.02, size = 19, normalized size = 0.86

method result size
risch \(-2 x +\frac {{\mathrm e}^{2 x}}{2}-\frac {{\mathrm e}^{-2 x}}{2}\) \(17\)
derivativedivides \(\frac {{\mathrm e}^{2 x}}{2}-\frac {{\mathrm e}^{-2 x}}{2}-2 \ln \left ({\mathrm e}^{x}\right )\) \(19\)
default \(\frac {{\mathrm e}^{2 x}}{2}-\frac {{\mathrm e}^{-2 x}}{2}-2 \ln \left ({\mathrm e}^{x}\right )\) \(19\)
norman \(\left (-\frac {1}{2}+\frac {{\mathrm e}^{4 x}}{2}-2 \,{\mathrm e}^{2 x} x \right ) {\mathrm e}^{-2 x}\) \(21\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 2.78, size = 16, normalized size = 0.73 \begin {gather*} -2 \, x + \frac {1}{2} \, e^{\left (2 \, x\right )} - \frac {1}{2} \, e^{\left (-2 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.90, size = 21, normalized size = 0.95 \begin {gather*} -\frac {1}{2} \, {\left (4 \, x e^{\left (2 \, x\right )} - e^{\left (4 \, x\right )} + 1\right )} e^{\left (-2 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.03, size = 17, normalized size = 0.77 \begin {gather*} - 2 x + \frac {e^{2 x}}{2} - \frac {e^{- 2 x}}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 1.83, size = 24, normalized size = 1.09 \begin {gather*} \frac {1}{2} \, {\left (2 \, e^{\left (2 \, x\right )} - 1\right )} e^{\left (-2 \, x\right )} - 2 \, x + \frac {1}{2} \, e^{\left (2 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.06, size = 8, normalized size = 0.36 \begin {gather*} \mathrm {sinh}\left (2\,x\right )-2\,x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((exp(-x) - exp(x))^2,x)

[Out]

sinh(2*x) - 2*x

________________________________________________________________________________________