get_sign_jump function
This commit is contained in:
parent
ff8285e952
commit
e815de8846
@ -1,15 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# TBD: remove part of the description to readme/example
|
# TBD: remove part of the description to readme/example
|
||||||
"""
|
"""
|
||||||
This script calculates signature functions for knots (cable sums).
|
This script calculates signature functions for knots (cable sums).
|
||||||
|
|
||||||
The script can be run as a sage script from the terminal or used in interactive
|
The script can be run as a sage script from the terminal or used in interactive
|
||||||
mode.
|
modeselfself.
|
||||||
|
|
||||||
|
A knot (cable sum) is encoded as a list where each element (also a list)
|
||||||
|
corresponds to a cable knot.
|
||||||
|
|
||||||
To calculate the number of characters for which signature function vanish use
|
To calculate the number of characters for which signature function vanish use
|
||||||
the function eval_cable_for_thetas as shown below:
|
the function eval_cable_for_thetas as shown below.
|
||||||
|
|
||||||
sage: eval_cable_for_thetas([[1, 3], [2], [-1, -2], [-3]])
|
sage: eval_cable_for_thetas([[1, 3], [2], [-1, -2], [-3]])
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ sage: print sf
|
|||||||
13/30: -1
|
13/30: -1
|
||||||
19/42: -1
|
19/42: -1
|
||||||
23/42: 1
|
23/42: 1
|
||||||
17/30: 1
|
17/30: 1
|
||||||
4/7: 0
|
4/7: 0
|
||||||
3/5: -1
|
3/5: -1
|
||||||
23/30: 1
|
23/30: 1
|
||||||
@ -79,6 +80,7 @@ import pandas as pd
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MySettings(object):
|
class MySettings(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.f_results = os.path.join(os.getcwd(), "results.out")
|
self.f_results = os.path.join(os.getcwd(), "results.out")
|
||||||
@ -137,6 +139,9 @@ class SignatureFunction(object):
|
|||||||
new_data.append((2 * jump_arg, jump))
|
new_data.append((2 * jump_arg, jump))
|
||||||
return SignatureFunction(new_data)
|
return SignatureFunction(new_data)
|
||||||
|
|
||||||
|
def get_signture_jump(self, t):
|
||||||
|
return self.data.get(t, 0)
|
||||||
|
|
||||||
|
|
||||||
def minus_square_root(self):
|
def minus_square_root(self):
|
||||||
# to read values for t^(1/2)
|
# to read values for t^(1/2)
|
||||||
@ -326,9 +331,9 @@ def get_cable_signature_as_theta_function(*arg):
|
|||||||
|
|
||||||
k_n = abs(arg[-1])
|
k_n = abs(arg[-1])
|
||||||
if theta > k_n:
|
if theta > k_n:
|
||||||
print "k for the pattern in the cable is " + str(arg[-1])
|
msg = "k for the pattern in the cable is " + str(arg[-1]) + \
|
||||||
print "theta shouldn't be larger than this"
|
". Parameter theta should not be larger than abs(k)."
|
||||||
return None
|
raise ValueError(msg)
|
||||||
cable_signature = get_blanchfield_for_pattern(arg[-1], theta)
|
cable_signature = get_blanchfield_for_pattern(arg[-1], theta)
|
||||||
for i, k in enumerate(arg[:-1][::-1]):
|
for i, k in enumerate(arg[:-1][::-1]):
|
||||||
ksi = 1/(2 * k_n + 1)
|
ksi = 1/(2 * k_n + 1)
|
||||||
@ -390,7 +395,12 @@ def get_function_of_theta_for_sum(*arg):
|
|||||||
raise TypeError(msg)
|
raise TypeError(msg)
|
||||||
sf = SignatureFunction([(0, 0)])
|
sf = SignatureFunction([(0, 0)])
|
||||||
for i, knot in enumerate(arg):
|
for i, knot in enumerate(arg):
|
||||||
|
try:
|
||||||
sf += (get_cable_signature_as_theta_function(*knot))(thetas[i])
|
sf += (get_cable_signature_as_theta_function(*knot))(thetas[i])
|
||||||
|
except ValueError as e:
|
||||||
|
print "ValueError: " + str(e.args[0]) +\
|
||||||
|
" Please change " + str(i + 1) + ". parameter."
|
||||||
|
return None
|
||||||
if verbose:
|
if verbose:
|
||||||
print
|
print
|
||||||
print str(*thetas)
|
print str(*thetas)
|
||||||
|
Loading…
Reference in New Issue
Block a user