Godtone (talk | contribs)
m My Python 3 code: add dieses function
Godtone (talk | contribs)
m default attribute for show is inconvenient for calculations
 
(One intermediate revision by the same user not shown)
Line 1,578: Line 1,578:
# the following definitions are equivalent in the set of commas considered 7-limit dieses:
# the following definitions are equivalent in the set of commas considered 7-limit dieses:
# dieses(4,odd_lim(9),odd_lim(9)) == dieses(4,odd_lim(9),odd_lim(7)) == dieses(5,odd_lim(9),odd_lim(9)) == dieses(5,odd_lim(9),odd_lim(7))
# dieses(4,odd_lim(9),odd_lim(9)) == dieses(4,odd_lim(9),odd_lim(7)) == dieses(5,odd_lim(9),odd_lim(9)) == dieses(5,odd_lim(9),odd_lim(7))
def dieses( max_n=4, gs=odd_lim(9), targets=None, minsizeexcl=1/1, maxsizeincl=250/243, minerr=steps(20000/19683,1)/4 ):
def dieses( max_n=4, gs=odd_lim(9), targets=None, show=False, minsizeexcl=1/1, maxsizeincl=250/243, minerr=steps(20000/19683,1)/4 ):
if not targets:
if not targets:
targets = gs
targets = gs
Line 1,594: Line 1,594:
lhs, rhs = '('+striv(target)+')', '('+striv(g)+')^'+str(n)
lhs, rhs = '('+striv(target)+')', '('+striv(g)+')^'+str(n)
if c not in dieses_found:
if c not in dieses_found:
print( striv(c), '=', rhs if swap else lhs, '/', lhs if swap else rhs )
if show:
print( striv(c), '=', rhs if swap else lhs, '/', lhs if swap else rhs )
dieses_found.append(c)
dieses_found.append(c)
else:
else:
print( '(', striv(c), '=', rhs if swap else lhs, '/', lhs if swap else rhs, ')' )
if show:
print( '(', striv(c), '=', rhs if swap else lhs, '/', lhs if swap else rhs, ')' )
dieses_found.sort(key=lambda x: steps(x,1))
dieses_found.sort(key=lambda x: steps(x,1))
return dieses_found
return dieses_found