1
$\begingroup$

I want to solve the eigenfunctions of the harmonic oscillator Hamiltonian.

This is my code:

NDEigensystem[
  {-Laplacian[u[x], {x}] + 0.5 x^2 u[x], 
  DirichletCondition[u[x] == 0, True]}, 
  u[x], x ∈ {-1000, 1000}, 4]

However Mathematica is returning my input as an output. Suggestions on how to find the eigenfunctions?

$\endgroup$

3 Answers 3

5
$\begingroup$

If you want solve for one variable you don't need :

NDEigensystem[{-Laplacian[u[x], {x}] + 0.5 x^2 u[x], 
  DirichletCondition[u[x] == 0, True]}, u[x], {x, -1000, 1000}, 4]
$\endgroup$
5
$\begingroup$

NDEigensystem doesn't like x ∈ {-1000, 1000}. When I substitute {x, -1000, 1000}, I get

NDEigensystem[
 {-Laplacian[u[x], {x}] + 0.5 x^2 u[x],
 DirichletCondition[u[x] == 0, True]},
 u[x], {x, -1000, 1000}, 4]

result

$\endgroup$
3
$\begingroup$

The above answers actually return something, which is good though the results are a bit nonsensical. The actual eigenfunctions should have 0, 1, 2 and 3 nodes respectively. It looks like the range of x is too large and is causing artifacts. Try [-10,10] instead of [-1000,1000] i.e.

NDEigensystem[{-Laplacian[u[x], {x}] + 0.5 x^2 u[x], DirichletCondition[u[x] == 0, True]}, u[x], {x, -10, 10}, 4]

This gives the right eigenfunctions. Note that harmonic oscillator eigenfunctions is an example given in the Mathematica documentation for NDEigensystem under 'scope.'

$\endgroup$

Your Answer

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

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