I feel bad that I haven’t given a demonstrative example, so I’ll “cheat” a bit and give one:
For the purposes of this example, we’ll set our Hilbert space to the the square integrable piecewise smooth functions on and let our “state vector”
Now consider a (bogus) state operator which has an eigenbasis and with eigenvalues (note: I know that this is a degenerate case in which some eigenvalues share two eigenfunctions).
Note also that the eigenfunctions are almost the functions used in the usual Fourier expansion; the difference is that I have scaled the functions so that as required for an orthonormal basis with this inner product.
Now we can write
(yes, I am abusing the equal sign here)
This means that
Now the only possible measurements of the operator are 0, -1, -4, -9, …. and the probability density function is:
One can check that
Here is a plot of the state function (blue line at the top) along with some of the eigenfunctions multiplied by their respective .