summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuplot/anim2d.plt3
-rw-r--r--gnuplot/anim3d.plt4
-rw-r--r--single_dequantify.py4
-rw-r--r--twoqbit_dequantify.py37
4 files changed, 26 insertions, 22 deletions
diff --git a/gnuplot/anim2d.plt b/gnuplot/anim2d.plt
index 38b8d5a..f131c1f 100644
--- a/gnuplot/anim2d.plt
+++ b/gnuplot/anim2d.plt
@@ -8,7 +8,8 @@ set yzeroaxis
set object circle at 0,0 size 1
do for [ii=start:end] {
- plot 'data' every ::1::ii * states using 4:5:6 w points palette pointsize 2 pointtype 7
+ plot 'data' every ::ii::ii * states using 4:5:6 w points palette pointsize 2 pointtype 7, \
+ 'data' every ::1::ii * states using 4:5:6 w l palette lw 3
pause 0.1
}
diff --git a/gnuplot/anim3d.plt b/gnuplot/anim3d.plt
index 99cfe10..05d9f51 100644
--- a/gnuplot/anim3d.plt
+++ b/gnuplot/anim3d.plt
@@ -2,9 +2,11 @@ set view equal xyz
set parametric
set isosamples 34,34
+ii = start
do for [ii=start:end] {
splot cos(u)*cos(v),cos(u)*sin(v),sin(u) w l lc rgb "#42a4f5", \
- 'data' every ::1::ii * states using 1:2:3:6 w points palette pointsize 2 pointtype 7#, \
+ 'data' every ::ii - states::ii * states using 1:2:3:6 w points palette pointsize 1.2 pointtype 7, \
+ 'data' every ::1::ii * states using 1:2:3:6 w l palette
pause 0.1
}
diff --git a/single_dequantify.py b/single_dequantify.py
index 99ebdc4..e90142a 100644
--- a/single_dequantify.py
+++ b/single_dequantify.py
@@ -7,7 +7,7 @@ import scipy.linalg as sla
dt = 0.08
iterations = 100
-state_num = 3
+state_num = 5
H = npy.array([[1,0],[0,2]])
@@ -59,5 +59,5 @@ for i in range(iterations):
states[j] = time_evolution(states[j])
f.close()
-plot.plot(1, iterations, state_num, "anim2d.plt")
+plot.plot(1, iterations, state_num, "anim3d.plt")
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")