The time dependent schrodingers equation is:
If this is implemented as simple as possible with Euler's method, it will usually be inaccurate and cause the waveform to explode due to integration errors. Simulating the equation will require a more accurate method.
The iterative simulation will approximate as a finite dimensional vector, so it should approximate a matrix.
Assuming the Hamiltonian is constant, integrating gets
The Hamiltonian operator is equal to .
The second derivative can be calculated by:
We can approximate this with a finite difference.
So for each position of we can make a matrix below. We assume no repeating boundary conditions (equivelent to a discrete sine transform).
Then for the part, it is just a value at each point:
So is just the sum of those two matricies
And then each discrete step of the simulation will go through a certain change in time