I'm trying to compute the density of states of a 2D system when certain band structure data is organized in a particular format. Below is an example of my procedure:

Starting with a simple 2 x 2 Hamiltonian at the `kx`

, `ky`

represent the moments in x- and y-direction:

```
Delete everything
ε1 = -2 * t * Cos[kx];
ε2 = -2 * t * Cos[ky];
12 = 0.3 * t * sin[kx]*Sin[ky];
t = 1;
λ = 2.5;
h = {{ε1, ε12 + I * λ}, {ε12 - I * λ, ε2}};
```

I have written a loop that diagonalizes the above Hamiltonian at different times and calculates the energy (eigenvalues) at each one `kx / ky`

Append a 3-vector consisting of a particular pair of pulses and corresponding energy (i.e. `{px, py, max[e1, e1]}`

) to a list (`DOS1`

or `dos2`

) at each iteration:

```
n = 100;
dos1 = {};
dos2 = {};
To the[i = 0, i <n, i ++,
To the[J=0j[J=0j[j=0j[j=0j< n, j++,
px = -Pi + 2*Pi*(i/n) + 2*(Pi/(2*n));
py = -Pi + 2*Pi*(j/n) + 2*(Pi/(2*n));
e1 = Eigenvalues[h /. {kx -> px, ky -> py}][[1]];
e2 = eigenvalues[h /. {kx -> px, ky -> py}][[2]];
dos1 = attach[dos1, {px, py, Max[e1, e2]}];
dos2 = attach[dos2, {px, py, Min[e1, e2]}];];];
```

Everything works well here. I can plot the band structure (a `ListPlot3D`

Act of the `DOS1`

and `dos2`

follows from the previous loop),

I want to calculate and represent the density of states as follows:

I want to define a small energy increment (ie, an interval within `Dostot[[m, 3]]`

from where `dostot = union[dos1, dos2]`

and `m`

is only a counter) and counts for each energy increment over the entire spectrum the number of moments that correspond to the energies in that interval. I think something like that (count only moments in the x-direction).

```
dostot = union[dos1, dos2];
dosx = {};
To the[m = 1, m <= 20000, m++,
de = Interval[dostot[[m,3]]- 0.2, dostot[[m,3]]+ 0.2];
To the[i = 1, i <= 20000, i++,
dosx = Append[dosx, Count[de, dostot[[i,1]]]];];];
ListPlot[dosx]
```

Of course that can not work because `Dostot[[i, 1]]`

is a `kx`

Impulse that is no energy `Dostot[[m, 3]]`

So how can I calculate the momentum that corresponds to each energy gain `de`

and how can I avoid appending all zeros that result when an impulse is not within an energy interval associated with a given element? `m`

?

The final graph would have energy (in the specified increments) along the horizontal axis and the density of states (number of moments in each energy range) on the vertical axis.