def analysis.numerov_solve.single_well_numerov_match (   V0,
  dx,
  parity = 1,
  overlapsize = 5 
)

Definition at line 95 of file numerov_solve.py.

00095                                                               :
00096     "generate a candidate eigenfunction with given potential, assuming the potential well has a single allowed region bounded on both sides"
00097     assert len(V0) & 1, "Must have a grid with an odd number of points"
00098     vminchan=Numeric.argmin(V0) #position of bottom of well
00099     right_turn=Numeric.searchsorted(V0[vminchan:], 0.0)+vminchan #position of right-hand turning point
00100 
00101     #integrate from left end to right-hand turning point, at which point numerov method becomes unstable
00102     leftpsi=bare_numerov(V0[:right_turn], dx)
00103     #iterate backwards on right part to turning point, and flatten to normal array
00104     rightpsi= Numeric.array(bare_numerov(V0[right_turn-overlapsize:][::-1], dx)[::-1]) 
00105     
00106     #remember that since Numeric handles slices without copying, leftend and rightend also scale here
00107     slopeweight=Numeric.array(range(overlapsize),Numeric.Float)-overlapsize/2.0
00108     leftend=leftpsi[-overlapsize:]
00109     rightend=rightpsi[:overlapsize]
00110     
00111     scale=abs(Numeric.sum(leftend*rightend)/Numeric.sum(leftend**2)) #'least-squares' scale estimate
00112     #note that since leftend and rightend are Numeric slice references, modifying psi also changes them!
00113     rightpsi*=float(parity)/scale   
00114     error=Numeric.sum((leftend-rightend)*slopeweight) #average derivative
00115     psi0=Numeric.concatenate((leftpsi, rightpsi[overlapsize:]))
00116 
00117     psi2=psi0*psi0
00118     integral=psi2[0]+psi2[-1]+4.0*Numeric.sum(psi2[1:-1:2])+2.0*Numeric.sum(psi2[2:-2:2]) #use simpson's rule
00119     psimag=1.0/math.sqrt(integral*dx/3.0)
00120     
00121     return psi0*psimag, error*psimag
00122 
def single_well_numerov_solve(V0, dx, parity, emin, emax, overlapsize=5):


Generated on Wed Nov 21 10:18:33 2007 for analysis by  doxygen 1.5.4