def analysis.hermite_numerov.hermite_gauss_matrix_element (   m,
  n,
  x0,
  x1,
  f,
  stepsize = 0.01 
)

Definition at line 114 of file hermite_numerov.py.

00114                                                                 :
00115     "compute integral(h[m](x}*h[n](x)*exp(-x^2)*f(x),{x,x0,x1}) : f should be able to be evaluated with a vector x"
00116     if m>n:
00117         m,n = n,m #always make m<=n
00118     xmax=max(abs(x0), abs(x1))
00119     if not integral_cache.has_key((m,n)) or integral_cache[(m,n)][0] < xmax:
00120         hermite_gauss_integral(m,n,x0,x1) #preload cache with raw data
00121 
00122     jxmax, jxa, jya, jy2a, jstepsize, xa, hmn, hmn2=integral_cache[(m,n)]
00123     
00124     stepcount=int((x1-x0)/stepsize)
00125     if stepcount%2==0:
00126         stepcount=stepcount+1 #always odd for Simpson
00127     stepsize=(x1-x0)/(stepcount-1) #exact step size
00128     xlist=Numeric.array(range(stepcount),Numeric.Float)*stepsize + x0
00129     y=spline.splint(xa, hmn, hmn2, xlist)*f(xlist)
00130     yint=Numeric.sum(y[0:-2:2]+y[2::2]+4.0*y[1::2])*(stepsize/3.0)
00131     return yint
00132 
if __name__=="__main__":


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