This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sage.matrix.constructor import identity_matrix, matrix | |
def components(x): | |
new = [] | |
for i in range(len(x)): | |
a = abs(x[i]) | |
new.append(a) | |
print new | |
sorted = list(set(new)) | |
print sorted | |
'''sorting the absolute values of the braid word''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sage.groups.free_group import FreeGroupElement | |
from sage.groups.braid import Braid | |
#from sage.matrix.matrix_integer_dense import Matrix_integer_dense, delete_rows | |
class Link: | |
def __init__(self, input = None, gauss_code = None, dt_code = None): | |
if type(input) == sage.groups.braid.Braid: | |
self._braid = input | |
self._gauss_code = None | |
self._dt_code = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sage.groups.free_group import FreeGroupElement | |
from sage.groups.braid import Braid | |
class Link: | |
def __init__(self, input = None, gauss_code = None, dt_code = None): | |
if type(input) == sage.groups.braid.Braid: | |
self._braid = input | |
self._gauss_code = None | |
self._dt_code = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r""" | |
Link class | |
""" | |
#***************************************************************************** | |
# Copyright (C) 2014 | |
# | |
# Distributed under the terms of the GNU General Public License (GPL) | |
# http://www.gnu.org/licenses/ | |
#***************************************************************************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r""" | |
Link class | |
""" | |
#***************************************************************************** | |
# Copyright (C) 2014 | |
# | |
# Distributed under the terms of the GNU General Public License (GPL) | |
# http://www.gnu.org/licenses/ | |
#***************************************************************************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dt = self._dt_code | |
gauss = [] | |
y = [None for i in range(2*len(dt))] | |
x = [0 for i in range(2*len(dt))] | |
for i in range(len(dt)): | |
x[2*i] = 2*i + 1 | |
x[2*i + 1] = dt[i] | |
for i in range(len(dt)): | |
if x[2*i+1] > 0: | |
y[2*i+1] = 'under' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gauss_code(self): | |
r""" | |
Returns the gauss_code | |
INPUT: | |
- Either a braidword, gauss_code, dt_code | |
OUTPUT: | |
- Gauss code representation of the INPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dt_code(self): | |
r""" | |
Returns the dt_code | |
INPUT: | |
- Either a braidword, gauss_code, dt_code | |
OUTPUT: | |
- DT Code representation of the INPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def PD_code(self): | |
'''dt = self.dt_code() | |
y = [None for i in range(2*len(dt))] | |
x = [0 for i in range(2*len(dt))] | |
for i in range(len(dt)): | |
x[2*i] = 2*i + 1 | |
x[2*i + 1] = dt[i] | |
#print x | |
p = [[None,None] for i in range(len(x))] | |
t = [abs(r) for r in x] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l1 = list(left_component) | |
print l1 | |
for i in l1: | |
if i[0] < 0: | |
i[0] = abs(i[0]) | |
elif i[1] < 0: | |
i[1] = abs(i[1]) | |
print l1 | |
print id(l1) | |
print left_component |
OlderNewer