I had an error when trying to do the PF 3.3. The exercise asks: For the same Bell circuit as before, build a 2-qubit device and return the probabilities for the tensor observable <Z_1 tensor_product z_2>. Don’t use shots, we’ll want the analytic value instead.
my attempt
dev = qml.device('default.qubit', wires = 2) # Define a two-qubit device here
@qml.qnode(dev)
def circuit():
"""
This quantum function implements a Bell state and
should return the probabilities for the PauliZ
observable on both qubits, using a single measurement
"""
qml.H(wires=0)
qml.CNOT(wires=[0,1])
return qml.expval(qml.Z(wires = 0) @ qml.Z(wires = 1)) # Add your measurement here
print(circuit())
it returns 0.9999999999999998. I saw that it should return 1. It’s happening a round-off error here because it is saying that the measurement isn’t right.