I tried to implement an extended Heisenberg-Hamiltonian as an extra exercise further than my homework.
My Hamiltonian is the following: $H = \sum_{NN} \sigma_x\sigma_x + \sigma_z\sigma_z$
I try to implement this in Cirq on a GridQubit-square with 4 qubits.
Following problem: I calculated the ground state via the matrices analytically and tried to implement the problem in a circuit:
- I used cirq.XXPow- Gates and cirq.ZZPow Gates and cirq.XPow, cirq.ZPow.
- I used an if condition to determine if I measure in Z,Y or X basis. In Z, I append just the measurement, In Y I append X**0.5 to the circuit and in X, I append a Hadamard-Gate.
- Now I let the simulator run and get the probabilities and signs from the histograms. I sum the probabilities times the sign.
- Now I sum the expectation values in X-, Y- and Z-basis and use a classical optimizer.
My problem is that this does not work properly. Either the expectation value is way too big or way too small.
Where is my error in reasoning?
I think I did something wrong with the mechanism.