Quantum simulator for the O(3) nonlinear sigma model