Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Strange behviour when trying to integrate gaussian function. bug?

I was trying integrate the following function

y=var('y')
integrate(x*exp(-(x-y)*(x-y)*2.0),x)

$$\frac{1}{8} \, {\left(\frac{2 \, {\left(\text{erf}\left(\sqrt{2} \sqrt{{\left(x - y\right)}^{2}}\right) - 1\right)} {\left(x - y\right)} \sqrt{\pi} y}{\sqrt{{\left(x - y\right)}^{2}}} - \sqrt{2} e^{\left(-2 \, {\left(x - y\right)}^{2}\right)}\right)} \sqrt{2}$$ The integral can easily be done by redefining variables and does not have to be expressed in terms of error functions. Also the behavior of sage becomes even strange when I change the coefficient from 2.0 to 2.1. Sage just refuses to do the integral

integrate(x*exp(-(x-y)*(x-y)*2.1),x)

$$\int x e^{\left(-2.1 \, {\left(x - y\right)}^{2}\right)}\,{d x}$$

Any ideas on how to make sage give an answer in the usual exponential form?

Strange behviour when trying to integrate gaussian function. bug?

I was trying integrate the following function

y=var('y')
integrate(x*exp(-(x-y)*(x-y)*2.0),x)

$$\frac{1}{8} \, {\left(\frac{2 \, {\left(\text{erf}\left(\sqrt{2} \sqrt{{\left(x - y\right)}^{2}}\right) - 1\right)} {\left(x - y\right)} \sqrt{\pi} y}{\sqrt{{\left(x - y\right)}^{2}}} - \sqrt{2} e^{\left(-2 \, {\left(x - y\right)}^{2}\right)}\right)} \sqrt{2}$$ The integral can easily be done by redefining variables and does not have to be expressed in terms of error functions. Also the behavior of sage becomes even strange when I change the coefficient from 2.0 to 2.1. Sage just refuses to do the integral

integrate(x*exp(-(x-y)*(x-y)*2.1),x)

$$\int x e^{\left(-2.1 \, {\left(x - y\right)}^{2}\right)}\,{d x}$$

Any ideas on how to make sage give an answer in the usual exponential form?form? Edit: Sorry. My bad. It is an error function. However, I expect error function even for the second example, when I replace 2 by 2.1. Any ideas why that is the case?

Strange behviour when trying to integrate gaussian function. bug?

I was trying integrate the following function

y=var('y')
integrate(x*exp(-(x-y)*(x-y)*2.0),x)

$$\frac{1}{8} \, {\left(\frac{2 \, {\left(\text{erf}\left(\sqrt{2} \sqrt{{\left(x - y\right)}^{2}}\right) - 1\right)} {\left(x - y\right)} \sqrt{\pi} y}{\sqrt{{\left(x - y\right)}^{2}}} - \sqrt{2} e^{\left(-2 \, {\left(x - y\right)}^{2}\right)}\right)} \sqrt{2}$$ The integral can easily be done by redefining variables and does not have to be expressed in terms of error functions. Also the behavior of sage becomes even strange when I change the coefficient from 2.0 to 2.1. Sage just refuses to do the integral

integrate(x*exp(-(x-y)*(x-y)*2.1),x)

$$\int x e^{\left(-2.1 \, {\left(x - y\right)}^{2}\right)}\,{d x}$$

Any ideas on how to make sage give an answer in the usual exponential form? form?

Edit: Sorry. My bad. It is an error function. However, I expect error function even for the second example, when I replace 2 by 2.1. Any ideas why that is the case?