I found the difference between dynamical and static variables explained here: https://physics.stackexchange.com/a/154977/239775
My question is: Are only dynamical variables represented by observables in quantum mechanics, or both?
I found the difference between dynamical and static variables explained here: https://physics.stackexchange.com/a/154977/239775
My question is: Are only dynamical variables represented by observables in quantum mechanics, or both?
A static variable, defined as one which doesn't change with time (thus, is compatible with Hamiltonian), and also doesn't get affected by the measurement of any other observable (thus, is compatible with all other observables), would necessarily have to be represented by an operator that is proportional to the identity matrix with the proportionality constant being the value of the variable. Since the identity matrix is Hermitian, such an operator does represent an observable. However, since all states are eigenstates of an identity matrix, a direct measurement of such an observable would be trivial. Since it commutes with all dynamical observables, you can easily infer its value via measurements of some dynamical variables that are related to the static variable (see the example below), and one could treat the static variable as a fixed scalar parameter of the system for all intents and purposes thereafter.
As an example, consider the mass of a particle in Galilean quantum mechanics. You can infer the mass of a free particle as the value obtained for $\frac{p^2}{2E}$ when you simultaneously measure the momentum and the energy of the particle and then treat it simply as a fixed scalar parameter rather than treating it as a matrix $m\mathbb{I}$.
Notice that this subject is closely related to superselection rules. If you could prepare a state in a superposition of states with different masses, in such a Hilbert space, the mass operator would become non-trivial and then mass would be a dynamical variable. For example, if you measure the mass of the state comprised of a superposition of states with different masses, it would non-trivially collapse the state. However, due to the Bargmann mass superselection rule for systems obeying Galilean invariance, such superpositions are not allowed and one can always treat mass as a static variable. See, Is mass an observable in Quantum Mechanics?. The other example of a static variable mentioned in the nice answer by @LubošMotl
(on the post that you've linked to in your question) is that of an electric charge which is also related to a superselection rule that forbids superpositions of states with different electric charges.