# Hamiltonian Matrix Size in Schrodinger Equation

I'm attempting to solve the particle-in-a-box problem using Scipy (with the help of http://www.physics.buffalo.edu/phy410-505/2011/topic4/app2/index.html). At first, I used a 16x16 matrix to model the Hamiltonian, like the link, and my results corresponded to theirs. However, when I used a larger matrix (50x50), I found many extraneous eigenvalues in my results due to the larger matrix size.

Why does a 16x16 matrix produce exactly the correct eigenstates while a larger one produces extraneous ones? When using a larger matrix (which I thought would increase the accuracy of the simulation due to fewer basis elements being omitted), how can I tell which elements correspond to actual eigenstates and which are extraneous?

My code is below:

from scipy import linalg, mat, matrix

def Sfun(m,n):
if (m+n)%2==0:
v1 = 2/(m+n+5)
v2 = 4/(m+n+3)
v3 = 2/(m+n+1)
return v1 - v2 + v3
else:
return 0

def Hfun(m,n):
if (m+n)%2==0:
return -8*(1-m-n-2*m*n)/((m+n+3)*(m+n+1)*(m+n-1))
else:
return 0

Slist = []
Hlist = []

for m in range(0,16):
tlist = []
for n in range(0,16):
tlist.append(Sfun(m,n))
Slist.append(tlist)

for m in range(0,16):
tlist = []
for n in range(0,16):
tlist.append(Hfun(m,n))
Hlist.append(tlist)

Smat = matrix(Slist)
Hmat = matrix(Hlist)

vals,vecs = linalg.eig(Hmat, Smat)

for i in range(0,16):
print('Vector: ', end="")
print(vecs[i], end="")
print("                     Value: ", end="")
print(vals[i])

• It sounds like the tell-tale signs of the Lanczos algorithm breaking down. But linalg.eig is just a straight call to the LAPACK routine dgeev, which uses the QR algorithm, so that shouldn't be an issue. You could try using linalg.eigh, which is specifically for Hermitian matrices. – Daniel Shapero Jan 3 '13 at 0:04
• Are you increasing the size of your box when you add additional eigenvalues, or keeping it the same size? – Dan Jan 3 '13 at 23:50
• I am increasing the matrix size when the additional eigenvalues appear. I attempted to follow korrok's advice and use linalg.eigh, since my matrix is Hermitian, and Numpy threw the following error: numpy.linalg.linalg.LinAlgError: the leading minor of order 24 of 'b' is not positive definite. The factorization of 'b' could not be completed and no eigenvalues or eigenvectors were computed. I'm not at all sure what that means or why it might be occurring, since neither Hfun or Sfun break down near the value 24. – Shivam Sarodia Jan 4 '13 at 1:27
• What basis set are you using? You should be using plane waves. In that case, the overlap matrix is already diagonal. My guess is that you have an overcomplete basis that is making S illconditioned. – Deathbreath Feb 20 '13 at 21:29