# [Maxima] problem with integration of gaussian distribution

Riemann, Robert robert.riemann at physik.hu-berlin.de
Tue Jul 7 14:09:51 CDT 2009

```Thanks for the hints to collectterms and ratsubst.

I got done the integration with the following code
(with wxmaxima, %o6 is used!):

phi(p) := A*exp(-(p-p_0)^2/(h/d)^2);
phi(p)*(2*%pi*h)^(-1)*exp(%i/h*(p*x-p^2/(2*m)*t));
ratsubst(exp(c),A/(2*%pi*h),%);
collectterms(expand(log(%)),p);
ratsubst(a1,((%i*x)/h+(2*d^2*p_0)/h^2),%);
ratsubst(a2,(-(%i*t)/(2*h*m)-d^2/h^2),%);
ratsubst(a0,(d^2*p_0^2)/h^2+c,%);
assume(a2 < 0)\$
integrate(exp(%o7),p,minf,inf);
ratsubst(((%i*x)/h+(2*d^2*p_0)/h^2),a1,%);
ratsubst((-(%i*t)/(2*h*m)-d^2/h^2),a2,%);
ratsubst((d^2*p_0^2)/h^2+c,a0,%);
psi(x,t) := ''%;

To make it perfect:

Is there a way to simplify the re-substitution?
Is there a simple way to expand and collect the term in exp(...)  to get psi
in something like a bell-shaped curve?

Greets Robert

Am Montag, 6. Juli 2009 23:11:44 schrieb Leo Butler:
> On Mon, 6 Jul 2009, Riemann, Robert wrote:
>
> < >> What must I do, to let Maxima sort some summands in powers of p?
> < >
> < >I'm sorry, I don't understand.
> <
> < (any function f(p)) => (...)p^0+(...)p^1+(...)p^2+...
> <
> < If I know the term (...) in front of p^0, i could substitute it to reduce
> the < number of variables (in my case from 6 to 3)
>
> I think that you want to use 'collectterms' to do this work.
> Since your integrand is of the form
>
> q*exp(a*p^2+b*p+c)
>
> it is probably best to determine these coefficients for your problem,
> and integrate the above expression, and substitute back. This way, the
> functional dependence is pretty clear.
>
> Leo

```