# PsiPy: Schrodinger's Equation (part 1)

This past fall I was taking my second quantum mechanics class. In that class we learnt how to deal with discreet quantum system using linear algebra and how to extend that notation to solve continuous systems. Midway though the semester I attempted to write a simple program to solve the time dependent Schrodinger equation, it was a total failure. Shortly there after I found the blog post Quantum Python: Animating the Schrodinger Equation by Jake Vanderplas. In this post he describes a method for solving time dependent Schroddinger equation based on fast Fourier transforms (FFT). After experimenting with different wave functions and potentials the script appeared to accurately reproduce solutions to the one dimensional time dependent Schroddinger equation for arbitrary potentials and initial wave functions.

Seeing the success of this method when applied to one dimensional problems I decided to apply the same algorithms to two dimensional problems. But before I apply these algorithms to two dimensional problems I will first check the validity of the one dimensional solutions by comparing them to known analytical solutions of simple potentials.

## The Equations: Numerical

Apart from switching to momentum-space from wavenumber-space the formulas and algorithms remain largely unchanged from the original post, for a full derivation and description of the main equations and algorithms please refer to the original post by Jake Vanderplas.

Since the difference between the equations used and the originals is only of the occasional factor of . The resulting equations of note are, Schrodinger’s equations in position-space and momentum-space,

where is the position space wave function and is the momentum space wave function. The relations between the FFT and the wave functions is,

where is the discrete Fourier transform and is the inverse discrete Fourier transform. And finally the change in the wave function from the two forms of Schrodinger’s equations when the partial derivatives in position and momentum are dropped,

These equation should approximate the time evolution of a wave function over a small non-zero time interval. When the two equations are applied in an alternating manner as described by Jake Vanderplas the result should approximate the time evolution of a wave function according to Schrodinger’s equation.

## The Equations: Analytical

With the groundwork for the numerical solver laid out we must also consider the analytical solver. The analytical solver will use the known steady state solutions of solvable wave functions to produce the time evolving wave functions. When solving the time dependent Schrodinger’s equation using the separation of variables method the following equation which relates the time depend wave function to the time independent wave functions is derived.

Where is the n-th time independent solution, is the energy level of that solution and is the amplitude of that wave function. So for wave functions which can be solved, the time dependent solution is simply a sum of the constituent wave functions according to the equation above.

The analytical Schrodinger solver will simply be pre-programmed with known time independent solutions to some analytically solvable potentials. Using this it is posible to produce the time evolving solution of wave functions constructed from a finite number of energy states, and it can produce n-th order approximations of arbitrary wave functions in solvable potentials.

## Implementation

To aid in the implementation and the future comparison of numerical results I have decided to use Hartree atomic units. In this system notably , the electron mass , the electron charge and the coulomb constant .

The python source code for all of the scripts and modules for the numerical and analytical solvers are available at the GitHub repository Iprocess-Projects: PsiPy.