This commit is contained in:
Maria Marchwicka 2020-11-19 10:32:15 +01:00
parent 8d432c8129
commit 68cf72305e
2 changed files with 2392 additions and 46572 deletions

View File

@ -44,8 +44,11 @@ class CableSummand():
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 = \ if verbose:
self.get_sigma_as_function_of_theta() s = self.get_verbose_sigma_as_function_of_theta(verbose=True)
else:
s = self.get_sigma_as_function_of_theta()
self.sigma_as_function_of_theta = s
@staticmethod @staticmethod
def get_summand_descrption(knot_as_k_values): def get_summand_descrption(knot_as_k_values):
@ -192,14 +195,14 @@ class CableSummand():
file_name = self.get_file_name_for_summand_plot(theta) file_name = self.get_file_name_for_summand_plot(theta)
save_path = os.path.join(save_path, file_name) save_path = os.path.join(save_path, file_name)
sig.SignaturePloter.plot_sum_of_two(pp, sp, title=title, sig.SignaturePloter.plot_sum_of_two(pp, sp, title=title,
save_path=save_path) save_path=save_path)
def plot_summand(self): def plot_summand(self):
range_limit = min(self.knot_as_k_values[-1] + 1, 3) range_limit = min(self.knot_as_k_values[-1] + 1, 3)
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_as_function_of_theta(self, verbose=None): def get_verbose_sigma_as_function_of_theta(self, verbose=None):
default_verbose = verbose or self.verbose default_verbose = verbose or self.verbose
last_k = self.knot_as_k_values[-1] last_k = self.knot_as_k_values[-1]
@ -211,28 +214,63 @@ class CableSummand():
details = details or verbose details = details or verbose
# satellite part (Levine-Tristram signatures) # satellite part (Levine-Tristram signatures)
satellite_part = 0 satellite_part = 0
if verbose:
print(3 * "\n" + 10 * "#" + " " + self.knot_description +
" " + 10 * "#" + "\n")
for layer_num, k in enumerate(self.knot_as_k_values[::-1]):
sigma_q = self.get_untwisted_signature_function(k)
arg = ksi * theta * layer_num
sp = sigma_q(arg)
satellite_part += 2 * sp
if details and arg:
label = "ksi * theta * layer_num = " + str(arg)
title = self.knot_description + ", layer " + str(layer_num)
title += ", theta = " + str(theta)
sigma_q.plot(special_point=(mod_one(arg), sp),
special_label=label,
title=title,)
if theta:
pp = (-last_q + 2 * theta - 2 * (theta^2/last_q)) * sign(last_k)
else:
pp = 0
sigma = pp + satellite_part
if verbose and theta:
print(self.knot_description + ", theta = " + str(theta))
print("pp = " + str(pp), end=', ')
print("satellite_part = " + str(satellite_part) + "\n")
if verbose:
print("sigma({}) = {}".format(self.knot_description,
pp + satellite_part))
return pp, satellite_part, sigma
return sigma_as_function_of_theta
def get_sigma_as_function_of_theta(self):
last_k = self.knot_as_k_values[-1]
last_q = 2 * abs(last_k) + 1
ksi = 1/last_q
def sigma_as_function_of_theta(theta):
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")
layer_num = i + 1 layer_num = i + 1
sigma_q = self.get_untwisted_signature_function(k) sigma_q = self.get_untwisted_signature_function(k)
if details: sp = 2 * sigma_q(ksi * theta * layer_num)
pass
# print(sigma_q(ksi * theta * layer_num))
# print(sigma_q)
sp = 2 * sigma_q(ksi * theta * layer_num) * sign(k)
satellite_part += sp 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
if verbose: return pp, satellite_part, pp + satellite_part
print(self.knot_description + ", theta = " + str(theta))
print("pp = " + str(pp), end=', ')
print("satellite_part = " + str(satellite_part))
return pp + satellite_part
return sigma_as_function_of_theta return sigma_as_function_of_theta
@ -297,8 +335,8 @@ class CableSum():
else: else:
save_path = None save_path = None
for i, knot in enumerate(self.knot_summands): for theta, knot in zip(thetas, self.knot_summands):
knot.plot_summand_for_theta(thetas[i], save_path=save_path) knot.plot_summand_for_theta(thetas, save_path=save_path)
# pp, sp, sf = self.signature_as_function_of_theta(*thetas) # pp, sp, sf = self.signature_as_function_of_theta(*thetas)
# title = self.knot_description + ", thetas = " + str(thetas) # title = self.knot_description + ", thetas = " + str(thetas)
@ -358,14 +396,36 @@ class CableSum():
description = description[:-2] + ") # " description = description[:-2] + ") # "
return description[:-3] return description[:-3]
def get_sigma_as_function_of_theta(self): def get_sigma_as_function_of_theta(self, verbose=None):
def sigma_as_function_of_theta(*thetas, **kwargs): default_verbose = verbose or self.verbose
def sigma_as_function_of_theta(*thetas, verbose=None, **kwargs):
verbose = verbose or default_verbose
thetas = self.parse_thetas(*thetas) thetas = self.parse_thetas(*thetas)
result = 0 sigma_list = []
for i, knot in enumerate(self.knot_summands):
sigma_of_th = knot.sigma_as_function_of_theta for theta, knot in zip(thetas, self.knot_summands):
result += sigma_of_th(thetas[i]) if theta:
return result sigma_of_th = knot.sigma_as_function_of_theta
sigma_list.append(sigma_of_th(theta))
else:
sigma_list.append((0,0,0))
if verbose:
print(100 * "*")
print("Calculation summary for a cable sum:\n" +
self.knot_description)
for i, knot in enumerate(self.knot_summands):
if thetas[i]:
print("{}. {}".format(i, knot.knot_description))
print("Pattern part = {}".format(sigma_list[i][0]))
# print("Pattern part = -{}".format(knot_sum.))
print("Satellite part = {}".format(sigma_list[i][1]))
print("Sigma = {}\n".format(sigma_list[i][2]))
return sum(r[2] for r in sigma_list)
return sigma_as_function_of_theta 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):
@ -386,11 +446,17 @@ class CableSum():
pattern_part = sig.SignatureFunction() pattern_part = sig.SignatureFunction()
# for each cable knot (summand) in cable sum apply theta # for each cable knot (summand) in cable sum apply theta
for i, knot in enumerate(self.knot_summands): # for i, knot in enumerate(self.knot_summands):
sfth = knot.signature_as_function_of_theta # sfth = knot.signature_as_function_of_theta
pp, sp, _ = sfth(thetas[i]) # pp, sp, _ = sfth(thetas[i])
# pattern_part += pp
# satellite_part += sp
for theta, knot in zip(thetas, self.knot_summands):
pp, sp, _ = knot.signature_as_function_of_theta(theta)
pattern_part += pp pattern_part += pp
satellite_part += sp satellite_part += sp
sf = pattern_part + satellite_part sf = pattern_part + satellite_part
if verbose: if verbose:

48840
main.ipynb

File diff suppressed because one or more lines are too long