7.3: Higher Dimensions
( \newcommand{\kernel}{\mathrm{null}\,}\)
We can work out the finite-difference equations for higher dimensions in a similar manner. In two dimensions, for example, the wavefunction
The discretization of the derivatives is carried out in the same way, using the mid-point rule for first partial derivatives in each direction, and the three-point rule for the second partial derivative in each direction. Let us suppose that the discretization spacing is equal in both directions:
Then, for the second derivative, the Laplacian operator
can be approximated by a five-point rule, which involves the value of the function at
For instance, the finite-difference equations for the 2D Schrödinger wave equation is
7.3.1 Matrix Reshaping
Higher-dimensional differential equations introduce one annoying complication: in order to convert between the finite-difference equation and the matrix equation, the indices have to be re-organized. For instance, the matrix form of the 2D Schrödinger wave equation should have the form
where the wavefunctions are organized into a 1D array labeled by a "point index"
We will adopt the following conversion scheme between point indices and grid indices:
One good thing about this conversion scheme is that Scipy provides a reshape function which can convert a 2D array with grid indices
>>> a = array([[0,1,2],[3,4,5],[6,7,8]])
>>> a
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
>>> b = reshape(a, (9)) # Reshape a into a 1D array of size 9
>>> b
array([0, 1, 2, 3, 4, 5, 6, 7, 8])
The reshape function can also convert a 1D back into the 2D array, in the right order:
>>> c = reshape(b, (3,3)) # Reshape b into a 2D array of size 3x3
>>> c
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
Under point indices, the discretized derivatives take the following forms:
The role of boundary conditions is left as an exercise. There are now two sets of boundaries, at


