sigma calc

This commit is contained in:
Maria Marchwicka 2020-11-10 18:56:58 +01:00
parent 1d4d294458
commit 683e58aa1a

View File

@ -32,12 +32,15 @@ PLOTS_DIR = "plots"
class CableSummand(): class CableSummand():
def __init__(self, knot_as_k_values): def __init__(self, knot_as_k_values):
self.knot_as_k_values = knot_as_k_values self.knot_as_k_values = knot_as_k_values
self.knot_description = self.get_summand_descrption(knot_as_k_values) self.knot_description = self.get_summand_descrption(knot_as_k_values)
self.signature_as_function_of_theta = \ self.signature_as_function_of_theta = \
self.get_summand_signature_as_theta_function() self.get_summand_signature_as_theta_function()
self.sigma_as_function_of_theta = \
self.get_sigma_function()
@staticmethod @staticmethod
def get_summand_descrption(knot_as_k_values): def get_summand_descrption(knot_as_k_values):
@ -191,6 +194,39 @@ class CableSummand():
for theta in range(range_limit): for theta in range(range_limit):
self.plot_summand_for_theta(theta) self.plot_summand_for_theta(theta)
def get_sigma_function(self):
last_k = self.knot_as_k_values[-1]
last_q = 2 * abs(last_k) + 1
ksi = 1/last_q
def sigma_function(theta, print_results=False):
# satellite part (Levine-Tristram signatures)
sp = 0
for i, k in enumerate(self.knot_as_k_values[:-1][::-1]):
# print("layer")
layer_num = i + 1
sigma_q = self.get_untwisted_signature_function(k)
# print(sigma_q(ksi * theta * layer_num))
# print(sigma_q)
satelit_part = 2 * sigma_q(ksi * theta * layer_num) * sign(k)
sp += satelit_part
if theta:
pp = (-last_q + 2 * theta - 2 * (theta^2/last_q)) * sign(last_k)
else:
pp = 0
result = pp + sp
# print("pp = ", pp )
# print("sp = ", sp)
# print(result)
return result
return sigma_function
class CableSum(): class CableSum():
def __init__(self, knot_sum): def __init__(self, knot_sum):
@ -210,6 +246,10 @@ class CableSum():
self.knot_summands = [CableSummand(k) for k in knot_sum] self.knot_summands = [CableSummand(k) for k in knot_sum]
self.signature_as_function_of_theta = \ self.signature_as_function_of_theta = \
self.get_signature_as_function_of_theta() self.get_signature_as_function_of_theta()
self.sigma_as_function_of_theta = \
self.get_sigma_as_function_of_theta()
def __call__(self, *thetas): def __call__(self, *thetas):
return self.signature_as_function_of_theta(*thetas) return self.signature_as_function_of_theta(*thetas)
@ -306,6 +346,8 @@ class CableSum():
description = description[:-2] + ") # " description = description[:-2] + ") # "
return description[:-3] return description[:-3]
def get_signature_as_function_of_theta(self, **key_args): def get_signature_as_function_of_theta(self, **key_args):
if 'verbose' in key_args: if 'verbose' in key_args:
verbose_default = key_args['verbose'] verbose_default = key_args['verbose']
@ -403,6 +445,76 @@ class CableSum():
return True return True
def get_sigma_as_function_of_theta(self):
def sigma_as_function_of_theta(*thetas, **kwargs):
thetas = self.parse_thetas(*thetas)
result = 0
for i, knot in enumerate(self.knot_summands):
sigma_of_th = knot.sigma_as_function_of_theta
result += sigma_of_th(thetas[i])
return result
return sigma_as_function_of_theta
def is_sigma_big_in_ranges(self, ranges_list):
for thetas in it.product(*ranges_list):
# Check only non-zero metabolizers.
if not self.is_metabolizer(thetas) or not any(thetas):
continue
signature_is_small = True
# Check if any element generated by thetas vector
# has a large signature.
for shift in range(1, self.q_order):
shifted_thetas = [shift * th for th in thetas]
# pp, sp, sf= self.signature_as_function_of_theta(*shifted_thetas)
limit = 5 + np.count_nonzero(shifted_thetas)
ext = self.sigma_as_function_of_theta(shifted_thetas)
print(ext)
extremum = abs(ext)
if shift > 1:
print(shifted_thetas, end=" ")
print(extremum)
if extremum > limit:
signature_is_small = False
break
elif shift == 1:
print("*" * 10)
print(shifted_thetas, end=" ")
print(ext)
if signature_is_small:
print("\n" * 10 + "!" * 1000)
return False
return True
def is_sigma_big_for_all_metabolizers(self):
num_of_summands = len(self.knot_sum_as_k_valus)
if num_of_summands % 4:
f_name = self.is_sima_big_for_all_metabolizers.__name__
msg = "Function {}".format(f_name) + " is implemented only for " +\
"knots that are direct sums of 4n direct summands."
raise ValueError(msg)
for shift in range(0, num_of_summands, 4):
ranges_list = num_of_summands * [range(0, 1)]
ranges_list[shift : shift + 3] = \
[range(0, i + 1) for i in self.patt_k_list[shift: shift + 3]]
ranges_list[shift + 3] = range(0, 2)
if not self.is_sigma_big_in_ranges(ranges_list):
return False
else:
print("\nOK")
return True
class CableTemplate(): class CableTemplate():
def __init__(self, knot_formula, q_vector=None, k_vector=None, def __init__(self, knot_formula, q_vector=None, k_vector=None,