I have just begun learning computer science to apply it to Physics and I am trying to write a code for solving Schrödinger's equation of the harmonic oscillator (setting $V=\frac{x^2}{2}$) in one dimension.

I know the basics of how to do this, but I would like to know whether some resources are available, or if someone could help me how to write my program (I feel more confident with Python, but C, C++, or any other language works fine too).

I know I should:

  1. Choose a value for the maximum angular momentum $\ell$ and the quantum number $n$.
  2. Seek an energy interval $E_i, E_{i-1}$ where I can look more accurately for the solution.
  3. Find the best approximate value of energy through an algorithm (ex: secant formula).
  4. Compare the interval in energies with a certain accuracy $\epsilon$ established at the beginning.

Thank you in advance for your help!

  • 2
    $\begingroup$ Something wrong here, in 1D there is no angular momentum. $\endgroup$ Commented Feb 28, 2021 at 19:55
  • $\begingroup$ Thank you @MaximUmansky, sorry I was wrong! $\endgroup$
    – Anna Stone
    Commented Mar 1, 2021 at 20:08
  • 1
    $\begingroup$ What you are trying to do with the enumeration mentioned in the OP seems to me like a form of shooting method, that you try to solve with Numerov's method, which is a special kind of multistep method. If it's just about solving the harmonic oscillator, just discretize your system and use an eigenvalue solver. It's easier and more accurate. $\endgroup$
    – davidhigh
    Commented Mar 1, 2021 at 21:58
  • $\begingroup$ Usually steps and wells are the first thing to solve. I’ve found tridiagonal matrix method worked very well for this. $\endgroup$
    – boyfarrell
    Commented Mar 2, 2021 at 14:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.