Godtone (talk | contribs)
Godtone (talk | contribs)
m My Python 3 code: argument name unclear (confused me more than once)
Line 1,553: Line 1,553:


# there is only finitely many EDOs which provide some simplification of a set of intervals as contrasted to all-distinct
# there is only finitely many EDOs which provide some simplification of a set of intervals as contrasted to all-distinct
def efficient_edos( n, inconsistencies=0, min_simplifications=1, edos=range(1,1000) ):
def efficient_edos( ivs, inconsistencies=0, min_simplifications=1, edos=range(1,1000) ):
if type(n)==int:
if type(ivs)==int:
n = odd_lim(n)
ivs = odd_lim(ivs)
elif type(n)==list and type(n[0])==int:
elif type(ivs)==list and type(ivs[0])==int:
n = odd_lim(1,[],n)
ivs = odd_lim(1,[],ivs)
results = []
results = []
for edo in edos:
for edo in edos:
v = edo
v = edo
if type(v)==int:
if type(v)==int:
v = val( lim(max([ prime_idx(len(fact(x))-1) for x in n ])), ed(edo) )
v = val( lim(max([ prime_idx(len(fact(x))-1) for x in ivs ])), ed(edo) )
# else v is assumed to be a mapping
# else v is assumed to be a mapping
m = dict()
m = dict()
for x in n: # collect mappings of intervals
for x in ivs: # collect mappings of intervals
sedo = map_iv(v,x)
sedo = map_iv(v,x)
if sedo in m:
if sedo in m:
Line 1,571: Line 1,571:
else:
else:
m[sedo] = [x]
m[sedo] = [x]
if len(inconsistent_ivs_by_val(n,v)) <= inconsistencies:
if len(inconsistent_ivs_by_val(ivs,v)) <= inconsistencies:
if len(n) - len([ sedo for sedo in m ]) >= min_simplifications:
if len(ivs) - len([ sedo for sedo in m ]) >= min_simplifications:
results.append(edo)
results.append(edo)
return results
return results