I am computing Laplacian on a unit square $textbf{numerically}$.

Consider the eigenvalue problem on $Omega = (0 , 1)^2$ $$-Lu = lambda u$$ where $$L = frac{partial^2}{partial x^2} + frac{partial^2}{partial y^2}$$

The Dirichlet’s boundary condition is $u = 0$ on $partial Omega$.

I have written the following for first $100$ eigenvalues.

```
{ℒ, ℬ} = {-Laplacian(u(x, y), {x, y}),
DirichletCondition(u(x, y) == 0, True)};
{vals, funs} =
DEigensystem({ℒ, ℬ},
u(x, y), {x, 0, 1}, {y, 0, 1},100);
vals
```

Now I am interested in computing multiplicity of eigenvalues. I already know that `Tally`

can certainly count the occurrances of eigenvalues in the list called `vals`

.

I know that $textbf{analytically}$ the eigenvalues are $lambda _{mn} = (m^2 + n^2) pi^2$ where $m,n =1, 2, 3cdots$. Moreover, calculating multiplicity of a specific eigenvalue is same as the number theory problem namely how many ways $frac{lambda_{mn}}{pi ^2}$ can be written as $m^2 +n^2$. For example, consider the eigenvalue $5pi^2$, the multiplicity of this eigenvalue is $2$ since $5$ can be written as $5 = 1^2 +2^2 = 2^2+ 1^2$. Similarly, Similarly, if we consider the eigenvalue $50 pi^2$, we can write $50 = m^2 + n^2$ in three ways, i.e. $50 = 1^2 + 7^2 = 7^2 + 1^2 = 5^2 + 5^2$. Therefore the multiplicity of the eigenvalue is $3$. Therefore, computing multiplicity (occurrances of eigenvalues in the list) of a eigenvalue $textbf{analytically}$ is equivalent to the above said number theory problem.

But I want to compute multiplicity without getting into analytic solution since most of the time analytic solutions are unavailable.

Also, the eigenvalue problem has infinite numbers of eigenvalue. So `Tally(vals)`

in the following

```
{ℒ, ℬ} = {-Laplacian(u(x, y), {x, y}),
DirichletCondition(u(x, y) == 0, True)};
{vals, funs} =
DEigensystem({ℒ, ℬ},
u(x, y), {x, 0, 1}, {y, 0, 1},100);
Tally(vals)
```

does not work properly. Therefore, since there are infinite numbers of eigenvalues and we can not list all of them, I am looking to compute the multiplicity of a eigenvalue (occurrances of eigenvalues in the list) without any specification on ‘numbers of eigenvalues’ and that would give me the complete multiplicity of that particular eigenvalue.

But it may be that I did not write the question properly. If you please improve my question, it’ll be appricitable.

Thanking in advanced.