Theory of groups in classical and quantum physics