page3
xmin=0.0
xmax=4.0
x = linspace(xmin,xmax,npts)
wave1s =zeros(npts)
In [13]: for i in range(0,npts):
wave1s[i] =psi(-Ci,Alpha,x[i])
In [14]: plot(x,wave1s);
axis([xmin,xmax,0,0.6]);
title("Ground State Wavefunction ofHydrogen Atom (variational)");
xlabel("r (a.u.)");
ylabel("\\Psi_{1s}");
3
In [10]: # Solución autovalores generalizados (H-ES)(C)=0
Ener,coef =eigh(H,S,type=1)
Ci =coef[:,0]
In [11]: def psi(Ci,Alpha,x):
from math import
exp
nsize =len(Ci)
sum =0.0
for iin range(0,nsize):
sum =sum +Ci[i]*exp(-Alpha[i]*x**2)
In [12]: # array definitions
npts =100
return sum