The time dependent schrodingers equation is:
Divide both sides by and then we have a way to do it iteratevely
and so
If this is implemented as simple as possible with Euler's method, it will usually be inaccurate and cause the wave to blow up. Simulating the equation will require a more accurate method.
First convert the equation to use the Hamiltonian, which is equal to the sum of the kinetic energy and potential energy.
A classical wave will look like
is the wave vector, the radians per distance, and is the wave length of the wave.
is the angular velocity.
By definition of , the momentum of a wave is
Then:
Calculating kinetic energy is , so:
And the Hamiltonian is .
And that is the same as the original equation so
And we can replace the Hamiltonian at a point with the Hamiltonian operator
For the computer simulation we will represent as a vector, so if we can make the a matrix then we can approximate the differential equation using matrix exponentiation.
The Hamiltonian operator is equal to .
The second derivative can be calculated by:
When converted to discrete form:
And for each position of we can make a matrix like:
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
This method is more accurate but more computationally complex, since the matrix will have to be the same size as the size of vector making this algorithm of the number of elements in the vector.
I used this link for the explanation of the derivation and this link for explaining how to simulate it using the Hamiltonian.