# Program for computing Weyl's law

I have calculated the solution to the Laplacian eigenvalue problem on the unit square

$$\qquad - \Delta u(x,y) = \lambda u(x,y) \text{ on } {[0,1]}^2$$

with the Dirichlet's boundary condition ($$u = 0$$).

My question is as follows:

Is it possible to write a program which calculate $$N(t)$$, the number of eigenvalues less than or equal to $$t$$?

Note that you should not name symbols with capital letters, because the is danger to overwrite a system symbol. In your case N is used by the system to coerce a machine number. So let's call the function selEV. As there are an infinity of Eigenvalues, we must restrict the number of Eigenvalues to calculate. You must guess an upper bound of expected eigen values: maxn. For an example I choose maxn=10 :

{ℒ, ℬ} = {-Laplacian[u[x, y], {x, y}],
DirichletCondition[u[x, y] == 0, True]};

maxn = 10;
selEV[t_] :=  Select[DEigenvalues[{ℒ, ℬ},  u[x, y], {x, 0, π}, {y, 0, π}, maxn], # <= t &] // Length


And e.g. for t==7we get:

selEV[7]

(* 3 *)

• Can you please tell me what the result is selEV[7] = (2, 5, 5). Please help me. – no name Feb 8 at 5:22
• My second question is do I need to choose the "maxh", because I am giving a $t$ and looking for the number of eigenvalues $\leq t$. Please help me. – no name Feb 8 at 5:31
• Yes the result for "selEV[7]" is {2,5,5}. And yes, you must specify "nmax". As there are infinite many Eigenvalues, it is impossible to calculate all. Instead, the system calculates "nmax" eigenvalues and returns those that are <= t. – Daniel Huber Feb 8 at 9:20
• Thanks for your answer. I want to know what is {2, 5, 5}. Since I am asking for the no. of eigenvalues less than or equal to $t$ for a given number $t$. Please help me. – no name Feb 8 at 9:43
• 2,5,5 are the eigenvalues <=7, the number is 3. To get the number of eigenvalues you can write: selEV[t:]:= Select[...] //Length. I change my answer accordingly. – Daniel Huber Feb 8 at 9:57