summaryrefslogtreecommitdiff
path: root/twoqbit_dequantify.py
diff options
context:
space:
mode:
Diffstat (limited to 'twoqbit_dequantify.py')
-rw-r--r--twoqbit_dequantify.py37
1 files changed, 19 insertions, 18 deletions
diff --git a/twoqbit_dequantify.py b/twoqbit_dequantify.py
index efc3304..af2e506 100644
--- a/twoqbit_dequantify.py
+++ b/twoqbit_dequantify.py
@@ -6,17 +6,10 @@ import cmath as cmt
import numpy as npy
import scipy.linalg as sla
-alpha = 2
-beta = 0
-gamma = 1
-delta = 1+1j
state_num = 1
-
-norm = npy.linalg.norm([alpha, beta, gamma, delta])
-state = npy.array([alpha / norm, beta / norm, gamma / norm, delta / norm])
-
-dt = 0.05
-iterations = 200
+dt = 0.02
+accu = 100
+iterations = 5000
M0 = [[1,0,0,0],[0,1,0,0],[0,0,-1,0],[0,0,0,-1]]
@@ -29,17 +22,24 @@ if len(sys.argv) == 3:
beta = complex(sys.argv[2])
def init_state(i):
- alpha = 1
- beta = 1
+ alpha = 2
+ beta = 0
+ gamma = 1
+ delta = 1+1j
if state_num > 1:
alpha = i / state_num
- beta = (state_num - i) / state_num
+ beta = -(state_num - i) / state_num
+ gamma = alpha + beta
+ delta = delta * i
H = npy.array([[1,0,0,1j],[0,2,0,0],[0,0,3,0],[-1j,0,0,4]])
- return ([alpha, beta, gamma, delta], H)
+ H = sla.expm(-1j * (dt / accu) * H)
+ norm = npy.linalg.norm([alpha, beta, gamma, delta])
+ state = npy.array([alpha / norm, beta / norm, gamma / norm, delta / norm])
+ return (state, H)
def time_evolution(state, dt = dt):
- return (npy.dot(state[0], sla.expm(-1j * dt * state[1])), state[1])
+ return (npy.dot(state[0], state[1]), state[1])
def fibration(state):
x0=npy.dot(npy.conj(state),npy.dot(M0,state))
@@ -67,9 +67,10 @@ for i in range(iterations):
if state_num > 1:
colour = j / state_num
f.write(f"{hopf_state[0]}; {hopf_state[1]}; {hopf_state[2]}; {hopf_state[3]}; {hopf_state[4]}; {colour}\n")
- states[j] = time_evolution(states[j])
+ for l in range(accu):
+ states[j] = time_evolution(states[j], dt / accu)
f.close()
-#plot.plot(iterations, iterations, state_num, "anim3d.plt")
-plot.plot(iterations, iterations, state_num, "anim2d.plt")
+plot.plot(iterations, iterations, state_num, "anim3d.plt")
+#plot.plot(iterations, iterations, state_num, "anim2d.plt")