# Eigenfunctions returned from NDEigensystem not in correct order

Mathematica Asked by Anthony on October 16, 2020

First I solved for the eigenfunctions and stored them as "funs":

    A = 0.05; Subscript[V, 0] = 1 ; d = 2;
schröd = -A*d^2 [Pi]*D[[Psi][n, [CurlyPhi]], {[CurlyPhi], 2}] +     A/(4 [Pi]) ([CurlyPhi]*[CurlyPhi]*[Psi][n, [CurlyPhi]] +
2 I*D[[Psi][n, [CurlyPhi]], {n, 1}] -
D[[Psi][n, [CurlyPhi]], {n, 2}]) -     Subscript[V,
0] ((Cos[2 [Pi]*d*n]) + Cos[[CurlyPhi]]) [Psi][n, [CurlyPhi]]; Subscript[n, min] = -1/2; Subscript[n, max] = 1/2; Subscript[ [CurlyPhi], min] = -[Pi]; Subscript[[CurlyPhi], max] = [Pi];

{vals, funs} = NDEigensystem[{schröd,
PeriodicBoundaryCondition[[Psi][n, [CurlyPhi]],
Subscript[[CurlyPhi], min] <= [CurlyPhi] <=
Subscript[[CurlyPhi], max] && n == Subscript[n, max] ,
FindGeometricTransform[{{Subscript[n, min],
Subscript[[CurlyPhi], min]}, {Subscript[n, min],
Subscript[[CurlyPhi], max]}}, {{Subscript[n, max],
Subscript[[CurlyPhi], min]}, {Subscript[n, max],
Subscript[[CurlyPhi], max]}}][]],
PeriodicBoundaryCondition[Exp[I 2 [Pi] n]*[Psi][n, [CurlyPhi]],
Subscript[n, min] <= n <= Subscript[n, max] && [CurlyPhi] ==
Subscript[[CurlyPhi], max],
FindGeometricTransform[{{Subscript[n, min],
Subscript[[CurlyPhi], min]}, {Subscript[n, max],
Subscript[[CurlyPhi], min]}}, {{Subscript[n, min],
Subscript[[CurlyPhi], max]}, {Subscript[n, max],
Subscript[[CurlyPhi], max]}}][]]}, [Psi][
n, [CurlyPhi]]   , {n, [CurlyPhi]} [Element]
Rectangle[{Subscript[n, min], Subscript[[CurlyPhi],
min]}, {Subscript[n, max], Subscript[[CurlyPhi], max]}], 8];


But the returned eigenfunctions are not in the order that I expected, namely with the ground state first, first excited state second etc.

I've realised one of the reasons the graphs were not as expected is that I unwittingly wasn't plotting the eigenfunctions I thought I was. NDEigenSystem returns eigenfunctions in order of the magnitude of their eigenvalue which implies that the first one it returns is the ground state, the second the first excited state etc.. However, if a lot of your eigenvalues are around zero, and imaginary, ordering by magnitude of eigenvalue doesn't necessarily give the ground state first. I solved this rookie error by adding a constant of 1 to my hamiltonian (simply adding +[Psi][n, [CurlyPhi]] at the end of my "schröd"), which is allowed because we can define where the ground state energy is however we want, as we are interested in energy differences.

Correct answer by Anthony on October 16, 2020

## Related Questions

### Change the Tooltip of DistributionChart

1  Asked on August 8, 2021

### X axis rescaling without altering the y axis

1  Asked on August 7, 2021

### Error importing video

0  Asked on August 7, 2021

### Can Image3D be setup to make any voxel with an RGB element >1 or <0 black, or better yet clear?

1  Asked on August 7, 2021

### Speeding up value reassignments in ParallelTable

0  Asked on August 7, 2021 by user16308

### Extracting information from Classify

0  Asked on August 7, 2021

### Vectors do not define a plane when constructing a RotationMatrix

2  Asked on August 7, 2021 by chris-guo

### How to make substitution without getting Recursion Limit Error

1  Asked on August 7, 2021

### series expansion unpredictably dividing by leading coefficient

0  Asked on August 7, 2021 by jansen

### Determining Mean Path Length

1  Asked on August 7, 2021

### Creating a right hand in Graphics3D to illustrate the right hand rule

2  Asked on August 7, 2021

### Boundaries problem with listdensityplot

1  Asked on August 6, 2021 by jocelyn-minini

### Yet another slow plot involving numerical integration

1  Asked on August 6, 2021

### Mathematica has detected an internal error

3  Asked on August 6, 2021 by jht

### How to automate calculations of sums with harmonic numbers

0  Asked on August 6, 2021

### Fast enumeration of all perfect matchings in complete graph

1  Asked on August 6, 2021 by albacl

### AudioCapture[] not capturing sound from my Focusrite input

0  Asked on August 6, 2021

### How to parallel this nested table efficiently?

2  Asked on August 5, 2021

### Remove elements from a tuple with conditions

1  Asked on August 5, 2021

### Solving the following system of integrodifferential equations: speed up of the code

0  Asked on August 5, 2021