# Measuring the expected energy of a quantum circuit

I implemented the following circuit:

I am interested in measuring the expected energy of the circuit. I am using Cirq. I am wondering what are the next steps. Sorry if the question seems very basic, but I am not sure how to interpret the measurement gate to extract this energy.

Thank you.

• Circuits don't have a defined quantity called energy. Do you have a Hamiltonian in mind, and want to measure the energy of the output of the circuit w.r.t. that Hamiltonian? – Craig Gidney Jun 22 '19 at 14:25
• That is a great question! First of all, nice to meet you! Second, I just adding the paper for reference cs.umd.edu/class/fall2018/cmsc657/projects/group_16.pdf This is actually a big question I have: I am still working on understanding how to take a hamiltonian and develop an ansatz, and in this particular case, how to do the reverse. – Enrique Segura Jun 22 '19 at 18:02
• Having (very) briefly skimmed that paper you mentioned, I'd be quite suspicious of the circuit you're trying to implement. It seems that the authors have implicitly assumed that $\sum_nX_n$ and $\sum_nZ_nZ_{n+1}$ commute, which they don't – DaftWullie Jun 24 '19 at 7:14
• @DaftWullie: Thank you for telling me! – Enrique Segura Jun 24 '19 at 18:10
• @DaftWullie It's pretty common to see Hamiltonians that decompose into non-commuting terms being simulated via Trotterization. And the particular alternation of X basis and Z basis stuff is particularly common; it shows up in Grover, in the QAOA, etc. – Craig Gidney Jun 24 '19 at 20:49