import numpy as np

def state_for(p1):
    # L'état à amplitudes positives qui se lit 1 avec la probabilité p1
    return np.array([np.sqrt(1 - p1), np.sqrt(p1)])

# On choisit la probabilité de lire 1, et on en déduit l'état
for p1 in [0.0, 0.25, 0.5, 0.64, 1.0]:
    a, b = state_for(p1)
    print(f"P(1) voulue = {p1:.2f}  ->  état ({a:.3f}, {b:.3f})  ->  a² = {a**2:.2f}, b² = {b**2:.2f}")
