How to calculate excited states

In the previous section, we calculated the ground state. However, the wave function can have additional solutions, known as excited states. These solutions feature extra zero crossings, referred to as nodes. To calculate excited states, we need to specify the number of nodes the wave function should have. This is done by configuring the solver to incorporate nodes in the solution:

solver.nodes.add(sg.PointNode(count=3))

In 1D problems, only point nodes are applicable, representing zero crossings at specific locations. In this case we tell the solver to find a solution with three zero crossings. You don't need to specify the locations in advance—the solver will determine them. Multiple types of nodes can be added, which will be useful for higher-dimensional problems. For now, let's run the one dimensional example:

In [1]:
import sigspace as sg
import numpy as np

def Vfun(x):
    return -8/(1 + x**2)

H = sg.Hamiltonian(sdims=1) + Vfun

solver = sg.Solver(H)
solver.nodes.add(sg.PointNode(count=3))
solver.grid(-10, 10, 200)
solver.print_info = True
sol = solver.run()

sg.quickplot(sol)
Iter: 2048, energy -0.956, residual 0.009963, duration 0.078968s

In the figure above the three nodes are clearly visible. Their positions are marked on the graph and can also be accessed using sol.wave.nodes.position.

Particle-in-a-box

Here, we solve the particle-in-a-box problem for multiple excited states. Note that, compared to the previous example, the depth of the box has been reduced (from 5 to 2). The output is as follows:

In [2]:
import sigspace as sg
import numpy as np

N_nodes = 5
plots = []

for num_nodes in range(N_nodes):

    H = sg.Hamiltonian(sdims=1) + (lambda x: -2*(np.abs(x) < 3))

    solver = sg.Solver(H)
    solver.nodes.add(sg.PointNode(count=num_nodes))
    solver.grid(-10, 10, 200)
    sol = solver.run()
    
    plots.append((sol.wave.x, num_nodes + sol.wave()/2))

    print("%i: %s" % (num_nodes, sol.energy))

sg.quickplot(*plots, layout={"legend": [f"N = {i}" for i in range(N_nodes)]})
0: -1.9029966437998191
1: -1.6045388935197473
2: -1.1237228731273918
3: -0.49267975298312194
4: 0.044418424556703

The first solution, with zero nodes, represents the ground state, which has the highest energy. As more nodes are added, the energy decreases. Eventually, the energy becomes positive, indicating that the states are no longer localized and do not provide a valid solution. This is evident in the figure above, where the wave function does not reach zero at the boundaries.

In other words, no wave function with four nodes fits within the box at the current potential. However, if we were to increase the potential back to 5, all wave functions would once again be localized inside the potential well.