%
%  w10schr.m -- djm -- 06 mar 06
%    -  schrodinger greens function
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

ompp = 1;

dt = 0.02;  T = 1;
Nx = 512;  Lx = 25;  dx = 2*Lx/Nx;
x = -Lx:dx:Lx-dx;

dk = 2*pi/Lx;
k = fftshift([-Nx/2:Nx/2-1])*dk;

q = exp(-1*(x.^2));  qh = fft(q);

figure(1);  clf;
for t = 0:dt:T
    uh = qh.*exp(-(i*ompp*t/2)*(k.^2));
    u  = ifft(uh);
    plot(x,real(u),'r');  hold on
    plot(x,imag(u),'b');
    plot(x,-abs(u),'k:');
    plot(x, abs(u),'k:');  hold off

    axis([-20 20 -1 1])
    text(-0.7*Lx,0.8,['\bf time = ' num2str(t)],'fontsize',16)
    xlabel('\bf x-axis')
    ylabel('\bf u(x,t)')
    drawnow;  pause(0.1)
end

figure(4);  clf;  hold on
y = -Lx:dx:Lx-dx;

[xg,yg] = meshgrid(x,y);
uS = exp(i/2*(yg.^2)./(xg-i));
pcolor(x,y,abs(uS));  shading flat
axis([-5 5 -25 25]);  colormap('gray')