|q⟩ Bad Qubits

advanced · Programming · Advanced Hamiltonian Simulation

Checkpoint: Simulate a Spin Chain

This checkpoint ties the module together: you will Trotterize a genuine many-body Hamiltonian, run one evolution step on a three-spin chain, and read out the measurement distribution — combining the product-formula construction, the spin-chain encoding, and the measurement skills from the previous lessons.

The transverse-field Ising model

The transverse-field Ising model (TFIM) is the most-studied solvable many-body system and a standard quantum-simulation benchmark. On an open chain of three spins it is

H=J(Z0Z1+Z1Z2)    h(X0+X1+X2).H = -J\,(Z_0 Z_1 + Z_1 Z_2)\; -\; h\,(X_0 + X_1 + X_2).

The ZZZZ bonds want neighbouring spins to align (ferromagnetic order); the transverse field hXh X wants each spin to point along xx, i.e. into an equal superposition of up and down. The competition between these non-commuting terms — [ZiZi+1,Xi]0[Z_i Z_{i+1}, X_i] \ne 0 — drives the famous quantum phase transition at h=Jh = J, and it is exactly this non-commutativity that forces us to Trotterize.

One Trotter step

Split HH into the Ising part and the field part and apply each in turn (first order). Because of the minus signs in HH, the exact step carries positive exponents,

eiHtqeihtXqfield  a,beiJtZaZbbonds.e^{-iHt} \approx \underbrace{\prod_{q} e^{\,i\,h t\,X_q}}_{\text{field}}\; \underbrace{\prod_{\langle a,b\rangle} e^{\,i\,J t\,Z_a Z_b}}_{\text{bonds}}.

With the simulator's convention RP(θ)=eiθP/2R_P(\theta) = e^{-i\theta P/2}, a positive exponent e+iϕPe^{+i\phi P} is the rotation RP(2ϕ)R_P(-2\phi), so faithfully realising the minus-sign Hamiltonian needs θzz=2Jt\theta_{zz} = -2Jt and θx=2ht\theta_x = -2ht.

What you will observe

Starting from the polarised state 000|000\rangle, the Ising bonds alone only add phases and leave the all-zero outcome certain. It is the transverse field that does the interesting work: each RXR_X rotates a little amplitude into 1|1\rangle, so after one step the measurement distribution spreads across the basis — most weight stays on 000|000\rangle, with progressively smaller probabilities on states having one, two, or three flipped spins. The histogram you get is a snapshot of how quantum fluctuations begin to melt the ordered state.

Try it

Build one first-order Trotter step of the 3-spin TFIM (J=h=1J = h = 1, t=0.3t = 0.3), starting from 000|000\rangle, then measure. The grader checks the full measurement distribution against the value derived from the reference circuit.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.