Solve the particle in a box problem using matrix mechanics?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
41 replies · 11K views
DrClaude said:
The potential of the square well is uniquely 0 on the finite spatial grid. Otherwise, a term ##V(x)## would appear on the diagonal.

Yes, if for instance we have a harmonic oscillator potential ##V(x) \propto (x-x_0 )^2##, the discretized potential ##V_n = V(n\Delta x)## appears on the diagonal elements. My code that calculates the three lowest energy states of this system is below:

Code:
L <- 6.0                             # Length of the domain
N <- 150                    # Number of discrete points
dx <- L/N
A = matrix(nrow = N, ncol = N)        # Hamiltonian matrix
V = c(1:N)

for(m in c(1:N))
{
V[m] = 3.0*(m*dx - 3.0)*(m*dx - 3.0)       # define a harmonic oscillator potential with spring constant k = 6
}

for(m in c(1:N))             # Fill the Hamiltonian matrix with elements appropriate for a harmonic oscillator system
{
for(n in c(1:N))
{
A[m,n]=0
if(m == n) A[m,n] = 2/dx^2 - V[m]
if(m == n-1 || m == n+1) A[m,n]=-1/dx^2
}
}

v = eigen(A)                       # Solve the eigensystem
vec = v$vectors

psi1 = c(1:N)
psi2 = c(1:N)
psi3 = c(1:N)
xaxis = c(1:N)*L/N

for(m in c(1:N))
{
psi1[m] = vec[m,1]               # Fill the psi-vectors with the eigenfunction values
psi2[m] = vec[m,2]
psi3[m] = vec[m,3]
}

jpeg(file = "plot.jpg")             # Plot the probability densities for the ground state and two excited states above it
plot(xaxis, 0.01*V, ylim=c(0,0.04))
lines(xaxis, 0.01*V)
lines(xaxis,abs(psi1)^2)
lines(xaxis,abs(psi2)^2)
lines(xaxis,abs(psi3)^2)
dev.off()

A plot of V(x) and the approximate probability densities for quantum numbers n=0, n=1 and n=2 looks like this:
1sbbs3.jpg
 
Physics news on Phys.org
vanhees71 said:
One should emphasize that these nice numerical calculations are not what's known as "matrix mechanics". It's solving an approximate eigenvalue problem by discretizing space. It's a kind of "lattice calculation" for quantum theory.

If the discretization was fine enough, such that the numerical solution approached the analytic solution what would you say about the finite difference matrix? If the matrix used in the finite difference solution gave the same eigenvalues and the same eigenvectors as the analytic solution wouldn't the finite difference matrix equal the unknown, operator matrix?

I guess what I am asking if two matrices have the same eigenvalues and the same eigenvectors are they equivalent?
 
I'm not sure if someone has actually published a proof that the ground state of the discretized system approaches the exact gaussian harmonic oscillator ground state when ##L \rightarrow \infty## and ##\Delta x \rightarrow 0##.
 
mike1000 said:
I guess what I am asking if two matrices have the same eigenvalues and the same eigenvectors are they equivalent?

If they are hermitian and have same eigenvalues and eigenvectors, they have to be the same matrix as far as I know. If they only have the same eigenvalues and same dimension and are hermitian, then they can differ by a unitary transformation.
 
mike1000 said:
If the discretization was fine enough, such that the numerical solution approached the analytic solution what would you say about the finite difference matrix? If the matrix used in the finite difference solution gave the same eigenvalues and the same eigenvectors as the analytic solution wouldn't the finite difference matrix equal the unknown, operator matrix?

I guess what I am asking if two matrices have the same eigenvalues and the same eigenvectors are they equivalent?
I do not say that anything is wrong with this numerical method, but it's not what's known as "matrix mechanics" a la Heisenberg, Born, and Jordan. They worked in the harmonic-oscillator basis, at least in the beginning, since Heisenberg addressed the harmonic-oscillator problem first in his famous "Helgoland paper".
 
  • Like
Likes   Reactions: DrClaude
hilbert2 said:
Here's an R-Code that forms the Hamiltonian matrix for the discretized square well problem and solves the eigenstate n=3 (the ground state is n=1), plotting the probability density as an output:

Code:
L <- 1                                               # Length of the domain
N <- 100                            # Number of discrete points
dx <- L/N
A = matrix(nrow = N, ncol = N)                # Hamiltonian matrix
n_state <- 3                        # Number of the eigenstate to be calculated

