qiskit-community / qiskit-algorithms

A library of quantum algorithms for Qiskit.
https://qiskit-community.github.io/qiskit-algorithms/
Apache License 2.0
89 stars 43 forks source link

Incorrect Axis Label in Magnetization Plot for Quantum State Measurements #176

Open ixaixim opened 1 month ago

ixaixim commented 1 month ago

Environment

Algorithms: 0.30

What is happening?

Description

The second plot generated by the code for visualizing magnetization over time uses the ylabel "magnetization $\langle Z_1 Z_2 \rangle$", which suggests a correlation measurement between the first and second qubits. However, the observable used is defined as SparsePauliOp(["ZI", "IZ"]), which measures the Z component independently on the first and second qubits. This leads to a potential misunderstanding of what the plot represents.

Suggested Label Changes

Instead of the current ylabel, I suggest one of the following, depending on the actual computation performed:

How can we reproduce the issue?

run tutorial 10 pqvd.

Look where the following code is located (second plot).

Code Reference

The relevant code snippet is as follows:

plt.plot(result.times, magnetizations.real, color="crimson", label="PVQD")
plt.plot(exact_times, exact_magnetizations, ":", color="k", label="Exact")
plt.xlabel("time $t$")
plt.ylabel(r"magnetization $\langle Z_1 Z_2 \rangle$")
plt.title("Magnetization over time")
plt.legend(loc="best")
plt.savefig("magnetization_plot.png")

What should happen?

Axis name should be $\langle Z_1 \rangle + \langle Z_2 \rangle$.

Any suggestions?

No response