Simulating physical systems