def analysis.hermite_numerov.generate_table (   order,
  final_x = None,
  npoints = None 
)

Definition at line 13 of file hermite_numerov.py.

00013                                                      :
00014     "generate a spline table of H[n](x) exp(-x^2/2) ... a Hermite-Gauss basis function, using the Numerov method"
00015     if final_x is None:
00016         final_x=hermite_x_bound
00017 
00018     if npoints is None:
00019         npoints=hermite_n_points
00020 
00021     Y=Numeric.zeros(npoints+1, Numeric.Float)
00022     dx=float(final_x)/npoints
00023     dx2=dx*dx
00024     e2=2*order+1
00025     x=-final_x+Numeric.array(range(npoints+1),Numeric.Float)*dx
00026     V=(x*x-e2)
00027     
00028     ypsifact=1.0/(1.0-(dx*dx/12.0)*V)
00029     coef=2.0+dx2*V*ypsifact
00030 
00031     Y[0]=1.0/ypsifact[0]
00032     Y[1]=math.exp(math.sqrt(V[0])*dx))/ypsifact[1]
00033             
00034     for i in range(1,npoints):
00035         yy=Y[i+1]=Y[i]*coef[i]-Y[i-1]
00036         if abs(yy) > 1e20: #don't let exponential blow up
00037             Y*=1e-20
00038 
00039     psi = Y*ypsifact
00040 
00041     x=-final_x+Numeric.array(range(2*npoints+1),Numeric.Float)*dx
00042     
00043     if order%2 == 0: #even function
00044         y=Numeric.concatenate((psi, psi[::-1][1:]))
00045     else:
00046         psi[-1]=0 #enforce oddness exactly
00047         y=Numeric.concatenate((psi, -psi[::-1][1:]))
00048 
00049     y=y*math.sqrt(1.0/(Numeric.dot(y,y)*dx))
00050     y2=spline.spline(x, y)
00051     return (final_x, x,y,y2)
00052 
00053 hermite_cache={}
00054 
def hermite_gauss(order,x, cache_key=None):


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