# Wrong Expectation value when implementing a VQE for the Heisenberg Hamiltonian

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:

1. I used cirq.XXPow- Gates and cirq.ZZPow Gates and cirq.XPow, cirq.ZPow.
2. 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.
3. Now I let the simulator run and get the probabilities and signs from the histograms. I sum the probabilities times the sign.
4. 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.

• Just as a sanity check: if you set the ansatz to the ground state, is the estimate accurate? Sep 30 '20 at 14:36
• If not, this implies the protocol itself is wrong. If so, this implies the optimizer is at fault Sep 30 '20 at 14:36
• Also - what do you mean by X**0.5 ? Sep 30 '20 at 14:37