Representation of states
A more formula-heavy introduction of the DVR method can be found in the Wavepacket wiki. Here we only introduce the most important elements. The takeaway message is:
States in Wavepacket are represented by a coefficient vector in a special basis. For most purposes, you should transform the state into a more suited basis. For example, you should transform to the DVR if you want to plot a state.
A grid is built as the direct product of one or more one-dimensional grids called degrees of freedom.
Let us start with a single degree of freedom only, and briefly look at the different representations for a wave function.
FBR representation
The Finite Basis Representation (FBR) is what we always do in quantum mechanics: Take a set of orthonormal basis functions, and expand your wave function,

where in practice, the sum is always truncated.
The coefficient vector provides a unique representation of the wave function.
Each degree of freedom (DOF) class in Wavepacket is modelled around
specific basis functions, for example
wavepacket.grid.PlaneWaveDof uses plane waves as underlying basis.
Physical quantities can be calculated from the the coefficient vector; for example the trace
is given by
.
We only use the FBR for special applications, such as operators that are diagonal in the underlying basis. In general, we much prefer the DVR.
DVR representation
For the Discrete Variable Representation, we again expand in an orthonormal basis
(1)
but choose the basis functions such that the coefficients are the values of the wave function at some
fixed grid points,
. It can be shown
that a basis expansion with N FBR coefficients can usually be converted
losslessly into a DVR with a specific choice of N grid points.
The DVR is used for numerics with the DVR approximation: You apply a space-local operator like a potential by multiplying the operator values with the wave function values at the grid points. But most importantly, if your expansion coefficients are the wave function values, you can directly plot them!
Note
The DVR is not inherently simple. For example, the density
is given in the DVR as
,
where the basis functions also depend on the number of grid points.
In practice, we side-step these problems by plotting
the density only at the grid points,
and letting the plot function interpolate in-between.
This gives artefacts if the grid has few grid points. However, in these cases, it is usually more insightful to study the system in a well-chosen FBR instead.
For actual computations, the DVR requires additional weights
for the grid points. For example, the trace of the wave function
is calculated as
. Carrying around
the weights is somewhat annoying, and the additional
multiplication makes the calculations slower than they need to be.
For that reason, we do not quite use the DVR as native representation in Wavepacket.
Weighted DVR representation
A more numerically convenient representation can be obtained if we use a
modified DVR expansion (1) with
and
.
This allows us to ditch the weights.
For example, the trace is now simply given as
.
This weighted DVR is the default representation in Wavepacket.
Unless explicitly noted otherwise, all wave functions are expected and returned
in this representation. If you need the wave function, for example for plotting
the DVR density, you should explicitly transform it with available helper
functions, for example wavepacket.dvr_density().
Multidimensional grids
A multidimensional wavepacket.grid.Grid is constructed as the direct
product of one-dimensional degrees of freedom using the weighted DVR. Hence,
for example a two-dimensional wave function is given as
(2)
where the functions are the weighted DVR basis of the two one-dimensional grids, and where the coefficients are now given as a matrix of weighted DVR values.
Density operators
A similar extension holds for density operators. For the example of a pure density operator on the two-dimensional grid of (2), the result is:

so that the resulting density operator is a four-dimensional tensor
, also for non-pure states.
You still benefit from the weighted DVR, for example the
trace is given by
.