version for first calculations
This commit is contained in:
parent
bf15b6e84b
commit
6928baeebd
@ -12,8 +12,8 @@ class MySettings(object):
|
||||
def __init__(self):
|
||||
self.f_results = os.path.join(os.getcwd(), "results.out")
|
||||
|
||||
|
||||
def main(arg):
|
||||
my_settings = MySettings()
|
||||
try:
|
||||
tests(int(arg[1]))
|
||||
except:
|
||||
@ -21,18 +21,20 @@ def main(arg):
|
||||
|
||||
|
||||
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):
|
||||
k_0, k_1, k_2, k_3, k_4 = comb
|
||||
|
||||
knot_sum = [[k_0, k_1, k_2], [k_3, k_4], [-k_0, -k_3, -k_4], [-k_1, -k_2]]
|
||||
|
||||
with open(settings.f_results, 'w') as f_results:
|
||||
for k in it.combinations_with_replacement(range(1, limit + 1), 5):
|
||||
knot_sum = eval(knot_sum_formula)
|
||||
result = eval_cable_for_thetas(knot_sum)
|
||||
if result is not None:
|
||||
knot_description, null_comb, all_comb = result
|
||||
print 3 * "\nHURA"
|
||||
print knot_description
|
||||
print null_comb, all_comb
|
||||
line = (str(k) + ", " + str(null_comb) + ", " +
|
||||
str(all_comb) + "\n")
|
||||
f_results.write(line)
|
||||
|
||||
# for comb in it.combinations_with_replacement(range(1, limit + 1), 4):
|
||||
# print 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)))
|
||||
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(T_2, d) + Bl(K')(ksi_l^(-theta) * t)
|
||||
@ -265,7 +251,6 @@ def eval_cable_for_thetas(knot_sum):
|
||||
# print v_theta
|
||||
# print
|
||||
if null_combinations^2 >= all_combinations:
|
||||
print "\n\nHURA!!"
|
||||
print
|
||||
print knot_description
|
||||
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 None
|
||||
|
||||
|
||||
def get_knot_descrption(*arg):
|
||||
description = ""
|
||||
for knot in arg:
|
||||
@ -282,16 +268,34 @@ def get_knot_descrption(*arg):
|
||||
description += "-"
|
||||
description += "T("
|
||||
for k in knot:
|
||||
description += "2, " + str(abs(k)) + "; "
|
||||
description += "2, " + str(2 * abs(k) + 1) + "; "
|
||||
description = description[:-2]
|
||||
description += ") # "
|
||||
return description[:-3]
|
||||
|
||||
|
||||
def get_number_of_combinations(*arg):
|
||||
number_of_combinations = 1
|
||||
for knot in arg:
|
||||
number_of_combinations *= (2 * abs(knot[-1]) + 1)
|
||||
return number_of_combinations
|
||||
|
||||
|
||||
if __name__ == '__main__' and '__file__' in globals():
|
||||
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