Calculate density matrix by a given observable

111 Views Asked by At

Given the value of my observable (Energy) and with a known hamiltonian, I would like to compute the value of my thermal state.

That is, with a given observable defined as: $$\langle\hat{O}\rangle=tr(\hat{O}\rho),$$

where the density matrix is

$$\rho=\sum_{i}p_{i}|\psi_{i}\rangle\langle\psi_{i}|$$

and

$$p_{i}=\frac{e^{-\beta{E_{i}}}}{Z}.$$

Given my observable value and the Hamiltonian, I want to know the value of $\beta.$

Is there any direct way to do it? How can I compute it in MATLAB?

Thank you very much in advance for your help and support.