Spectral problem for differential operator

In versions 10.3 and higher, there's DEigensystem and NDEigensystem:

DEigensystem[{-Laplacian[y[x], {x}], 
  DirichletCondition[y[x] == 0, True]}, y[x], {x, 0, 1}, 4]
(*
  {{π^2, 4 π^2, 9 π^2, 16 π^2},                      <-- eigenvalues
   {Sin[π x], Sin[2 π x], Sin[3 π x], Sin[4 π x]}}   <-- eigenfunctions
*)

They require a linear operator, but it doesn't have to be trivial. The above is for $-{d^2y\over dx^2} = \lambda\,y$.


The answers you have so far work nicely for the trivial problem that you posed, but fail when you try a more complex problem, where you need to do everything numerically.

I asked a very similar question to this for solving a 10th order BVP eigenvalue problem. I wrote some code in order to solve it using the Compound Matrix Method to calculate the Evans function - an analytic function of $\omega$ whose roots correspond to eigenvalues of the original problem, which I've just put on GitHub.

Install the package via:

Needs["PacletManager`"] 
    PacletInstall["CompoundMatrixMethod", 
    "Site" -> "http://raw.githubusercontent.com/paclets/Repository/master"]

Then for your example, we first need to convert the system of ODEs and BCs into the correct matrix form,

Needs["CompoundMatrixMethod`"]
sys = ToMatrixSystem[y''[x] == - ω^2 y[x], {y[0] == 0, y[1] == 0}, 
      y, {x, 0, 1}, ω]

Now Evans[ω, sys] gives a function that can be evaluated at any complex $\omega$. Roots of this function give the eigenvalues of the original BVP.

Plot[Evans[ω, sys], {ω, 0, 15}]

enter image description here

Here you can see the roots are given by $\omega = n \pi$. The method works for a general system of equations, and can do infinite or semi-infinite domains.