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
|
2020-10-14 17:21:17 +02:00
|
|
|
|
2021-07-15 13:48:37 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from utility import import_sage
|
|
|
|
package = None
|
|
|
|
path = ''
|
|
|
|
|
|
|
|
else:
|
|
|
|
from .utility import import_sage
|
|
|
|
package = os.path.join( __name__.split('.')[0])
|
|
|
|
path = '../'
|
|
|
|
sg = import_sage('signature', package=package, path=path)
|
|
|
|
cs = import_sage('cable_signature', package=package, path=path)
|
|
|
|
|
2020-11-02 09:32:39 +01:00
|
|
|
|
2020-10-15 07:16:42 +02:00
|
|
|
|
|
|
|
|
2021-01-25 02:20:17 +01:00
|
|
|
# class Config:
|
|
|
|
# def __init__(self):
|
|
|
|
# self.f_results = os.path.join(os.getcwd(), "results.out")
|
|
|
|
|
|
|
|
class Schemas:
|
|
|
|
|
|
|
|
|
|
|
|
# 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]]]"
|
|
|
|
|
|
|
|
|
|
|
|
short_3_layers_a = "[[ k[5], k[3]], " + \
|
|
|
|
"[ -k[1], -k[3]], " + \
|
|
|
|
"[ k[3]], " + \
|
|
|
|
"[ -k[4], -k[6], -k[3]]]"
|
|
|
|
|
|
|
|
short_3_layers_b = "[[k[4], k[1], k[7]], " + \
|
|
|
|
"[ -k[7]], " + \
|
|
|
|
"[ k[6], k[7]], " + \
|
|
|
|
"[ -k[5], -k[7]]]"
|
|
|
|
|
|
|
|
schema_short1 = "[ [k[5], k[3]], " + \
|
|
|
|
"[ -k[1], -k[3]], " + \
|
|
|
|
"[ k[3]], " + \
|
|
|
|
"[ -k[6], -k[3]]]"
|
|
|
|
|
|
|
|
schema_short2 = "[[ k[1], k[7]], " + \
|
|
|
|
"[ -k[7]], " + \
|
|
|
|
"[ k[6], k[7]], " + \
|
|
|
|
"[ -k[5], -k[7]]]"
|
|
|
|
|
|
|
|
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]]]"
|
|
|
|
|
|
|
|
# two_summands_schema = "[ [k[0], k[1], k[4]], [-k[1], -k[3]],\
|
|
|
|
# [k[2], k[3]], [-k[0], -k[2], -k[4]] ]"
|
|
|
|
# two_small_summands_schema = "[[k[3]], [-k[3]],\
|
|
|
|
# [k[3]], [-k[3]] ]"
|
|
|
|
#
|
|
|
|
# four_summands_schema = "[[k[3], k[2], k[0]],\
|
|
|
|
# [ -k[2], -k[0]],\
|
|
|
|
# [ k[1], k[0]],\
|
|
|
|
# [-k[3], -k[1], -k[0]]]"
|
|
|
|
#
|
|
|
|
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-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)
|
|
|
|
|
|
|
|
|
2021-01-25 02:20:17 +01:00
|
|
|
def print_sigma_for_cable(verbose=True, Schemas=None):
|
|
|
|
|
|
|
|
schema_short1 = Schemas.schema_short1
|
|
|
|
schema_short2 = Schemas.schema_short2
|
|
|
|
schema_short = Schemas.schema_short
|
|
|
|
schema_four = Schemas.four_summands_schema
|
2021-01-11 07:34:03 +01:00
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
|
2021-01-25 02:20:17 +01:00
|
|
|
def cable_loop_with_details(verbose=True):
|
2021-01-11 07:34:03 +01:00
|
|
|
# verbose = False
|
2021-01-25 02:20:17 +01:00
|
|
|
schema_short1 = Schemas.schema_short1
|
|
|
|
schema_short2 = Schemas.schema_short2
|
|
|
|
schema_short = Schemas.schema_short
|
2021-01-11 07:34:03 +01:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2021-01-25 02:20:17 +01:00
|
|
|
def few_cable_without_calc(verbose=False):
|
|
|
|
|
|
|
|
schema_short1 = Schemas.schema_short1
|
|
|
|
schema_short2 = Schemas.schema_short2
|
|
|
|
schema_short = Schemas.schema_short
|
2021-01-11 07:34:03 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
2021-01-25 02:20:17 +01:00
|
|
|
def smallest_cable(verbose=True):
|
|
|
|
|
|
|
|
schema_short1 = Schemas.schema_short1
|
|
|
|
schema_short2 = Schemas.schema_short2
|
|
|
|
schema_short = Schemas.schema_short
|
2021-01-11 07:34:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
2021-01-25 02:20:17 +01:00
|
|
|
|
2021-01-11 07:34:03 +01:00
|
|
|
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__':
|
|
|
|
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-25 02:20:17 +01: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]]]"
|
|
|
|
#
|
|
|
|
#
|