correction in zeros counting
This commit is contained in:
parent
dabaa24999
commit
bf15b6e84b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import inspect
|
import inspect
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import itertools as it
|
import itertools as it
|
||||||
@ -9,7 +10,7 @@ import itertools as it
|
|||||||
|
|
||||||
class MySettings(object):
|
class MySettings(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
k = 0
|
self.f_results = os.path.join(os.getcwd(), "results.out")
|
||||||
|
|
||||||
def main(arg):
|
def main(arg):
|
||||||
my_settings = MySettings()
|
my_settings = MySettings()
|
||||||
@ -19,16 +20,19 @@ def main(arg):
|
|||||||
tests()
|
tests()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def tests(limit=10):
|
def tests(limit=10):
|
||||||
|
|
||||||
for comb in it.combinations_with_replacement(range(1, limit + 1), 5):
|
for comb in it.combinations_with_replacement(range(1, limit + 1), 5):
|
||||||
knot_description, null_comb, all_comb = second_sum(*comb)
|
k_0, k_1, k_2, k_3, k_4 = comb
|
||||||
if null_comb^2 >= all_comb:
|
|
||||||
print "\n\nHURA!!"
|
knot_sum = [[k_0, k_1, k_2], [k_3, k_4], [-k_0, -k_3, -k_4], [-k_1, -k_2]]
|
||||||
print comb
|
|
||||||
|
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 knot_description
|
||||||
print "Zero cases: " + str(null_comb)
|
print null_comb, all_comb
|
||||||
print "All cases: " + str(all_comb)
|
|
||||||
# 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)
|
||||||
@ -231,35 +235,45 @@ def mod_one(n):
|
|||||||
|
|
||||||
# ###################### TEMPORARY TESTS #########
|
# ###################### TEMPORARY TESTS #########
|
||||||
|
|
||||||
# def first_sum(*arg):
|
# first_sum
|
||||||
# k_0, k_1, k_2, k_3 = arg
|
# F = get_function_of_theta_for_sum([k_3], [-k_2],
|
||||||
# F = get_function_of_theta_for_sum([k_3], [-k_2],
|
# [-k_0, -k_1, -k_3],
|
||||||
# [-k_0, -k_1, -k_3],
|
# [k_0, k_1, k_2])
|
||||||
# [k_0, k_1, k_2])
|
def eval_cable_for_thetas(knot_sum):
|
||||||
# all_combinations = (k_3 + 1) * (k_2 + 1) * (k_3 + 1) * (k_2 + 1)
|
F = get_function_of_theta_for_sum(*knot_sum)
|
||||||
# null_combinations = 0
|
knot_description = get_knot_descrption(*knot_sum)
|
||||||
# non_trivial_zeros = 0
|
all_combinations = get_number_of_combinations(*knot_sum)
|
||||||
# for v_theta in it.product(range(k_3 + 1), range(k_2 + 1),
|
null_combinations = 1
|
||||||
# range(k_3 + 1), range(k_2 + 1)):
|
# non_trivial_zeros = 0
|
||||||
# f = F(*v_theta)
|
theta_limits = []
|
||||||
# if f.sum_of_absolute_values() != 0 and sum(v_theta) == 0:
|
ranges_list = []
|
||||||
# print 4 * "\n" + "something wrong!!!!!!!!!!"
|
for knot in knot_sum:
|
||||||
# print inspect.stack()[0][3]
|
ranges_list.append(range(abs(knot[-1]) + 1))
|
||||||
# print arg
|
null_combinations = 1
|
||||||
# print v_theta
|
good_theta_combinations = []
|
||||||
#
|
for v_theta in it.product(*ranges_list):
|
||||||
# if f.sum_of_absolute_values() == 0:
|
f = F(*v_theta)
|
||||||
# null_combinations += 1
|
assert f.sum_of_absolute_values() == 0 or sum(v_theta) != 0
|
||||||
# if sum(v_theta) != 0:
|
if f.sum_of_absolute_values() == 0 and sum(v_theta) != 0:
|
||||||
# if len(arg) == len(set(arg)) and len(set(v_theta)) > 1:
|
good_theta_combinations.append(v_theta)
|
||||||
# non_trivial_zeros += 1
|
m = len([theta for theta in v_theta if theta != 0])
|
||||||
# # print "\nNontrivial zero"
|
null_combinations += 2^m
|
||||||
# # print inspect.stack()[0][3]
|
# if len(arg) == len(set(arg)) and len(set(v_theta)) > 1:
|
||||||
# print arg
|
# non_trivial_zeros += 1
|
||||||
# print v_theta
|
# print "\nNontrivial zero"
|
||||||
# print
|
# print arg
|
||||||
# return non_trivial_zeros, null_combinations, all_combinations
|
# print v_theta
|
||||||
|
# print
|
||||||
|
if null_combinations^2 >= all_combinations:
|
||||||
|
print "\n\nHURA!!"
|
||||||
|
print
|
||||||
|
print knot_description
|
||||||
|
print "Zero cases: " + str(null_combinations)
|
||||||
|
print "All cases: " + str(all_combinations)
|
||||||
|
for el in good_theta_combinations:
|
||||||
|
print el
|
||||||
|
return knot_description, null_combinations, all_combinations
|
||||||
|
return None
|
||||||
|
|
||||||
def get_knot_descrption(*arg):
|
def get_knot_descrption(*arg):
|
||||||
description = ""
|
description = ""
|
||||||
@ -276,33 +290,8 @@ def get_knot_descrption(*arg):
|
|||||||
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 * knot[-1] + 1)
|
number_of_combinations *= (2 * abs(knot[-1]) + 1)
|
||||||
return number_of_combinations
|
return number_of_combinations
|
||||||
|
|
||||||
def second_sum(*arg):
|
|
||||||
k_0, k_1, k_2, k_3, k_4 = arg
|
|
||||||
knot_sum = [[k_0, k_1, k_2], [k_3, k_4], [-k_0, -k_3, -k_4], [-k_1, -k_2]]
|
|
||||||
F = get_function_of_theta_for_sum(*knot_sum)
|
|
||||||
knot_description = get_knot_descrption(*knot_sum)
|
|
||||||
all_combinations = get_number_of_combinations(*knot_sum)
|
|
||||||
null_combinations = 1
|
|
||||||
# non_trivial_zeros = 0
|
|
||||||
|
|
||||||
for v_theta in it.product(range(k_2 + 1), range(k_4 + 1),
|
|
||||||
range(k_4 + 1), range(k_2 + 1)):
|
|
||||||
f = F(*v_theta)
|
|
||||||
assert f.sum_of_absolute_values() == 0 or sum(v_theta) != 0
|
|
||||||
if f.sum_of_absolute_values() == 0 and sum(v_theta) != 0:
|
|
||||||
null_combinations += 2
|
|
||||||
# if len(arg) == len(set(arg)) and len(set(v_theta)) > 1:
|
|
||||||
# non_trivial_zeros += 1
|
|
||||||
# print "\nNontrivial zero"
|
|
||||||
# print inspect.stack()[0][3]
|
|
||||||
# print arg
|
|
||||||
# print v_theta
|
|
||||||
# print
|
|
||||||
return knot_description, null_combinations, all_combinations
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__' and '__file__' in globals():
|
if __name__ == '__main__' and '__file__' in globals():
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user