Everything - i think - about sigma function or search for null signature is removed.
This commit is contained in:
parent
f12976180e
commit
58986ff162
@ -32,7 +32,6 @@ class SignatureFunction(object):
|
||||
self.cnt_signature_jumps = counter
|
||||
# self.tikz_plot("bum.tex")
|
||||
|
||||
|
||||
def is_zero_everywhere(self):
|
||||
return not any(self.cnt_signature_jumps.values())
|
||||
|
||||
@ -178,6 +177,7 @@ class SignatureFunction(object):
|
||||
f.write("\\end{document}\n")
|
||||
|
||||
|
||||
|
||||
class TorusCable(object):
|
||||
def __init__(self, knot_formula, k_vector=None, q_vector=None):
|
||||
|
||||
@ -194,13 +194,6 @@ class TorusCable(object):
|
||||
self._sigma_function = None
|
||||
self._signature_as_function_of_theta = None
|
||||
|
||||
# SIGMA & SIGNATURE
|
||||
@property
|
||||
def sigma_function(self):
|
||||
if self._sigma_function is None:
|
||||
self._sigma_function = self.get_sigma_function()
|
||||
return self._sigma_function
|
||||
|
||||
@property
|
||||
def signature_as_function_of_theta(self):
|
||||
if self._signature_as_function_of_theta is None:
|
||||
@ -539,7 +532,7 @@ class TorusCable(object):
|
||||
get_summand_signture_function_docsting
|
||||
return get_summand_signture_function
|
||||
|
||||
def is_metaboliser(self, theta):
|
||||
def is_metabolizer(self, theta):
|
||||
i = 1
|
||||
sum = 0
|
||||
for idx, el in enumerate(theta):
|
||||
@ -570,220 +563,69 @@ class TorusCable(object):
|
||||
# bad_vectors.append(vector)
|
||||
# return good_vectors, bad_vectors
|
||||
|
||||
# searching for signature == 0
|
||||
def get_number_of_combinations_of_theta(self):
|
||||
number_of_combinations = 1
|
||||
for knot in self.knot_sum:
|
||||
number_of_combinations *= (2 * abs(knot[-1]) + 1)
|
||||
return number_of_combinations
|
||||
|
||||
# searching for signature == 0
|
||||
def check_for_null_theta_combinations(self, verbose=False):
|
||||
list_of_good_vectors= []
|
||||
number_of_null_comb = 0
|
||||
f = self.signature_as_function_of_theta
|
||||
range_list = [range(abs(knot[-1]) + 1) for knot in self.knot_sum]
|
||||
for theta_vector in it.product(*range_list):
|
||||
if f(*theta_vector).is_zero_everywhere():
|
||||
list_of_good_vectors.append(theta_vector)
|
||||
m = len([theta for theta in theta_vector if theta != 0])
|
||||
number_of_null_comb += 2^m
|
||||
return number_of_null_comb, list_of_good_vectors
|
||||
def is_signature_big_in_ranges(self, ranges_list):
|
||||
is_big = True
|
||||
for theta in it.product(*ranges_list):
|
||||
if not any(theta):
|
||||
continue
|
||||
|
||||
# searching for signature == 0
|
||||
def eval_cable_for_null_signature(self, print_results=False, verbose=False):
|
||||
# search for zero combinations
|
||||
number_of_all_comb = self.get_number_of_combinations_of_theta()
|
||||
result = self.check_for_null_theta_combinations(verbose=verbose)
|
||||
number_of_null_comb, list_of_good_vectors = result
|
||||
we_have_a_problem = True
|
||||
if self.is_metabolizer(theta):
|
||||
for shift in range(1, self.q_order):
|
||||
shifted_theta = [(shift * th) % self.last_q_list[i]
|
||||
for i, th in enumerate(theta)]
|
||||
shifted_theta = [min(th, self.last_q_list[i] - th)
|
||||
for i, th in enumerate(shifted_theta)]
|
||||
sf = self.signature_as_function_of_theta(*shifted_theta)
|
||||
extremum = abs(sf.extremum())
|
||||
if shift > 1:
|
||||
print(shifted_theta, end=" ")
|
||||
print(extremum)
|
||||
if extremum > 5 + np.count_nonzero(shifted_theta):
|
||||
# print("ok")
|
||||
we_have_a_problem = False
|
||||
break
|
||||
elif shift == 1:
|
||||
print("*" * 10)
|
||||
print(shifted_theta, end=" ")
|
||||
print(extremum)
|
||||
if we_have_a_problem:
|
||||
is_big = False
|
||||
break
|
||||
if not is_big:
|
||||
print("we have a big problem")
|
||||
return is_big
|
||||
|
||||
if print_results:
|
||||
print()
|
||||
print(self.knot_description)
|
||||
print("Zero cases: " + str(number_of_null_comb))
|
||||
print("All cases: " + str(number_of_all_comb))
|
||||
if list_of_good_vectors:
|
||||
print("Zero theta combinations: ")
|
||||
for el in list_of_good_vectors:
|
||||
print(el)
|
||||
if number_of_null_comb^2 >= number_of_all_comb:
|
||||
return number_of_null_comb, number_of_all_comb
|
||||
return None
|
||||
def is_signature_big_for_all_metabolizers(self):
|
||||
if len(self.knot_sum) == 8:
|
||||
for shift in range(0, 8, 4):
|
||||
ranges_list = 8 * [range(0, 1)]
|
||||
ranges_list[shift : shift + 3] = [range(0, i + 1) for i in \
|
||||
self.last_k_list[shift: shift + 3]]
|
||||
ranges_list[shift + 3] = range(0, 2)
|
||||
if not self.is_signature_big_in_ranges(ranges_list):
|
||||
return False
|
||||
else:
|
||||
print("\n\nok")
|
||||
return True
|
||||
|
||||
elif len(self.knot_sum) == 4:
|
||||
print("\n\n\nhohohohohoho")
|
||||
upper_bounds = self.last_k_list[:3]
|
||||
ranges_list = [range(0, i + 1) for i in upper_bounds]
|
||||
ranges_list.append(range(0, 2))
|
||||
if not self.is_signature_big_in_ranges(ranges_list):
|
||||
return False
|
||||
return True
|
||||
|
||||
##############################################################################
|
||||
# sigma function
|
||||
msg = "Function implemented only for knots with 4 or 8 summands"
|
||||
raise ValueError(msg)
|
||||
|
||||
def get_sigma_function(self):
|
||||
if len(self.k_vector) != 4:
|
||||
msg = "This function is not implemented for k_vectors " +\
|
||||
"with len other than 4."
|
||||
raise IndexError(msg)
|
||||
k_1, k_2, k_3, k_4 = [abs(k) for k in self.k_vector]
|
||||
last_q = 2 * k_4 + 1
|
||||
ksi = 1/last_q
|
||||
sigma_q_1 = self.get_untwisted_signature_function(k_1)
|
||||
sigma_q_2 = self.get_untwisted_signature_function(k_2)
|
||||
sigma_q_3 = self.get_untwisted_signature_function(k_3)
|
||||
|
||||
def sigma_function(theta_vector, print_results=False):
|
||||
# "untwisted" part (Levine-Tristram signatures)
|
||||
a_1, a_2, a_3, a_4 = theta_vector
|
||||
untwisted_part = 2 * (sigma_q_2(ksi * a_1) -
|
||||
sigma_q_2(ksi * a_2) +
|
||||
sigma_q_3(ksi * a_3) -
|
||||
sigma_q_3(ksi * a_4) +
|
||||
sigma_q_1(ksi * a_1 * 2) -
|
||||
sigma_q_1(ksi * a_4 * 2))
|
||||
# "twisted" part
|
||||
tp = [0, 0, 0, 0]
|
||||
for i, a in enumerate(theta_vector):
|
||||
if a:
|
||||
tp[i] = -last_q + 2 * a - 2 * (a^2/last_q)
|
||||
twisted_part = tp[0] - tp[1] + tp[2] - tp[3]
|
||||
# if print_results:
|
||||
# self.print_results_LT(theta_vector, untwisted_part)
|
||||
# self.print_results_LT(theta_vector, twisted_part)
|
||||
|
||||
sigma_v = untwisted_part + twisted_part
|
||||
return sigma_v
|
||||
return sigma_function
|
||||
|
||||
def print_results_LT(self, theta_vector, untwisted_part):
|
||||
knot_description = self.knot_description
|
||||
k_1, k_2, k_3, k_4 = [abs(k) for k in self.k_vector]
|
||||
a_1, a_2, a_3, a_4 = theta_vector
|
||||
last_q = 2 * k_4 + 1
|
||||
ksi = 1/last_q
|
||||
sigma_q_1 = self.get_untwisted_signature_function(k_1)
|
||||
sigma_q_2 = self.get_untwisted_signature_function(k_2)
|
||||
sigma_q_3 = self.get_untwisted_signature_function(k_3)
|
||||
print("\n\nLevine-Tristram signatures for the cable sum: ")
|
||||
print(knot_description)
|
||||
print("and characters:\n" + str(theta_vector) + ",")
|
||||
print("ksi = " + str(ksi))
|
||||
print("\n\n2 * (sigma_q_2(ksi * a_1) + " + \
|
||||
"sigma_q_1(ksi * a_1 * 2) - " +\
|
||||
"sigma_q_2(ksi * a_2) + " +\
|
||||
"sigma_q_3(ksi * a_3) - " +\
|
||||
"sigma_q_3(ksi * a_4) - " +\
|
||||
"sigma_q_1(ksi * a_4 * 2))" +\
|
||||
\
|
||||
" = \n\n2 * (sigma_q_2(" + \
|
||||
str(ksi) + " * " + str(a_1) + \
|
||||
") + sigma_q_1(" + \
|
||||
str(ksi) + " * " + str(a_1) + " * 2" + \
|
||||
") - sigma_q_2(" + \
|
||||
str(ksi) + " * " + str(a_2) + \
|
||||
") + sigma_q_3(" + \
|
||||
str(ksi) + " * " + str(a_3) + \
|
||||
") - sigma_q_3(" + \
|
||||
str(ksi) + " * " + str(a_4) + \
|
||||
") - sigma_q_1(" + \
|
||||
str(ksi) + " * " + str(a_4) + " * 2)) " + \
|
||||
\
|
||||
" = \n\n2 * (sigma_q_2(" + \
|
||||
str(mod_one(ksi * a_1)) + \
|
||||
") + sigma_q_1(" + \
|
||||
str(mod_one(ksi * a_1 * 2)) + \
|
||||
") - sigma_q_2(" + \
|
||||
str(mod_one(ksi * a_2)) + \
|
||||
") + sigma_q_3(" + \
|
||||
str(mod_one(ksi * a_3)) + \
|
||||
") - sigma_q_3(" + \
|
||||
str(mod_one(ksi * a_4)) + \
|
||||
") - sigma_q_1(" + \
|
||||
str(mod_one(ksi * a_4 * 2)) + \
|
||||
\
|
||||
") = \n\n2 * ((" + \
|
||||
str(sigma_q_2(ksi * a_1)) + \
|
||||
") + (" + \
|
||||
str(sigma_q_1(ksi * a_1 * 2)) + \
|
||||
") - (" + \
|
||||
str(sigma_q_2(ksi * a_2)) + \
|
||||
") + (" + \
|
||||
str(sigma_q_3(ksi * a_3)) + \
|
||||
") - (" + \
|
||||
str(sigma_q_3(ksi * a_4)) + \
|
||||
") - (" + \
|
||||
str(sigma_q_1(ksi * a_4 * 2)) + ")) = " + \
|
||||
"\n\n2 * (" + \
|
||||
str(sigma_q_2(ksi * a_1) +
|
||||
sigma_q_1(ksi * a_1 * 2) -
|
||||
sigma_q_2(ksi * a_2) +
|
||||
sigma_q_3(ksi * a_3) -
|
||||
sigma_q_3(ksi * a_4) -
|
||||
sigma_q_1(ksi * a_4 * 2)) + \
|
||||
") = " + str(untwisted_part))
|
||||
print("\nSignatures:")
|
||||
print("\nq_1 = " + str(2 * k_1 + 1) + ": " + repr(sigma_q_1))
|
||||
print("\nq_2 = " + str(2 * k_2 + 1) + ": " + repr(sigma_q_2))
|
||||
print("\nq_3 = " + str(2 * k_3 + 1) + ": " + repr(sigma_q_3))
|
||||
|
||||
def print_results_sigma(self, theta_vector, twisted_part):
|
||||
a_1, a_2, a_3, a_4 = theta_vector
|
||||
knot_description = self.knot_description
|
||||
last_q = self.q_vector[-1]
|
||||
print("\n\nSigma values for the cable sum: ")
|
||||
print(knot_description)
|
||||
print("and characters: " + str(v_theta))
|
||||
print("\nsigma(T_{2, q_4}, ksi_a) = " + \
|
||||
"-q + (2 * a * (q_4 - a)/q_4) " +\
|
||||
"= -q + 2 * a - 2 * a^2/q_4 if a != 0,\n\t\t\t" +\
|
||||
" = 0 if a == 0.")
|
||||
print("\nsigma(T_{2, q_4}, chi_a_1) = ", end="")
|
||||
if a_1:
|
||||
print("- (" + str(last_q) + ") + 2 * " + str(a_1) + " + " +\
|
||||
"- 2 * " + str(a_1^2) + "/" + str(last_q) + \
|
||||
" = " + str(tp[0]))
|
||||
else:
|
||||
print("0")
|
||||
print("\nsigma(T_{2, q_4}, chi_a_2) = ", end ="")
|
||||
if a_2:
|
||||
print("- (" + str(last_q) + ") + 2 * " + str(a_2) + " + " +\
|
||||
"- 2 * " + str(a_2^2) + "/" + str(last_q) + \
|
||||
" = " + str(tp[1]))
|
||||
else:
|
||||
print("0", end="")
|
||||
print("\nsigma(T_{2, q_4}, chi_a_3) = ", end="")
|
||||
if a_3:
|
||||
print("- (" + str(last_q) + ") + 2 * " + str(a_3) + " + " +\
|
||||
"- 2 * " + str(a_3^2) + "/" + str(last_q) + \
|
||||
" = " + str(tp[2]))
|
||||
else:
|
||||
print("0", end="")
|
||||
print("\nsigma(T_{2, q_4}, chi_a_4) = ", end="")
|
||||
if a_4:
|
||||
print("- (" + str(last_q) + ") + 2 * " + str(a_4) + " + " +\
|
||||
"- 2 * " + str(a_4^2) + "/" + str(last_q) + \
|
||||
" = " + str(tp[3]))
|
||||
else:
|
||||
print("0")
|
||||
|
||||
print("\n\nsigma(T_{2, q_4}, chi_a_1) " + \
|
||||
"- sigma(T_{2, q_4}, chi_a_2) " + \
|
||||
"+ sigma(T_{2, q_4}, chi_a_3) " + \
|
||||
"- sigma(T_{2, q_4}, chi_a_4) =\n" + \
|
||||
"sigma(T_{2, q_4}, " + str(a_1) + \
|
||||
") - sigma(T_{2, q_4}, " + str(a_2) + \
|
||||
") + sigma(T_{2, q_4}, " + str(a_3) + \
|
||||
") - sigma(T_{2, q_4}, " + str(a_4) + ") = " + \
|
||||
str(tp[0] - tp[1] + tp[2] - tp[3]))
|
||||
|
||||
def mod_one(n):
|
||||
return n - floor(n)
|
||||
|
||||
TorusCable.get_number_of_combinations_of_theta.__doc__ = \
|
||||
"""
|
||||
Arguments:
|
||||
arbitrary number of lists of numbers, each list encodes a single cable
|
||||
Return:
|
||||
number of possible theta values combinations that could be applied
|
||||
for a given cable sum,
|
||||
i.e. the product of q_j for j = {1,.. n},
|
||||
where n is a number of direct components in the cable sum,
|
||||
and q_j is the last q parameter for the component (a single cable)
|
||||
"""
|
||||
|
||||
TorusCable.get_knot_descrption.__doc__ = \
|
||||
"""
|
||||
@ -794,30 +636,6 @@ TorusCable.get_knot_descrption.__doc__ = \
|
||||
'T(2, 3; 2, 7) # T(2, 5) # -T(2, 3; 2, 5) # -T(2, 7)'
|
||||
"""
|
||||
|
||||
TorusCable.eval_cable_for_null_signature.__doc__ = \
|
||||
"""
|
||||
This function calculates all possible twisted signature functions for
|
||||
a knot that is given as an argument. The knot should be encoded as a list
|
||||
of its direct component. Each component schould be presented as a list
|
||||
of integers. This integers correspond to the k - values in each component/
|
||||
cable. If a component is a mirror image of a cable the minus sign should
|
||||
be written before each number for this component. For example:
|
||||
eval_cable_for_null_signature([[1, 8], [2], [-2, -8], [-2]])
|
||||
eval_cable_for_null_signature([[1, 2], [-1, -2]])
|
||||
|
||||
sage: eval_cable_for_null_signature([[1, 3], [2], [-1, -2], [-3]])
|
||||
|
||||
T(2, 3; 2, 7) # T(2, 5) # -T(2, 3; 2, 5) # -T(2, 7)
|
||||
Zero cases: 1
|
||||
All cases: 1225
|
||||
Zero theta combinations:
|
||||
(0, 0, 0, 0)
|
||||
|
||||
sage:
|
||||
The numbers given to the function eval_cable_for_null_signature
|
||||
are k-values for each component/cable in a direct sum.
|
||||
"""
|
||||
|
||||
TorusCable.get_signature_as_function_of_theta.__doc__ = \
|
||||
"""
|
||||
Function intended to construct signature function for a connected
|
||||
|
131
main.sage
131
main.sage
@ -1,11 +1,70 @@
|
||||
#!/usr/bin/python
|
||||
attach("cable_signature.sage")
|
||||
# attach("my_signature.sage")
|
||||
import os
|
||||
import sys
|
||||
|
||||
import itertools as it
|
||||
import re
|
||||
import numpy as np
|
||||
|
||||
|
||||
def main():
|
||||
attach("cable_signature.sage")
|
||||
attach("my_signature.sage")
|
||||
|
||||
|
||||
|
||||
# TBD: read about Factory Method, variable in docstring, sage documentation
|
||||
|
||||
|
||||
class Config(object):
|
||||
def __init__(self):
|
||||
self.f_results = os.path.join(os.getcwd(), "results.out")
|
||||
|
||||
# knot_formula is a schema for knots which signature function
|
||||
# will be calculated
|
||||
self.knot_formula = "[[k[0], k[1], k[3]], " + \
|
||||
"[-k[1], -k[3]], " + \
|
||||
"[k[2], k[3]], " + \
|
||||
"[-k[0], -k[2], -k[3]]]"
|
||||
|
||||
# self.knot_formula = "[[k[0], k[1], k[4]], [-k[1], -k[3]], \
|
||||
# [k[2], k[3]], [-k[0], -k[2], -k[4]]]"
|
||||
#
|
||||
#
|
||||
#
|
||||
# self.knot_formula = "[[k[3]], [-k[3]], \
|
||||
# [k[3]], [-k[3]] ]"
|
||||
#
|
||||
# self.knot_formula = "[[k[3], k[2], k[0]], [-k[2], -k[0]], \
|
||||
# [k[1], k[0]], [-k[3], -k[1], -k[0]]]"
|
||||
#
|
||||
# self.knot_formula = "[[k[0], k[1], k[2]], [k[3], k[4]], \
|
||||
# [-k[0], -k[3], -k[4]], [-k[1], -k[2]]]"
|
||||
# self.knot_formula = "[[k[0], k[1], k[2]], [k[3]],\
|
||||
# [-k[0], -k[1], -k[3]], [-k[2]]]"
|
||||
self.limit = 3
|
||||
|
||||
# in rch for large sigma, for 1. checked knot q_1 = 3 + start_shift
|
||||
self.start_shift = 0
|
||||
|
||||
self.verbose = True
|
||||
# self.verbose = False
|
||||
|
||||
self.print_results = True
|
||||
# self.print_results = False
|
||||
|
||||
# is the ratio restriction for values in q_vector taken into account
|
||||
self.only_slice_candidates = True
|
||||
self.only_slice_candidates = False
|
||||
|
||||
|
||||
|
||||
|
||||
def main(arg=None):
|
||||
try:
|
||||
limit = int(arg[1])
|
||||
except (IndexError, TypeError):
|
||||
limit = None
|
||||
|
||||
global cable, cab_2, cab_1, joined_formula
|
||||
# self.knot_formula = "[[k[0], k[1], k[3]], " + \
|
||||
# "[-k[1], -k[3]], " + \
|
||||
@ -34,58 +93,7 @@ def main():
|
||||
cab_2 = TorusCable(knot_formula=knot_formula, q_vector=q_vector)
|
||||
cable = cab_1 + cab_2
|
||||
joined_formula = cable.knot_formula
|
||||
|
||||
def is_big_in_ranges(cable, ranges_list):
|
||||
we_have_no_problem = True
|
||||
for theta in it.product(*ranges_list):
|
||||
if all(i == 0 for i in theta):
|
||||
continue
|
||||
we_have_a_problem = True
|
||||
if cable.is_metaboliser(theta):
|
||||
# print("\n" * 10)
|
||||
for shift in range(1, cable.q_order):
|
||||
shifted_theta = [(shift * th) % cable.last_q_list[i]
|
||||
for i, th in enumerate(theta)]
|
||||
shifted_theta = [min(th, cable.last_q_list[i] - th)
|
||||
for i, th in enumerate(shifted_theta)]
|
||||
sf = cable.signature_as_function_of_theta(*shifted_theta)
|
||||
extremum = abs(sf.extremum())
|
||||
if shift > 1:
|
||||
print(shifted_theta, end=" ")
|
||||
print(extremum)
|
||||
if extremum > 5 + np.count_nonzero(shifted_theta):
|
||||
# print("ok")
|
||||
we_have_a_problem = False
|
||||
break
|
||||
elif shift == 1:
|
||||
print("*" * 10)
|
||||
print(shifted_theta, end=" ")
|
||||
print(extremum)
|
||||
|
||||
if we_have_a_problem:
|
||||
we_have_a_big_problem = True
|
||||
break
|
||||
if not we_have_no_problem:
|
||||
print("we have a big problem")
|
||||
return we_have_no_problem
|
||||
|
||||
def check_all_thetas(cable):
|
||||
upper_bounds = cable.last_k_list[:3]
|
||||
ranges_list = [range(0, i + 1) for i in upper_bounds]
|
||||
ranges_list.append(range(0, 2))
|
||||
ranges_list += [range(0, 1) for _ in range(4)]
|
||||
if not is_big_in_ranges(cable, ranges_list):
|
||||
return False
|
||||
upper_bounds = cable.last_k_list[5:8]
|
||||
ranges_list = [range(0, 1) for _ in range(4)]
|
||||
ranges_list += [range(0, i + 1) for i in upper_bounds]
|
||||
ranges_list.append(range(0, 2))
|
||||
if not is_big_in_ranges(cable, ranges_list):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
||||
print(cable.is_signature_big_for_all_metabolizers())
|
||||
|
||||
|
||||
def get_q_vector(q_vector_size, lowest_number=1):
|
||||
@ -107,6 +115,17 @@ def get_q_vector(q_vector_size, lowest_number=1):
|
||||
q = [P.unrank(i) for i in c]
|
||||
ratio = q[3] > 4 * q[2] and q[2] > 4 * q[1] and q[1] > 4 * q[0]
|
||||
if not ratio:
|
||||
# print("Ratio-condition does not hold")
|
||||
# print("Ratio-condition does not hold")
|
||||
continue
|
||||
print("q = ", q)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
global config
|
||||
config = Config()
|
||||
if '__file__' in globals():
|
||||
# skiped in interactive mode as __file__ is not defined
|
||||
main(sys.argv)
|
||||
else:
|
||||
pass
|
||||
# main()
|
||||
|
@ -1,12 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# TBD: read about Factory Method, variable in docstring, sage documentation
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import itertools as it
|
||||
import re
|
||||
|
||||
# if not os.path.isfile('cable_signature.py'):
|
||||
# os.system('sage --preparse cable_signature.sage')
|
||||
@ -14,97 +8,11 @@ import re
|
||||
# from cable_signature import SignatureFunction, TorusCable, SIGNATURE, SIGMA
|
||||
|
||||
|
||||
class Config(object):
|
||||
def __init__(self):
|
||||
self.f_results = os.path.join(os.getcwd(), "results.out")
|
||||
|
||||
# knot_formula is a schema for knots which signature function
|
||||
# will be calculated
|
||||
self.knot_formula = "[[k[0], k[1], k[3]], " + \
|
||||
"[-k[1], -k[3]], " + \
|
||||
"[k[2], k[3]], " + \
|
||||
"[-k[0], -k[2], -k[3]]]"
|
||||
# searching for signature > 5 + #(v_i != 0) over given knot schema
|
||||
def search_for_large_signature_value(knot_formula=None, limit=None,
|
||||
verbose=None, print_results=None):
|
||||
|
||||
|
||||
# self.knot_formula = "[[k[0], k[1], k[4]], [-k[1], -k[3]], \
|
||||
# [k[2], k[3]], [-k[0], -k[2], -k[4]]]"
|
||||
#
|
||||
#
|
||||
|
||||
# self.knot_formula = "[[k[3]], [-k[3]], \
|
||||
# [k[3]], [-k[3]] ]"
|
||||
|
||||
|
||||
# self.knot_formula = "[[k[3], k[2], k[0]], [-k[2], -k[0]], \
|
||||
# [k[1], k[0]], [-k[3], -k[1], -k[0]]]"
|
||||
|
||||
|
||||
|
||||
# self.knot_formula = "[[k[0], k[1], k[2]], [k[3], k[4]], \
|
||||
# [-k[0], -k[3], -k[4]], [-k[1], -k[2]]]"
|
||||
# self.knot_formula = "[[k[0], k[1], k[2]], [k[3]],\
|
||||
# [-k[0], -k[1], -k[3]], [-k[2]]]"
|
||||
self.limit = 3
|
||||
|
||||
# in rch for large sigma, for 1. checked knot q_1 = 3 + start_shift
|
||||
self.start_shift = 0
|
||||
|
||||
self.verbose = True
|
||||
# self.verbose = False
|
||||
|
||||
self.print_results = True
|
||||
# self.print_results = False
|
||||
|
||||
self.print_calculations_for_large_sigma = True
|
||||
self.print_calculations_for_large_sigma = False
|
||||
|
||||
# is the ratio restriction for values in q_vector taken into account
|
||||
self.only_slice_candidates = True
|
||||
self.only_slice_candidates = False
|
||||
|
||||
|
||||
# range for a_i, v = [a_1, a_2, a_3, a_4], for sigma calculations
|
||||
# upper bound supposed to be ub = k + 1
|
||||
def get_list_of_ranges(self, ub):
|
||||
list_of_ranges = [
|
||||
# all characters a_1, a_2, a_3, a_4 != 0
|
||||
it.product(range(1, ub), range(1, ub), range(1, ub), range(1, 2)),
|
||||
|
||||
# a_1 == 0, a_2, a_3, a_4 != 0
|
||||
it.product(range(1), range(1, ub), range(1, ub), range(1, 2)),
|
||||
# a_2 == 0, a_1, a_3, a_4 != 0
|
||||
it.product(range(1, ub), range(1), range(1, ub), range(1, 2)),
|
||||
# a_3 == 0, a_1, a_2, a_4 != 0
|
||||
it.product(range(1, ub), range(1, ub), range(1), range(1, 2)),
|
||||
# a_4 == 0, a_1, a_2, a_3 != 0
|
||||
it.product(range(1, ub), range(1, ub), range(1, 2), range(1)),
|
||||
|
||||
# a_1 == 0, a_2 == 0, a_3, a_4 != 0
|
||||
it.product(range(1), range(1), range(1, ub), range(1, 2)),
|
||||
# a_1 == 0, a_3 == 0, a_2, a_4 != 0
|
||||
it.product(range(1), range(1, ub), range(1), range(1, 2)),
|
||||
# a_1 == 0, a_4 == 0, a_3, a_2 != 0
|
||||
it.product(range(1), range(1, ub), range(1, 2), range(1)),
|
||||
# a_2 == 0, a_3 == 0, a_1, a_4 != 0
|
||||
it.product(range(1, ub), range(1), range(1), range(1, 2)),
|
||||
# a_2 == 0, a_4 == 0, a_1, a_3 != 0
|
||||
it.product(range(1, ub), range(1), range(1, 2), range(1)),
|
||||
# a_3 == 0, a_4 == 0, a_1, a_2 != 0
|
||||
it.product(range(1, ub), range(1, 2), range(1), range(1)),
|
||||
]
|
||||
return list_of_ranges
|
||||
|
||||
|
||||
def main(arg):
|
||||
try:
|
||||
limit = int(arg[1])
|
||||
except IndexError:
|
||||
limit = None
|
||||
search_for_large_signature_value(limit=limit)
|
||||
knots_with_large_sigma = search_for_large_sigma_value(limit=limit)
|
||||
# search_for_null_signature_value(limit=limit)
|
||||
|
||||
def set_parameters(knot_formula, limit, verbose, print_results):
|
||||
if limit is None:
|
||||
limit = config.limit
|
||||
if knot_formula is None:
|
||||
@ -113,92 +21,6 @@ def set_parameters(knot_formula, limit, verbose, print_results):
|
||||
verbose = config.verbose
|
||||
if print_results is None:
|
||||
print_results = config.print_results
|
||||
return knot_formula, limit, verbose, print_results
|
||||
|
||||
|
||||
# searching for sigma > 5 + #(v_i != 0) over given knot schema
|
||||
def search_for_large_sigma_value(knot_formula=None, limit=None,
|
||||
verbose=None, print_results=None):
|
||||
|
||||
knot_formula, limit, verbose, print_results = \
|
||||
set_parameters(knot_formula, limit, verbose, print_results)
|
||||
|
||||
k_vector_size = extract_max(knot_formula) + 1
|
||||
limit = max(limit, k_vector_size)
|
||||
|
||||
# number of k_i (q_i) variables to substitute
|
||||
combinations = it.combinations(range(1, limit + 1), k_vector_size)
|
||||
P = Primes()
|
||||
good_knots = []
|
||||
|
||||
# iterate over q-vector
|
||||
for c in combinations:
|
||||
q = [P.unrank(i + config.start_shift) for i in c]
|
||||
if config.only_slice_candidates:
|
||||
ratio = q[3] > 4 * q[2] and q[2] > 4 * q[1] and q[1] > 4 * q[0]
|
||||
if not ratio:
|
||||
if verbose:
|
||||
print("Ratio-condition does not hold")
|
||||
continue
|
||||
cable = TorusCable(knot_formula=knot_formula, q_vector=q)
|
||||
list_of_ranges = config.get_list_of_ranges(cable.q_order)
|
||||
if cable.eval_cable_for_large_values(list_of_ranges, SIGMA,
|
||||
verbose=verbose,
|
||||
print_results=print_results):
|
||||
good_knots.append(cable.knot_description)
|
||||
return good_knots
|
||||
|
||||
|
||||
|
||||
# searching for signature == 0
|
||||
def search_for_null_signature_value(knot_formula=None, limit=None,
|
||||
verbose=None, print_results=None):
|
||||
|
||||
knot_formula, limit, verbose, print_results = \
|
||||
set_parameters(knot_formula, limit, verbose, print_results)
|
||||
|
||||
k_vector_size = extract_max(knot_formula) + 1
|
||||
limit = max(limit, k_vector_size)
|
||||
|
||||
combinations = it.combinations_with_replacement(range(1, limit + 1),
|
||||
k_vector_size)
|
||||
with open(config.f_results, 'w') as f_results:
|
||||
for k in combinations:
|
||||
if config.only_slice_candidates and k_vector_size == 5:
|
||||
k = get_shifted_combination(k)
|
||||
cable = TorusCable(knot_formula, k_vector=k)
|
||||
if is_trivial_combination(cable.knot_sum):
|
||||
print(cable.knot_sum)
|
||||
continue
|
||||
|
||||
result = cable.eval_cable_for_null_signature(verbose=verbose,
|
||||
print_results=print_results)
|
||||
|
||||
if result is not None:
|
||||
null_comb, all_comb = result
|
||||
line = (str(k) + ", " + str(null_comb) + ", " +
|
||||
str(all_comb) + "\n")
|
||||
f_results.write(line)
|
||||
|
||||
def check_one_cable(cable, sigma_or_sign=None,
|
||||
verbose=None, print_results=None):
|
||||
if sigma_or_sign is None:
|
||||
sigma_or_sign = SIGNATURE
|
||||
if verbose is None:
|
||||
verbos = config.verbose
|
||||
if print_results is None:
|
||||
print_results = config.print_results
|
||||
list_of_ranges = config.get_list_of_ranges(cable.q_vector[-1])
|
||||
return cable.eval_cable_for_large_values(list_of_ranges, sigma_or_sign,
|
||||
verbose=verbose,
|
||||
print_results=print_results)
|
||||
|
||||
# searching for signature > 5 + #(v_i != 0) over given knot schema
|
||||
def search_for_large_signature_value(knot_formula=None, limit=None,
|
||||
verbose=None, print_results=None):
|
||||
|
||||
knot_formula, limit, verbose, print_results = \
|
||||
set_parameters(knot_formula, limit, verbose, print_results)
|
||||
|
||||
k_vector_size = extract_max(knot_formula) + 1
|
||||
combinations = it.combinations(range(1, limit + 1), k_vector_size)
|
||||
@ -215,74 +37,20 @@ def search_for_large_signature_value(knot_formula=None, limit=None,
|
||||
print("Ratio-condition does not hold")
|
||||
continue
|
||||
cable = TorusCable(knot_formula=knot_formula, q_vector=q)
|
||||
list_of_ranges = config.get_list_of_ranges(cable.q_vector[-1])
|
||||
if cable.eval_cable_for_large_values(list_of_ranges, SIGNATURE,
|
||||
verbose=verbose,
|
||||
print_results=print_results):
|
||||
is_big = cable.is_signature_big_for_all_metabolizers()
|
||||
print(is_big)
|
||||
if is_big:
|
||||
good_knots.append(cable.knot_description)
|
||||
|
||||
return good_knots
|
||||
|
||||
|
||||
|
||||
|
||||
def get_shifted_combination(combination):
|
||||
# for now applicable only for schama
|
||||
# "[[k[0], k[1], k[2]], [k[3], k[4]],
|
||||
# [-k[0], -k[3], -k[4]], [-k[1], -k[2]]]"
|
||||
# shift the combination so that the knot can be a candidate for slice
|
||||
combination = [combination[0], 4 * combination[0] + combination[1],
|
||||
4 * (4 * combination[0] + combination[1]) + combination[2],
|
||||
4 * combination[0] + combination[3],
|
||||
4 * (4 * combination[0] + combination[3]) + combination[4]]
|
||||
return combination
|
||||
|
||||
|
||||
def extract_max(string):
|
||||
numbers = re.findall(r'\d+', string)
|
||||
numbers = map(int, numbers)
|
||||
return max(numbers)
|
||||
|
||||
|
||||
def is_trivial_combination(knot_sum):
|
||||
# for now is applicable only for schema that are sums of 4 cables
|
||||
if len(knot_sum) == 4:
|
||||
oposit_to_first = [-k for k in knot_sum[0]]
|
||||
if oposit_to_first in knot_sum:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
search_for_null_signature_value.__doc__ = \
|
||||
"""
|
||||
This function calculates signature functions for knots constracted
|
||||
accordinga a schema for a cable sum. The schema is given as an argument
|
||||
or defined in the class Config.
|
||||
Results of calculations will be writen to a file and the stdout.
|
||||
limit is the upper bound for the first value in k_vector,
|
||||
i.e k[0] value in a cable sum, where q_0 = 2 * k[0] + 1.
|
||||
|
||||
(the number of knots that will be constracted depends on limit value).
|
||||
For each knot/cable sum the function eval_cable_for_null_signature
|
||||
is called.
|
||||
eval_cable_for_null_signature calculetes the number of all possible thetas
|
||||
(characters) and the number of combinations for which signature function
|
||||
equeles zero. In case the first number is larger than squere of the second,
|
||||
eval_cable_for_null_signature returns None (i.e. the knot can not be slice).
|
||||
Data for knots that are candidates for slice knots are saved to a file.
|
||||
"""
|
||||
|
||||
main.__doc__ = \
|
||||
"""
|
||||
This function is run if the script was called from the terminal.
|
||||
It calls another function, search_for_null_signature_value,
|
||||
to calculate signature functions for a schema
|
||||
of a cable sum defined in the class Config.
|
||||
Optionaly a parameter (a limit for k_0 value) can be given.
|
||||
Thought to be run for time consuming calculations.
|
||||
"""
|
||||
|
||||
|
||||
extract_max.__doc__ = \
|
||||
"""
|
||||
Return:
|
||||
@ -294,14 +62,6 @@ extract_max.__doc__ = \
|
||||
3300
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
global config
|
||||
config = Config()
|
||||
if '__file__' in globals():
|
||||
# skiped in interactive mode as __file__ is not defined
|
||||
main(sys.argv)
|
||||
|
||||
"""
|
||||
This script calculates signature functions for knots (cable sums).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user