の対応をチェックするためのpythonスクリプト
前回のスクリプトと合わせると、
ソリトン->rigged configuration
による時間発展の線形化が確認できるはず。(後日に記載予定)
python soliton_config.py
path [1, 2, 1, 2, 1, 1, 2, 2]
type: 8
0 ** 0
2 * 0
2 * 0
path [1, 2, 1, 1, 2, 1, 2, 2]
type: 8
0 ** 0
2 * 1
2 * 0
path [1, 2, 1, 1, 2, 2, 1, 2]
type: 8
0 ** 0
2 * 2
2 * 0
path [1, 1, 2, 1, 2, 1, 2, 2]
type: 8
0 ** 0
2 * 1
2 * 1
path [1, 1, 2, 1, 2, 2, 1, 2]
type: 8
0 ** 0
2 * 2
2 * 1
path [1, 1, 2, 2, 1, 2, 1, 2]
type: 8
0 ** 0
2 * 2
2 * 2
#!/usr/bin/python
class YoungDiagram:
def __init__(self):
self.shape = []
def __init__(self, shape):
self.shape = shape
def depth(self):
return len(self.shape)
def total(self):
return sum(self.shape)
def transpose_shape(self):
list = []
for i in range(self.shape[0]):
list.append(len(filter(lambda x: x>i, self.shape)))
return list
def first(self):
if len(self.shape) == 0:
return 0
return self.shape[0]
def m(self,j):
return len(filter(lambda x: x == j, self.shape))
def q(self, j):
if len(self.shape) == 0:
return 0
s = 0
for k in range(self.shape[0]+1):
s += min(j, k)*self.m(k)
return s
def __str__(self):
for i in self.shape:
print "\t","*"*i
return ""
# n=1 type(1^L) only
class Configuration:
def __init__(self, type, shape):
self.type = type
self.u1 = YoungDiagram(shape)
self.update_vacancy()
self.rigging = []
def p(self, j):
return self.type - 2 * self.u1.q(j)
def update_vacancy(self):
self.vacancy = []
list = []
for j in range(self.u1.first()+1):
list.append(self.p(j))
for j in self.u1.shape:
self.vacancy.append(list[j])
def singular_test(self):
list = []
for i in range(len(self.vacancy)):
list.append(self.vacancy[i] == self.rigging[i])
return list
def add_1(self):
self.type += 1
self.update_vacancy()
def add_2(self):
list = self.singular_test()
try:
i = list.index(True) # index of a singular string
self.type += 1
self.u1.shape[i] += 1 # extend the singular string
self.update_vacancy()
self.rigging[i] = self.vacancy[i]
except ValueError: # no singular string, add 1-string
self.type += 1
self.u1.shape.append(1)
self.update_vacancy()
try:
i = self.u1.shape.index(1)
self.rigging.insert(i, self.vacancy[-1])
except ValueError:
self.rigging.append(self.vacancy[-1])
def add(self, list):
self.path = list
for v in list:
if v == 1:
self.add_1()
else:
self.add_2()
def __str__(self):
print "path", self.path
print "type:",self.type
for i in range(len(self.vacancy)):
print "\t",self.vacancy[i], "*"*self.u1.shape[i], self.rigging[i]
return ""
##test
c = Configuration(0, [])
c.add([1,2,1,2,1,1,2,2])
print c
c = Configuration(0, [])
c.add([1,2,1,1,2,1,2,2])
print c
c = Configuration(0, [])
c.add([1,2,1,1,2,2,1,2])
print c
c = Configuration(0, [])
c.add([1,1,2,1,2,1,2,2])
print c
c = Configuration(0, [])
c.add([1,1,2,1,2,2,1,2])
print c
c = Configuration(0, [])
c.add([1,1,2,2,1,2,1,2])
print c
0 件のコメント:
コメントを投稿