Solve the Schrödinger equation with periodic potential:
By the Bloch theorem, solutions are bounded provided

is within an energy band. The energy gap corresponds to a range of

where
MathieuCharacteristicExponent has a non-vanishing imaginary part:
Solve the Laplace equation in an ellipse using separation of variables:
This plots an eigenfunction. It vanishes at the ellipse boundary: