2020-11-06 04:01:54 +01:00
|
|
|
#!/usr/bin/env sage -python
|
2020-10-22 13:33:18 +02:00
|
|
|
|
|
|
|
# TBD: read about Factory Method, variable in docstring, sage documentation,
|
|
|
|
# print calc. to output file
|
|
|
|
# decide about printing option
|
2021-01-11 07:34:03 +01:00
|
|
|
# make __main__?
|
2020-10-22 13:33:18 +02:00
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
import os
|
|
|
|
import sys
|
2020-10-14 17:21:17 +02:00
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
import itertools as it
|
|
|
|
import re
|
2020-10-14 17:21:17 +02:00
|
|
|
import numpy as np
|
2021-01-11 07:34:03 +01:00
|
|
|
import importlib
|
|
|
|
from .utility import import_sage
|
2021-01-13 21:21:05 +01:00
|
|
|
from . import signature as sig
|
|
|
|
from . import cable_signature as cs
|
2020-10-14 17:21:17 +02:00
|
|
|
|
2021-01-11 07:34:03 +01:00
|
|
|
package = __name__.split('.')[0]
|
|
|
|
path = os.path.dirname(__file__)
|
2020-11-02 09:32:39 +01:00
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
|
2021-01-11 07:34:03 +01:00
|
|
|
class Config:
|
2020-10-15 07:16:42 +02:00
|
|
|
def __init__(self):
|
2020-11-06 04:01:54 +01:00
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
self.f_results = os.path.join(os.getcwd(), "results.out")
|
|
|
|
|
2021-01-11 07:34:03 +01:00
|
|
|
self.short_3_layers_a = "[[ k[5], k[3]], " + \
|
|
|
|
"[ -k[1], -k[3]], " + \
|
|
|
|
"[ k[3]], " + \
|
|
|
|
"[ -k[4], -k[6], -k[3]]]"
|
|
|
|
|
|
|
|
self.short_3_layers_b = "[[k[4], k[1], k[7]], " + \
|
|
|
|
"[ -k[7]], " + \
|
|
|
|
"[k[6], k[7]], " + \
|
|
|
|
"[-k[5], -k[7]]]"
|
|
|
|
self.schema_short1 = "[ [k[5], k[3]], " + \
|
|
|
|
"[ -k[1], -k[3]], " + \
|
|
|
|
"[ k[3]], " + \
|
|
|
|
"[ -k[6], -k[3]]]"
|
|
|
|
|
|
|
|
self.schema_short2 = "[[ k[1], k[7]], " + \
|
|
|
|
"[ -k[7]], " + \
|
|
|
|
"[ k[6], k[7]], " + \
|
|
|
|
"[ -k[5], -k[7]]]"
|
|
|
|
|
|
|
|
self.schema_short = "[[ k[5], k[3]], " + \
|
|
|
|
"[ -k[1], -k[3]], " + \
|
|
|
|
"[ k[3]], " + \
|
|
|
|
"[ -k[6], -k[3]], " + \
|
|
|
|
"[ k[1], k[7]], " + \
|
|
|
|
"[ -k[7]], " + \
|
|
|
|
"[ k[6], k[7]], " + \
|
|
|
|
"[ -k[5], -k[7]]]"
|
|
|
|
|
|
|
|
|
|
|
|
self.two_summands_schema = "[\
|
|
|
|
[k[0], k[1], k[4]], [-k[1], -k[3]],\
|
|
|
|
[k[2], k[3]], [-k[0], -k[2], -k[4]]\
|
|
|
|
]"
|
|
|
|
knot_formula = "[[k[0], k[1], k[2]], [k[3], k[4]],\
|
|
|
|
[-k[0], -k[3], -k[4]], [-k[1], -k[2]]]"
|
|
|
|
|
|
|
|
knot_formula = "[[k[0], k[1], k[2]], [k[3]],\
|
|
|
|
[-k[0], -k[1], -k[3]], [-k[2]]]"
|
2020-11-06 04:01:54 +01:00
|
|
|
|
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
|
2021-01-11 07:34:03 +01:00
|
|
|
self.two_small_summands_schema = "[[k[3]], [-k[3]],\
|
|
|
|
[k[3]], [-k[3]] ]"
|
|
|
|
|
|
|
|
self.four_summands_schema = "[[k[3], k[2], k[0]],\
|
|
|
|
[-k[2], -k[0]],\
|
|
|
|
[k[1], k[0]],\
|
|
|
|
[-k[3], -k[1], -k[0]]]"
|
|
|
|
|
|
|
|
self.four_summands_schema = "[[k[0], k[1], k[3]]," + \
|
|
|
|
" [-k[1], -k[3]]," + \
|
|
|
|
" [k[2], k[3]]," + \
|
|
|
|
" [-k[0], -k[2], -k[3]]]"
|
|
|
|
|
|
|
|
formula_1 = "[[k[0], k[5], k[3]], " + \
|
|
|
|
"[-k[1], -k[3]], " + \
|
|
|
|
"[k[2], k[3]], " + \
|
|
|
|
"[-k[0], -k[2], -k[3]]]"
|
|
|
|
formula_2 = "[[k[4], k[1], k[7]], " + \
|
|
|
|
"[-k[5], -k[7]], " + \
|
|
|
|
"[k[6], k[7]], " + \
|
|
|
|
"[-k[4], -k[6], -k[7]]]"
|
|
|
|
|
|
|
|
formula_1 = "[[k[0], k[5], k[3]], " + \
|
|
|
|
"[-k[5], -k[3]], " + \
|
|
|
|
"[k[2], k[3]], " + \
|
|
|
|
"[-k[4], -k[2], -k[3]]]"
|
|
|
|
formula_2 = "[[k[4], k[1], k[7]], " + \
|
|
|
|
"[-k[1], -k[7]], " + \
|
|
|
|
"[k[6], k[7]], " + \
|
|
|
|
"[-k[0], -k[6], -k[7]]]"
|
|
|
|
|
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
|
|
|
|
|
2020-11-02 09:32:39 +01:00
|
|
|
|
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
def main(arg=None):
|
|
|
|
try:
|
|
|
|
limit = int(arg[1])
|
|
|
|
except (IndexError, TypeError):
|
|
|
|
limit = None
|
2021-01-11 07:34:03 +01:00
|
|
|
conf = Config()
|
|
|
|
cable_loop_with_details(conf)
|
|
|
|
|
|
|
|
def print_sigma_for_cable(verbose=True, conf=None):
|
|
|
|
|
|
|
|
conf = conf or Config()
|
|
|
|
schema_short1 = conf.schema_short1
|
|
|
|
schema_short2 = conf.schema_short2
|
|
|
|
schema_short = conf.schema_short
|
|
|
|
schema_four = conf.four_summands_schema
|
|
|
|
|
|
|
|
cable_template = cs.CableTemplate(knot_formula=schema_short)
|
|
|
|
cable_template.fill_q_vector()
|
|
|
|
q_v = cable_template.q_vector
|
|
|
|
print(q_v)
|
|
|
|
print(cable_template.cable.knot_description)
|
|
|
|
cable1 = cs.CableTemplate(knot_formula=schema_short1,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v
|
|
|
|
).cable
|
|
|
|
cable2 = cs.CableTemplate(knot_formula=schema_short2,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v
|
|
|
|
).cable
|
|
|
|
cable = cs.CableTemplate(knot_formula=schema_short1,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v
|
|
|
|
).cable
|
|
|
|
|
|
|
|
cable.plot_sigma_for_summands()
|
|
|
|
# cable1.plot_sigma_for_summands()
|
|
|
|
# cable2.plot_sigma_for_summands()
|
|
|
|
|
|
|
|
|
|
|
|
def cable_loop_with_details(verbose=True, conf=None):
|
|
|
|
conf = conf or Config()
|
|
|
|
# verbose = False
|
|
|
|
schema_short1 = conf.schema_short1
|
|
|
|
schema_short2 = conf.schema_short2
|
|
|
|
schema_short = conf.schema_short
|
|
|
|
cable_template = cs.CableTemplate(knot_formula=schema_short)
|
|
|
|
|
|
|
|
list_of_q_vectors = []
|
|
|
|
# for el in [2, 3, 5, 7, 11, 13]:
|
|
|
|
for el in [2]:
|
|
|
|
cable_template.fill_q_vector(lowest_number=el)
|
|
|
|
q_v = cable_template.q_vector
|
|
|
|
print(q_v)
|
|
|
|
print(cable_template.cable.knot_description)
|
|
|
|
cable1 = cs.CableTemplate(knot_formula=schema_short1,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v
|
|
|
|
).cable
|
|
|
|
cable2 = cs.CableTemplate(knot_formula=schema_short2,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v
|
|
|
|
).cable
|
|
|
|
# print("\n")
|
|
|
|
# print(cable1.knot_description)
|
|
|
|
is_1 = cable1.is_function_big_for_all_metabolizers(invariant=cs.SIGMA)
|
|
|
|
is_2 = cable2.is_function_big_for_all_metabolizers(invariant=cs.SIGMA)
|
|
|
|
if is_1 and is_2:
|
|
|
|
print("sigma is big for all metabolizers")
|
|
|
|
else:
|
|
|
|
print("sigma is not big for all metabolizers")
|
|
|
|
print("\n" * 3)
|
|
|
|
|
|
|
|
def few_cable_without_calc(verbose=False, conf=None):
|
|
|
|
|
|
|
|
conf = conf or Config()
|
|
|
|
schema_short1 = conf.schema_short1
|
|
|
|
schema_short2 = conf.schema_short2
|
|
|
|
schema_short = conf.schema_short
|
|
|
|
|
|
|
|
cable_template = cs.CableTemplate(knot_formula=schema_short)
|
|
|
|
|
|
|
|
list_of_q_vectors = []
|
|
|
|
for el in [2, 3, 5, 7, 11, 13]:
|
|
|
|
cable_template.fill_q_vector(lowest_number=el)
|
|
|
|
q_v = cable_template.q_vector
|
|
|
|
print(q_v)
|
|
|
|
print(cable_template.cable.knot_description)
|
|
|
|
cable1 = cs.CableTemplate(knot_formula=schema_short1,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v
|
|
|
|
).cable
|
|
|
|
cable2 = cs.CableTemplate(knot_formula=schema_short2,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v
|
|
|
|
).cable
|
|
|
|
is_1 = cable1.is_function_big_for_all_metabolizers(invariant=sigma)
|
|
|
|
is_2 = cable2.is_function_big_for_all_metabolizers(invariant=sigma)
|
|
|
|
if is_1 and is_2:
|
|
|
|
print("sigma is big for all metabolizers")
|
|
|
|
else:
|
|
|
|
print("sigma is not big for all metabolizers")
|
|
|
|
print("\n" * 3)
|
|
|
|
|
|
|
|
def smallest_cable(verbose=True, conf=None):
|
|
|
|
|
|
|
|
conf = conf or Config()
|
|
|
|
schema_short1 = conf.schema_short1
|
|
|
|
schema_short2 = conf.schema_short2
|
|
|
|
schema_short = conf.schema_short
|
|
|
|
|
|
|
|
|
|
|
|
cable_template = cs.CableTemplate(knot_formula=schema_short)
|
|
|
|
q_v = cable_template.q_vector
|
|
|
|
print(q_v)
|
|
|
|
cable1 = cs.CableTemplate(knot_formula=schema_short1,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v).cable
|
|
|
|
cable2 = cs.CableTemplate(knot_formula=schema_short2,
|
|
|
|
verbose=verbose,
|
|
|
|
q_vector=q_v).cable
|
|
|
|
cable1.is_function_big_for_all_metabolizers(invariant=sigma)
|
|
|
|
cable2.is_function_big_for_all_metabolizers(invariant=sigma)
|
|
|
|
|
|
|
|
def plot_many_untwisted_signature_functions(range_tuple=(1, 10)):
|
|
|
|
P = Primes()
|
|
|
|
for i in range(*range_tuple):
|
|
|
|
q = P.unrank(i)
|
|
|
|
a = cs.CableSummand.get_untwisted_signature_function(q=q)
|
|
|
|
a.plot()
|
2020-11-02 09:32:39 +01:00
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
|
|
|
|
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()
|
2020-10-17 20:15:48 +02:00
|
|
|
|
2021-01-11 07:34:03 +01:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# formula_long = "[[k[0], k[5], k[3]], " + \
|
|
|
|
# "[-k[5], -k[3]], " + \
|
|
|
|
# "[k[2], k[3]], " + \
|
|
|
|
# "[-k[4], -k[2], -k[3]]" + \
|
|
|
|
# "[k[4], k[1], k[7]], " + \
|
|
|
|
# "[-k[1], -k[7]], " + \
|
|
|
|
# "[k[6], k[7]], " + \
|
|
|
|
# "[-k[0], -k[6], -k[7]]]"
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# formula_1 = "[[k[0], k[5], k[3]], " + \
|
|
|
|
# "[-k[1], -k[3]], " + \
|
|
|
|
# "[ k[3]], " + \
|
|
|
|
# "[-k[4], -k[6], -k[3]]]"
|
|
|
|
#
|
|
|
|
# formula_2 = "[[k[4], k[1], k[7]], " + \
|
|
|
|
# "[ -k[7]], " + \
|
|
|
|
# "[k[6], k[7]], " + \
|
|
|
|
# "[-k[0], -k[5], -k[7]]]"
|
|
|
|
#
|
|
|
|
#
|