This is not strictly a question about physics but about the numerical solution to a physics problem. I am solving the Schrodinger equation via finite difference, via the substitution

enter image description here

I solved this using Mathematica for the case that $V(x) = 0$ and get the correct eigenvalues. I find the eigenvectors and plot them via

d2dx[n_] := 
  SparseArray[{Band[{1, 1}] -> -2, Band[{1, 2}] -> 1, 
     Band[{2, 1}] -> 1}, {n, n}]/(1/n^2);
evecs[n_, m_] := Last@Eigenvectors[N[-d2dx[n]], m]
ListPlot[evecs[100, 1], Joined -> True]
ListPlot[evecs[100, 2], Joined -> True]
ListPlot[evecs[100, 3], Joined -> True]

But the results look like this:

enter image description here enter image description here enter image description here

The profiles are correct but of course it shouldn't be oscillating in this way. Why am I seeing these oscillations and how do I get the correct eigenvectors?


closed as off-topic by David Z May 23 '18 at 6:49

  • This question does not appear to be about physics within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ As far as I understand, the equation itself does not fix the eigenfunction sign, so the numerical procedure may yield both signs on the same plot. If you connect only positive-valued points in the first plot, you will get a $sin(\pi x/100)$, I guess. $\endgroup$ – Vladimir Kalitvianski May 19 '18 at 17:52
  • 1
    $\begingroup$ Each plot shows the last eigenvector . Have you tried plotting the first eigenvectors? I recall when I was doing this the eigenvectors started as smooth solutions and as $m$ increased they started looking like your plots. $\endgroup$ – user3502079 May 19 '18 at 18:57
  • $\begingroup$ I'd refer you to this Mathematics SE Q&A on the subject of Toeplitz matrices. I'm pretty sure you'd get better answers on Mathematics SE to a question like this. $\endgroup$ – StephenG May 19 '18 at 22:57
  • $\begingroup$ Or perhaps Mathematica for analysis of the code you've written. $\endgroup$ – Kyle Kanos May 20 '18 at 11:28
  • 1
    $\begingroup$ Cross-site duplicate: on SE.Mathematica. $\endgroup$ – Nat May 23 '18 at 0:09

The problem is in the Mathematica code, the answer can be found here: https://mathematica.stackexchange.com/questions/173669/solving-the-schrodinger-equation-by-exact-diagonalization/173672#173672.

The eigenvectors are organized from greatest eigenvalue to least. The solution is to reverse the list of eigenvectors then take the m'th vector from the list. It can be fixed by replacing with

evecs[n_, m_] := Reverse[Eigenvectors[N[-d2dx[n]]]][[m]]
  • $\begingroup$ This looks like a link-only answer. Links are great for support, but it's typically best to include the content in the answer. $\endgroup$ – Nat May 23 '18 at 0:07
  • $\begingroup$ Since the answer is that the problem was not related to physics would it be better to add the answer or delete the question? $\endgroup$ – Kai May 23 '18 at 0:09
  • $\begingroup$ Ya know, I'm not too sure what the policy might be. Cross-site duplicate posts seem to have a fuzzy handling. $\endgroup$ – Nat May 23 '18 at 0:11
  • $\begingroup$ According to this Meta post, it sounds like deleting cross-site duplicates may be the way to go unless there's a specific reason to have the same question on multiple SE's. $\endgroup$ – Nat May 23 '18 at 0:17
  • $\begingroup$ Fair enough, I'm going to go ahead and delete the post then. $\endgroup$ – Kai May 23 '18 at 5:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.