MMa can't do the y^2
, but if you mean this:
sol = DSolve[{y''[x] + \[Omega]^2 y[x] == 0, y[0] == 0, y[1] == 0},y[x], x]
(* y[x]->C[1] Sin[x Sqrt[\[Omega]^2]]n \[Element] Integers && n >= 1 && \[Omega]^2==n^2 \[Pi]^2 *)
If you really want to do it with the y^2
and want an analytical solution, MMa can solve the ode without the conditions. Have to use FindRoot to solve for the constants, since the equations are trancendental.
The above eigenvalues and eigenvectors use M11. For older versions do the following. Similar to what you would do on paper.
pde = y''[x] + \[Omega]^2 y[x] == 0
DSolve without conditions
sol = DSolve[pde, y[x], x] // Flatten
(* c1 Cos[x \[Omega]] + c2 Sin[x \[Omega]] *)
y[x_] = y[x] /. % /. {C[1] -> c1, C[2] -> c2}
bc1 y[0]==0
c1 = c1 /. Solve[y[0] == 0, c1][[1]]
(0)
Now if we just solve for c2 from the second bc we will get the trivial answer 0. Instead
y[1]==0
c2 Sin[\[Omega]] == 0
Reduce[{%, \[Omega] > 0}, \[Omega]]
(c2 == 0 && \[Omega] > 0) || (C[1] \[Element]
Integers && ((C[1] >= 1 && \[Omega] == 2 \[Pi] C[1]) || (C[1] >=
0 && \[Omega] == 2 \[Pi] C[1] + \[Pi])))
Boils down to
\[Omega] = n Pi
$Assumptions = n \[Element] Integers
y[x]
(* c2 Sin[Pi n x] *)
Can normalize if you want
c2 = c2 /. Solve[Integrate[y[x]^2, {x, 0, 1}] == 1, c2][[2]]
(* Sqrt[2] *)
y[x]
(* Sqrt[2] sin(Pi n x) *)