version for first calculations
This commit is contained in:
parent
bf15b6e84b
commit
6928baeebd
@ -12,8 +12,8 @@ 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")
|
||||||
|
|
||||||
|
|
||||||
def main(arg):
|
def main(arg):
|
||||||
my_settings = MySettings()
|
|
||||||
try:
|
try:
|
||||||
tests(int(arg[1]))
|
tests(int(arg[1]))
|
||||||
except:
|
except:
|
||||||
@ -21,18 +21,20 @@ def main(arg):
|
|||||||
|
|
||||||
|
|
||||||
def tests(limit=10):
|
def tests(limit=10):
|
||||||
|
settings = MySettings()
|
||||||
|
knot_sum_formula = "[[k[0], k[1], k[2]], [k[3], k[4]], \
|
||||||
|
[-k[0], -k[3], -k[4]], [-k[1], -k[2]]]"
|
||||||
|
|
||||||
for comb in it.combinations_with_replacement(range(1, limit + 1), 5):
|
with open(settings.f_results, 'w') as f_results:
|
||||||
k_0, k_1, k_2, k_3, k_4 = comb
|
for k in it.combinations_with_replacement(range(1, limit + 1), 5):
|
||||||
|
knot_sum = eval(knot_sum_formula)
|
||||||
knot_sum = [[k_0, k_1, k_2], [k_3, k_4], [-k_0, -k_3, -k_4], [-k_1, -k_2]]
|
|
||||||
|
|
||||||
result = eval_cable_for_thetas(knot_sum)
|
result = eval_cable_for_thetas(knot_sum)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
knot_description, null_comb, all_comb = result
|
knot_description, null_comb, all_comb = result
|
||||||
print 3 * "\nHURA"
|
line = (str(k) + ", " + str(null_comb) + ", " +
|
||||||
print knot_description
|
str(all_comb) + "\n")
|
||||||
print null_comb, all_comb
|
f_results.write(line)
|
||||||
|
|
||||||
# for comb in it.combinations_with_replacement(range(1, limit + 1), 4):
|
# for comb in it.combinations_with_replacement(range(1, limit + 1), 4):
|
||||||
# print comb
|
# print comb
|
||||||
# print first_sum(*comb)
|
# print first_sum(*comb)
|
||||||
@ -146,22 +148,6 @@ def get_blanchfield_for_pattern(k_n, theta):
|
|||||||
results.append((1 - e * ksi, 1 * sgn(k_n)))
|
results.append((1 - e * ksi, 1 * sgn(k_n)))
|
||||||
return SignatureFunction(results)
|
return SignatureFunction(results)
|
||||||
|
|
||||||
#
|
|
||||||
# def get_sigma(t, k):
|
|
||||||
# p = 2
|
|
||||||
# q = 2 * k + 1
|
|
||||||
# sigma_set = get_sigma_set(p, q)
|
|
||||||
# sigma = len(sigma_set) - 2 * len([z for z in sigma_set if t < z < 1 + t])
|
|
||||||
# return sigma
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# def get_sigma_set(p, q):
|
|
||||||
# sigma_set = set()
|
|
||||||
# for i in range(1, p):
|
|
||||||
# for j in range(1, q):
|
|
||||||
# sigma_set.add(j/q + i/p)
|
|
||||||
# return sigma_set
|
|
||||||
|
|
||||||
|
|
||||||
# Bl_theta(K'_(2, d) =
|
# Bl_theta(K'_(2, d) =
|
||||||
# Bl_theta(T_2, d) + Bl(K')(ksi_l^(-theta) * t)
|
# Bl_theta(T_2, d) + Bl(K')(ksi_l^(-theta) * t)
|
||||||
@ -265,7 +251,6 @@ def eval_cable_for_thetas(knot_sum):
|
|||||||
# print v_theta
|
# print v_theta
|
||||||
# print
|
# print
|
||||||
if null_combinations^2 >= all_combinations:
|
if null_combinations^2 >= all_combinations:
|
||||||
print "\n\nHURA!!"
|
|
||||||
print
|
print
|
||||||
print knot_description
|
print knot_description
|
||||||
print "Zero cases: " + str(null_combinations)
|
print "Zero cases: " + str(null_combinations)
|
||||||
@ -275,6 +260,7 @@ def eval_cable_for_thetas(knot_sum):
|
|||||||
return knot_description, null_combinations, all_combinations
|
return knot_description, null_combinations, all_combinations
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_knot_descrption(*arg):
|
def get_knot_descrption(*arg):
|
||||||
description = ""
|
description = ""
|
||||||
for knot in arg:
|
for knot in arg:
|
||||||
@ -282,16 +268,34 @@ def get_knot_descrption(*arg):
|
|||||||
description += "-"
|
description += "-"
|
||||||
description += "T("
|
description += "T("
|
||||||
for k in knot:
|
for k in knot:
|
||||||
description += "2, " + str(abs(k)) + "; "
|
description += "2, " + str(2 * abs(k) + 1) + "; "
|
||||||
description = description[:-2]
|
description = description[:-2]
|
||||||
description += ") # "
|
description += ") # "
|
||||||
return description[:-3]
|
return description[:-3]
|
||||||
|
|
||||||
|
|
||||||
def get_number_of_combinations(*arg):
|
def get_number_of_combinations(*arg):
|
||||||
number_of_combinations = 1
|
number_of_combinations = 1
|
||||||
for knot in arg:
|
for knot in arg:
|
||||||
number_of_combinations *= (2 * abs(knot[-1]) + 1)
|
number_of_combinations *= (2 * abs(knot[-1]) + 1)
|
||||||
return number_of_combinations
|
return number_of_combinations
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__' and '__file__' in globals():
|
if __name__ == '__main__' and '__file__' in globals():
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
|
||||||
|
#
|
||||||
|
# def get_sigma(t, k):
|
||||||
|
# p = 2
|
||||||
|
# q = 2 * k + 1
|
||||||
|
# sigma_set = get_sigma_set(p, q)
|
||||||
|
# sigma = len(sigma_set) - 2 * len([z for z in sigma_set if t < z < 1 + t])
|
||||||
|
# return sigma
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# def get_sigma_set(p, q):
|
||||||
|
# sigma_set = set()
|
||||||
|
# for i in range(1, p):
|
||||||
|
# for j in range(1, q):
|
||||||
|
# sigma_set.add(j/q + i/p)
|
||||||
|
# return sigma_set
|
||||||
|
Loading…
Reference in New Issue
Block a user