qiskit-algorithms icon indicating copy to clipboard operation
qiskit-algorithms copied to clipboard

Incorrect Axis Label in Magnetization Plot for Quantum State Measurements

Open ixaixim opened this issue 9 months ago • 0 comments

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:

  • If measurements are plotted separately: Use two separate plots or labels stating $\langle Z_1 \rangle$ and $\langle Z_2 \rangle$ respectively.
  • If measurements are aggregated (e.g., summed or averaged): Use labels such as "Average magnetization of $Z_1$ and $Z_2$" or "Sum magnetization $\langle Z_1 \rangle + \langle Z_2 \rangle$".

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

ixaixim avatar May 10 '24 09:05 ixaixim