# States of an oscillator The six lowest states of a particle in a well that is steeper along one axis: each has its own pattern of nodes. ```python import matplotlib.pyplot as plt import sympy as sp import pdemagic as pm x, y = sp.symbols("x y", real=True) E = sp.Symbol("E") psi = sp.Function("psi")(x, y) well = pm.Problem( sp.Eq(-pm.laplacian(psi) / 2 + (x**2 + 2 * y**2) / 2 * psi, E * psi), domain=pm.FreeSpace(x, y), eigenvalue=(E, 6), ) states = pm.solve(well) figure, panels = plt.subplots( 2, 3, figsize=(10, 6), sharex=True, sharey=True, layout="constrained" ) panels[0, 0].set(xlim=(-4, 4), ylim=(-4, 4)) for number, panel in enumerate(panels.flat): states.plot(state=number, ax=panel) ``` ## What it shows An eigenproblem in free space: the Schrödinger equation of a particle in the well $\tfrac12(x^2 + 2y^2)$, with a symbol for the energy. `eigenvalue=(E, 6)` asks for the six lowest energies and their states. A state with $m$ nodes along `x` and $n$ along `y` has the energy $(m + \tfrac12) + \sqrt2\,(n + \tfrac12)$, and the six that come out agree with that to twelve digits. The well is steeper along `y`, so a node across `y` costs more energy than one across `x`, and no two states share an energy. `ax=` draws each state into a panel of one figure. ## What pdemagic decided The planner chose a block iteration for the lowest eigenvalues, with the second derivatives applied in Fourier space (`fourier_subspace`). In free space it finds where the potential is lowest and chooses the box around it: about $\pm 8.3$ by $\pm 6.8$, as far as the highest of the six states reaches before it has faded to $10^{-11}$ of its largest value, with 96 by 78 points. The panels show the middle of that box. ## More - [Eigenproblems: bound states](../topics/eigen.md) - [Draw into your own figure](../howto/draw-into-your-own-figure.md) - [The lowest eigenvalues](../methods/subspace.md) - [What is solved in free space and on periodic boxes](../ref/equations-free-space.md)