is_function_big_for_all_metabolizers method

This commit is contained in:
Maria Marchwicka 2020-11-18 20:05:10 +01:00
parent 683e58aa1a
commit 491ecc2b9c

View File

@ -9,6 +9,10 @@ from collections import Counter
from sage.arith.functions import LCM_list from sage.arith.functions import LCM_list
import importlib import importlib
SIGMA = 0
SIGNATURE = 1
def import_sage(module_name): def import_sage(module_name):
importlib.invalidate_caches() importlib.invalidate_caches()
@ -40,7 +44,7 @@ class CableSummand():
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.sigma_as_function_of_theta = \
self.get_sigma_function() self.get_sigma_as_function_of_theta()
@staticmethod @staticmethod
def get_summand_descrption(knot_as_k_values): def get_summand_descrption(knot_as_k_values):
@ -194,33 +198,29 @@ 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): def get_sigma_as_function_of_theta(self):
last_k = self.knot_as_k_values[-1] last_k = self.knot_as_k_values[-1]
last_q = 2 * abs(last_k) + 1 last_q = 2 * abs(last_k) + 1
ksi = 1/last_q ksi = 1/last_q
def sigma_function(theta, print_results=False): def sigma_as_function_of_theta(theta, print_results=False):
# satellite part (Levine-Tristram signatures) # satellite part (Levine-Tristram signatures)
sp = 0 satellite_part = 0
for i, k in enumerate(self.knot_as_k_values[:-1][::-1]): for i, k in enumerate(self.knot_as_k_values[:-1][::-1]):
# print("layer") # print("layer")
layer_num = i + 1 layer_num = i + 1
sigma_q = self.get_untwisted_signature_function(k) sigma_q = self.get_untwisted_signature_function(k)
# print(sigma_q(ksi * theta * layer_num)) # print(sigma_q(ksi * theta * layer_num))
# print(sigma_q) # print(sigma_q)
satelit_part = 2 * sigma_q(ksi * theta * layer_num) * sign(k) sp = 2 * sigma_q(ksi * theta * layer_num) * sign(k)
sp += satelit_part satellite_part += sp
if theta: if theta:
pp = (-last_q + 2 * theta - 2 * (theta^2/last_q)) * sign(last_k) pp = (-last_q + 2 * theta - 2 * (theta^2/last_q)) * sign(last_k)
else: else:
pp = 0 pp = 0
result = pp + sp return pp + satellite_part
# print("pp = ", pp ) return sigma_as_function_of_theta
# print("sp = ", sp)
# print(result)
return result
return sigma_function
@ -250,7 +250,6 @@ class CableSum():
self.get_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)
@ -333,7 +332,6 @@ class CableSum():
raise TypeError(msg) raise TypeError(msg)
return tuple(thetas) return tuple(thetas)
@staticmethod @staticmethod
def get_knot_descrption(knot_sum): def get_knot_descrption(knot_sum):
description = "" description = ""
@ -346,7 +344,15 @@ class CableSum():
description = description[:-2] + ") # " description = description[:-2] + ") # "
return description[:-3] return description[:-3]
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 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:
@ -425,7 +431,7 @@ class CableSum():
return False return False
return True return True
def is_signature_big_for_all_metabolizers(self): def is_function_big_for_all_metabolizers(self, function_type=SIGMA):
num_of_summands = len(self.knot_sum_as_k_valus) num_of_summands = len(self.knot_sum_as_k_valus)
if num_of_summands % 4: if num_of_summands % 4:
f_name = self.is_signature_big_for_all_metabolizers.__name__ f_name = self.is_signature_big_for_all_metabolizers.__name__
@ -438,25 +444,17 @@ class CableSum():
ranges_list[shift : shift + 3] = \ ranges_list[shift : shift + 3] = \
[range(0, i + 1) for i in self.patt_k_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) ranges_list[shift + 3] = range(0, 2)
if not self.is_signature_big_in_ranges(ranges_list): if function_type == SIGNATURE:
return False if not self.is_signature_big_in_ranges(ranges_list):
return False
else: else:
print("\nOK") if not self.is_sigma_big_in_ranges(ranges_list):
return False
print("\nOK")
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): def is_sigma_big_in_ranges(self, ranges_list):
for thetas in it.product(*ranges_list): for thetas in it.product(*ranges_list):
@ -473,7 +471,7 @@ class CableSum():
# pp, sp, sf= self.signature_as_function_of_theta(*shifted_thetas) # pp, sp, sf= self.signature_as_function_of_theta(*shifted_thetas)
limit = 5 + np.count_nonzero(shifted_thetas) limit = 5 + np.count_nonzero(shifted_thetas)
ext = self.sigma_as_function_of_theta(shifted_thetas) ext = self.sigma_as_function_of_theta(shifted_thetas)
print(ext) # print(ext)
extremum = abs(ext) extremum = abs(ext)
if shift > 1: if shift > 1:
print(shifted_thetas, end=" ") print(shifted_thetas, end=" ")
@ -490,24 +488,6 @@ class CableSum():
return False return False
return True 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