for(m in c(1:N))                    # Fill the Hamiltonian matrix with elements appropriate for an infinite square well problem
{
for(n in c(1:N))
{
A[m,n]=0
if(m == n) A[m,n] = 2/dx^2
if(m == n-1 || m == n+1) A[m,n]=-1/dx^2
}
}

v = eigen(A)                       # Solve the eigensystem
vec = v$vectors

soln = c(1:N)
xaxis = c(1:N)*L/N

for(m in c(1:N))
{
soln[m] = vec[m,n_state]               # Fill the vector "soln" with the wavefunction values
}

jpeg(file = "plot.jpg")                   # Plot the probability density
plot(xaxis,abs(soln)^2)
lines(xaxis,abs(soln)^2)
dev.off()

The plot that this code produces looks just like you'd expect from a square of a sine function.

View attachment 194507

Many thanks to Hilbert2 for posting this.

I have implemented his code in C# and extended it to two dimensions. I would like to post images of the results.

The first image shows the first 6 eigenstates for a particle in a two dimensional box.

_12HbKg-kJzyobKRPiNsnDUI3IRgmIbE441fx7nfwBK2ByBAul0EzZoYld5eOu6H-vyTUA4OABi7vsgLtCl=w939-h845-no.png


The second image shows the first 5 eigenstates for a two dimensional harmonic oscillator. Also shown is the potential function.

1Qcow-ZGHNe1fDR8coMTsBYC1_Fiq1fIo0m8fnNNZ3jZUfxIuYYHYkCl9sp4Pk2xZ0G2Ll_ETEPj6wU-Y7p=w939-h845-no.png


The C# program performs a eigenvalue decomposition of the finite difference matrix representation of the Schrödinger Equation, in much the same way that Hilbert2 describes. All I did was extend it to two dimensions. The C# program writes out the eigenvectors to a file and then I used Excel to make two dimensional plots. There is not a doubt in my mind that I could extend this to three dimensions, however, my computer does not have enough horsepower to solve that problem.
 
Last edited:
  • Like
Likes   Reactions: hilbert2, vanhees71 and Mentz114
Good work. Often when there's symmetry in the potential energy function, it's best to split the problem to two problems (x and y directions) to keep the number of grid points manageable.

If a 2D harmonic oscillator has the same spring constant for both x and y directions, the states ##\psi_m (x)\psi_n (y)## and ##\psi_m (y)\psi_n (x)## are degenerate so there's many ways to choose representative eigenstates from the eigensubspace spanned by those functions, but in those images it seems that the solver chooses them in a logical way.
 
hilbert2 said:
Good work. Often when there's symmetry in the potential energy function, it's best to split the problem to two problems (x and y directions) to keep the number of grid points manageable.

If a 2D harmonic oscillator has the same spring constant for both x and y directions, the states ##\psi_m (x)\psi_n (y)## and ##\psi_m (y)\psi_n (x)## are degenerate so there's many ways to choose representative eigenstates from the eigensubspace spanned by those functions, but in those images it seems that the solver chooses them in a logical way.

I can change the spring constant in each direction.

If you would like a copy of the relevant code (the part where I create the matrix) I will be glad to give it to you.

I just finished redoing the code in C++. I did this to get access to a different linear algebra package. I can now convert to sparse matrix's. This allows me to use more grid points and it all runs a lot faster.
 
Last edited by a moderator:
  • Like
Likes   Reactions: vanhees71
For anybody who is interested in the subject of "Matrix Mechanics" I recommend this book "heisenberg's quantum mechanics "

http://www.worldscientific.com/worldscibooks/10.1142/7702

which includes the derivation of the commutation and the equivalency between the Schrödinger and Heisenberg pictures in the free three first chapters.
 
The particle-in-a-box problem from the pov of matrix mechanics seems to be discussed in section 7.5 of Razavy's 'Heisenberg's Quantum Mechanics' which cites this paper, it looks very non-trivial.
 
ftr said:
For anybody who is interested in the subject of "Matrix Mechanics" I recommend this book "heisenberg's quantum mechanics "

http://www.worldscientific.com/worldscibooks/10.1142/7702

which includes the derivation of the commutation and the equivalency between the Schrödinger and Heisenberg pictures in the free three first chapters.
I don't know the book, but the title is utmost unjust. It should be titled: "Heisenberg's, Born's and Jordan's Quantum Mechanics" :-(.