Williamson theorem in classical, quantum, and statistical physics