diff options
Diffstat (limited to 'single_dequantify.py')
-rw-r--r-- | single_dequantify.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/single_dequantify.py b/single_dequantify.py index 8e801a1..db2ed0c 100644 --- a/single_dequantify.py +++ b/single_dequantify.py @@ -5,7 +5,7 @@ import cmath as cmt import numpy as npy import scipy.linalg as sla -alpha = 3 +alpha = 0 beta = 1 norm = npy.linalg.norm([alpha, beta]) @@ -14,7 +14,7 @@ state = npy.array([alpha / norm, beta / norm]) dt = 0.1 iterations = 61 -H = npy.array([[2,0],[0,3]]) +H = npy.array([[2,1j],[-1j,3]]) def time_evolution(state, dt = dt): return npy.dot(state, sla.expm(-1j * dt * H)) @@ -36,13 +36,12 @@ def sphere2cart(phi, theta): historie = npy.array([bloch_map(state)]) f = open("data", "w") -for i in range(iterations): - state = time_evolution(state) - h = npy.dot(state, state) +for i in range(iterations + 1): historie = npy.vstack([historie,bloch_map(state)]) (phi, theta) = bloch_map(state) coords = sphere2cart(phi, theta) - f.write(f"{coords[0]}; {coords[1]}; {coords[2]}; {(i + 1) / iterations}\n") + f.write(f"{coords[0]}; {coords[1]}; {coords[2]}; {(i + 1) / (iterations + 1)}\n") + state = time_evolution(state) f.close() |