# Plotting an integer-valued function

Consider the quantity $$H=n-1-\sum_{i\ne j} R_{ij},$$where $$R$$ is a random $$n\times n$$ Hermitian matrix with trace $$1$$. The code that generates it was kindly provided by a user in another question of mine:

ClearAll[symmetrize, mR, h]
symmetrize = (1/2) (# + ConjugateTranspose @ #) &;

mR[n_Integer] := Module[{a = symmetrize@RandomComplex[1 + I, {n, n}]}, a/Tr[a]]

h[m_] := Length[m] - 1 - Total[MapIndexed[Drop]@m, 2]


My objective is to define the quantities $$\tau_1=\frac{\pi\hbar}{2H},\quad \tau_2=\frac{\pi\hbar}{2\Delta H}$$ where $$\Delta H=H(n-H)$$ and plot $$\max(\tau_1,\tau_2)$$ as a function of the dimension $$n$$.

This is my naive approach to the code:

delta[m_]=h[m]*(Lenght[m]-h[m])

tau1[m_]:=(Pi*\[HBar])/(2*h[m])
tau2[m_]:= (Pi*\[HBar])/(2*delta[m])

DiscretePlot[Max[tau1[m], tau2[m]], {Lenght[m], 0, 1000}]


I don't get any errors, but the plot turns out to be empty. Any tip on how to solve this is greatly appreciated!

• hbar needs a value, and Length needs to be spelled correctly. – Bill Watts Feb 22 at 19:09
• hbar is interpreted as $\hbar$ in the editor, so it does have a value. @Bill, I forgot to add the lines that actually generate the matrix and $H$, namely r=mR@3 and h@r. However, still no dice! – TotalNoob Feb 22 at 19:37
• also in the DiscretePlot command, Length[m] should be m. – Bill Watts Feb 22 at 19:38
• hbar does not have a value. You can evaluate tau1[500] to see that. – Bill Watts Feb 22 at 19:42
• @BillWatts Not quite, as I am interested in plotting with respect to $n$ rather than $m$. In short, fix a matrix with such and such conditions, and plot in various dimensions the quantity $\max(\tau_1, \tau_2)$. – TotalNoob Feb 22 at 19:42

I think that $$0\le1+\sum_{i\neq j}R_{i,j}\le n$$, and so you have $$0\le H\le n$$. This means that both $$\tau_1$$ and $$\tau_2$$ are unbounded.

The extreme cases for $$H$$ come from the following matrices:

• For R = ConstantArray[1/n, {n, n}] you'll find $$H=0$$.
• For R = SparseArray[{{1,1}->1/2, {1,2}->-1/2, {2,1}->-1/2, {2,2}->1/2}, {n,n}] (for example) you'll find $$H=n$$.
• Thank you for your answer. What do you mean exactly by unbounded? $\max(\tau_1,\tau_2)$ is supp.osed to represent a time interval – TotalNoob Feb 22 at 23:19
• "Unbounded" means there can be values all the way up to infinity. Just look at what happens for R = ConstantArray[1/n, {n, n}]: you'll have H = 0 and therefore $\tau_1=\tau_2=\infty$. For the other extreme example I gave, you have a finite $\tau_1$ but you still have $\tau_2=\infty$. – Roman Feb 23 at 7:09

I don't know if this is what you want, but I do get a plot with:

\[HBar] = 1

DiscretePlot[Max[tau1[mR[n]], tau2[mR[n]]], {n, 0, 1000}]


You can set $$\hbar$$ to its real value if you want.

• Thank your for your answer - it really doesn't look very good. I'll look into the code and see if there is something to change. – TotalNoob Feb 22 at 23:14