# How to generate a random Hermitian matrix?

From Derbyshire's Prime Obsession, I would like to get the Mathematica code to generate a Hermitian matrix for evaluation and display. $256 \times 256$ would be nice. Random Normal distribution, eigenvalues, etc. All or part code. Any references? I am but a humble novice. New to StackExchange. Thanks.

• Were you referring to this? BTW, the current version now has GaussianUnitaryMatrixDistribution[]. Nov 21, 2015 at 0:22
• Thanks: I have Mathematica 10.3 including GaussianUnitaryMatrixDistribution[]. Didn't know I had it, but I do.
– Don
Dec 5, 2015 at 0:35

If I had interpreted you correctly, here's my attempt to do the figures here:

n = 269; k = 10;
mat = RandomVariate[GaussianUnitaryMatrixDistribution[n]];
eig = Sort[Eigenvalues[mat], LessEqual];
{p, q} = MinMax[eig]; h = (q - p)/k;
bins = BinLists[eig, {p, q, h}];

zer = Im[N[ZetaZero[Range[n]]]];
{zp, zq} = MinMax[zer]; zh = (zq - zp)/k;
zbins = BinLists[zer, {zp, zq, zh}];

{Graphics[Point[Flatten[MapIndexed[{#1 - h (#2[[1]] - 1), #2[[1]]} &, bins, {2}], 1]],
AspectRatio -> 1],
Graphics[Point[Flatten[MapIndexed[{#1 - zh (#2[[1]] - 1), #2[[1]]} &, zbins, {2}], 1]],
AspectRatio -> 1]} // GraphicsRow


• JM Thanks. The code is a big help. Don
– Don
Nov 23, 2015 at 2:54
• JM On further review the code in your answer was tight and elegant.
– Don
Dec 5, 2015 at 0:42