# Possible error in Sage

Dear all, while trying to calculate the integral of:

integrate (x*e^(2*x-(x^2)/2), x)

I got this:

1/2*I*sqrt(2)*(-2*I*sqrt(pi)*(x - 2)*(erf(sqrt(1/2)*sqrt((x - 2)^2)) - 1)/sqrt((x - 2)^2) + I*sqrt(2)*e^(-1/2*(x - 2)^2))*e^2

Which is actually wrong.

The answer is simply e^x²

Cheers

Sergio

Are you sure about your statement ? The derivative of

`e^(x^2)`

is`2*x*e^(x^2)`

, which seem not equal to your first function.yeah the function you first stated is x*(e^(2x-(x^2)/2)) which is not equal to e^x^2, also (according to sage) the integral of your stated function is what you stated and for e^x^2 the integral is -sqrt(pi)i/2 * erf(ix)