# Les six états remarquables, et leur point (x, y, z) sur la sphère
import numpy as np
from common import bloch_vector, rounded
from qsim.etape1_un_qubit import ONE, ZERO, make_state

s = 1 / np.sqrt(2)
states = {
    "|0⟩": ZERO,
    "|1⟩": ONE,
    "|+⟩": make_state(s, s),
    "|−⟩": make_state(s, -s),
    "|+i⟩": make_state(s, 1j * s),
    "|−i⟩": make_state(s, -1j * s),
}
for name, state in states.items():
    point = bloch_vector(state)
    print(f"{name:<5} (x, y, z) = {rounded(point)}   distance au centre = {np.linalg.norm(point):.3f}")

# Les trois coordonnées calculées à la main, pour un point de l'équateur entre |+⟩ et |+i⟩
theta, phi = np.pi / 2, np.pi / 4
x, y, z = np.sin(theta) * np.cos(phi), np.sin(theta) * np.sin(phi), np.cos(theta)
print("θ = π/2, φ = π/4 :", rounded([x, y, z]))
