I am a high school student trying to teach himself quantum mechanics just for fun, and I am a bit confused. As a fun test of my programming/quantum mechanics skill, I decided to create a computer program to model an atom.

Initially, I learned about the matrix representations of quantum states (the first example I came across was that of a polarized photon, with the base states [0, 1] and [1,0]). This was all fine and dandy, but then I learned about the Schrodinger Equation, which replaces these matrices with functions. The way I understood it, both matrices and functions are just concrete representations of an element in a vector space; is this correct?

It is much easier to work with matrices in code, so how do I transform operators and functions (Hamiltonian operator and state functions, specifically) into their corresponding matrix forms?

  • $\begingroup$ Expand operators in a given bases. Read Sakurai's book Modern Quantum Mechanics's first chapter would help. $\endgroup$ – RoderickLee Jul 14 '16 at 19:47

I like the previous answer, but I thought you might want something less abstract. To simulate the Schrodinger equation, replace space by a grid of points, and the wavefunction values with a wavefunction value on each point of the grid. Then replace:

$$ \nabla^2 \psi $$

in the Hamiltonian with

$$ (\sum_e \psi(x+e) ) - N \psi(x) $$

Where e runs over the basic lattice steps--- to nearest neighbors in each direction--- and N is the number of nearest neighbors on the lattice, so that in one dimension, you have $\psi(n)$ where n is an integer (a one dimensional grid), and the Laplacian is

$$ \nabla^2\psi(n) = \psi(n+1) + \psi(n-1) - 2\psi(n) $$

In two dimensions you have $\psi(i,j)$ where i,j are integers:

$$ \nabla^2\psi(i,j) = \psi(i+1,j) + \psi(i-1,j) + \psi(i,j+1) + \psi(i,j-1) - 4 \psi(i,j) $$

Then you write down the discrete Schrodinger equation

$$ i \partial_t \psi = \nabla^2 \psi + V(x) \psi $$

With the appropriate discrete form and simulate away. Notice that the dimension of the state space is the number of grid-points, and the dimension of the Hamiltonian matrix is the square of the number of grid points, but these matrix elements are only nonzero for a few positions, so there are only about as many nonzero matrix elements as there are gridpoints. This makes it inefficient to represent H as a matrix in a computer, it is what is called a "sparse matrix" in computer science.

You should also know that there is a stiffness problem with this equation--- if you make the lattice spacing of x $\epsilon$ (this just rescales the Laplacian), the discrete spacing in time for the purposes of simulation needs to be smaller than about $\epsilon^2$ for a naive integration algorithm. You can use a better algorithm (this is called a stiff integrator), but to get qualitative intuition, just use a coarse lattice and a fine time lattice, or solve the time-independent (eigenvalue) problem. I got bitten by the stiffness when I was in your shoes.

You should also know the fact that the discrete form is the actual correct form of the Schrodinger equation describing electron motion in a real atomic lattice, as in a metal. This is usually taught as the "tight binding approximation", and derived from consideration of the continuous Schrodinger equation separating into bands in a periodic potential, but the end result is nothing more than the discrete form of the Schrodinger equation you would write down as above.

The Schrodinger equation is developed from this discrete point of view in The Feynman Lectures on Physics Vol III, which is appropriate for a high school student, since it has no prerequisites.

| cite | improve this answer | |

I thoroughly approve of your approach. Putting things on a computer, if you're careful, is a good way to learn this stuff. You have to understand the basic machinery clearly in order to express it in code, and once you've got your code working, you can study examples that are too hard to solve by hand.

About your question: You transform vectors in an abstract Hilbert space into column or row vectors (or column/row matrices, if you prefer that term), by choosing a basis for the Hilbert space. The coefficients of the vector in the basis are the entries of the column matrix. The same goes for operators; pick a basis, and the coefficients of the operator in that basis will fill out a matrix.

In more detail: Quantum mechanics deals with two sorts of quantities: States, which are vectors that lie in a Hilbert space $\mathcal{H}$, and observables, which are operators that map states to states. If you choose a basis $\{e_i\}$ for the vector space $\mathcal{H}$, you can write any vector $\psi \in \mathcal{H}$ as a sum $$ \psi = \sum_i \psi_i e_i. $$ In this sum, the $e_i$ are vectors, elements of $\mathcal{H}$, and the $\psi_i$ are complex numbers, the coefficients of the sum. You can write this in matrix notation as a column vector by listing the coefficients $$ \psi = \left( \begin{array}{ccc} \psi_1 \\ \psi_2 \\ ... \end{array}\right) $$ Likewise, if you choose a basis $\{e_i\}$, you can represent an observable $\mathcal{O}: \mathcal{H} \to \mathcal{H}$ as $$ \mathcal{O} = \sum_{i,j} \mathcal{O}_{ij} (e_i \otimes \check{e}_j) $$ Here, $\check{e}_j$ is an element of the dual basis of $\{e_i\}$, and $\mathcal{O}_{ij}$ is the coefficient of the operator between basis elements $i$ and $j$. Again, you can switch to matrix notation by listing the coefficients: $$\left( \begin{array}{ccc} \mathcal{O}_{11} & \mathcal{O}_{12} & ... \\ \mathcal{O}_{21} & \mathcal{O}_{22}& ...\\ ... & ... & ... \end{array} \right) $$

Now the bad news: For an atom, the vectors and matrices are going to be infinite-dimensional. The Hilbert space $L^2(\mathbb{R}^3,\mathbb{C})$ where the position wave functions live has a countable basis, but it's not finite-dimensional. But your computer only has so much memory, so you only get to use finitely many basis elements. You're going to have to make some good approximations when you set up your problem. Which approximations you should make depend on what you're trying to simulate. You haven't said, so I won't comment.

| cite | improve this answer | |
  • $\begingroup$ What form would the basis vectors $e_{i}$ take? $\endgroup$ – Shivam Sarodia Aug 2 '12 at 18:30
  • $\begingroup$ The choice is up to you. You can choose any complete basis; nothing physical will depend on which basis you choose. That said, it's natural to use as a basis the eigenbasis of one of the observables in your problem. For example, you can use the eigenvectors of the energy operator as a basis. If your interaction is complicated, like $H=P^2 + Q^2 + c Q^4$, and you can't solve for the eigenvectors, you can just use the eigenvectors of an easier operator, like $H_0 = P^2 + Q^2$. $\endgroup$ – user1504 Aug 2 '12 at 18:40
  • $\begingroup$ Note, however, that when you choose a finite subset of the basis for your simulation, you have to ignore infinitely many eigenbasis elements. This is OK if all the state coefficients are close to zero for these basis elements, but can introduce big errors if you throw away basis elements that do matter. $\endgroup$ – user1504 Aug 2 '12 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.