With the exact solutions
u[{nx_, ny_}, {x_, y_}] = Sin[nx π x] Sin[ny π y];
and $\{n_x,n_y\}\in\mathbb{N}^2$, the eigenvalues are
λ[nx_, ny_] = (nx^2 + ny^2) π^2;
Test:
Assuming[Element[nx | ny, PositiveIntegers],
{u[{nx, ny}, {x, 0}], u[{nx, ny}, {x, 1}],
u[{nx, ny}, {0, y}], u[{nx, ny}, {1, y}]} // FullSimplify]
(* {0, 0, 0, 0} *)
-D[u[{nx, ny}, {x, y}], {x, 2}] - D[u[{nx, ny}, {x, y}], {y, 2}] ==
λ[nx, ny] * u[{nx, ny}, {x, y}] // FullSimplify
(* True *)
The number of pairs $\{n_x,n_y\}$ equal to $\lambda/\pi^2$ is therefore given by OEIS A063725. You can calculate the multiplicity of a given value of $i=\lambda/\pi^2$ directly from the generating function,
g[q_] = (EllipticTheta[3, q] - 1)^2/4;
m[i_Integer?NonNegative] := SeriesCoefficient[g[q], {q, 0, i}]
For example, the multiplicity of $\lambda=50\pi^2$ is 3, as you know:
m[50]
(* 3 *)
There is no eigenvalue at $326\pi^2$, on the other hand:
m[326]
(* 0 *)
More generally, the $d$-dimensional generating function
g[d_, q_] = ((EllipticTheta[3, q] - 1)/2)^d;
allows us to find the multiplicity of the eigenvalue $\lambda=i\pi^d$ directly:
m[d_Integer?NonNegative, i_Integer?NonNegative] :=
SeriesCoefficient[g[d, q], {q, 0, i}]
For example, the $d=17$-dimensional hypercube has $1\,416\,786\,753\,216$ eigenvalues $\lambda=250\pi^{17}$:
m[17, 250]
(* 1416786753216 *)
If you want the actual solutions, not just the number of solutions, PowersRepresentations
is a good starting point (but it gives solutions containing zeros, which we need to filter out):
s[d_Integer?NonNegative, i_Integer?NonNegative] :=
Select[PowersRepresentations[i, d, 2], Min[#] > 0 &]
For example, the eigenvalue $\lambda=50\pi^2$ in $d=2$ dimensions can be composed in two ordered ways, as you know:
s[2, 50]
(* {{1, 7}, {5, 5}} *)
Enumerating all permutations of these ordered combinations gives the full multiplicity of 3:
t[d_Integer?NonNegative, i_Integer?NonNegative] :=
Join @@ Permutations /@ s[d, i]
t[2, 50]
(* {{1, 7}, {7, 1}, {5, 5}} *)
In $d=17$ dimensions the eigenvalue $\lambda=250\pi^{17}$ has 999 ordered solutions,
s[17, 250]
(* {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 6, 14},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 10, 10},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 15},
...
{3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5},
{3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6}} *)
which then become the aforementioned $1\,416\,786\,753\,216$ unordered solutions from t[17, 250]
.
InputForm
and look at theMarkdown help
$\endgroup$