import math

# Avec i dans l'exposant, chaque petit pas ne prolonge plus la position : il part de côté, à angle droit.
# Partir de (x, y) vers le côté, c'est avancer dans la direction (-y, x).
theta = math.pi / 2
for n in (4, 100, 10_000, 1_000_000):
    x, y = 1.0, 0.0
    for _ in range(n):
        x, y = x - y * theta / n, y + x * theta / n
    print(f"{n:>9} pas : ({x:7.4f}, {y:7.4f})")

# Le point d'arrivée, quand les pas deviennent minuscules : le quart de tour
print("cos θ, sin θ   : (", round(math.cos(theta), 4) + 0.0, ",", round(math.sin(theta), 4), ")")
