in quantum physics if we have tensor product of two Pauli X it will be identity matrix, when examine this theory it does not work properly, here I two function for two qubit which I calculate expectation value of tensor product of X(0) X(1) X(1) which means X(0) (X(0) for qubit one, X(1) for qubit two), so both of them must return same result they didn’t .
import pennylane as qml
dev3 = qml.device("default.qubit", wires=2)
@qml.qnode(dev3)
def my_quantum_function(x, y):
qml.RY(x, wires=0)
qml.RY(y, wires=1)
return qml.expval(qml.PauliX(0) @ qml.PauliX(1) @ qml.PauliX(1))
print(my_quantum_function(10,5))
#and
import pennylane as qml
dev3 = qml.device("default.qubit", wires=2)
@qml.qnode(dev3)
def my_quantum_function(x, y):
qml.RY(x, wires=0)
qml.RY(y, wires=1)
return qml.expval(qml.PauliX(0))
print(my_quantum_function(10,5))
If you want help with diagnosing an error, please put the full error message below:
for the first one :-0.1543182172530106
for the second one:-0.5440211108893694
And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about()
.