Godtone (talk | contribs)
m My Python 3 code: clarification
Godtone (talk | contribs)
 
(4 intermediate revisions by the same user not shown)
Line 9: Line 9:
* [[User:Godtone/zeta]]
* [[User:Godtone/zeta]]
Whose significance is backed up by the more psychoacoustically-informed tuning metrics I've designed (<code>optimal_edo_sequence</code>s from [[#My Python 3 code]]):
Whose significance is backed up by the more psychoacoustically-informed tuning metrics I've designed (<code>optimal_edo_sequence</code>s from [[#My Python 3 code]]):
* [[User:Godtone/optimal edo sequences]]
* [[User:Godtone/optimal edo sequences]] (and [[User:Godtone/strict_optimal_edo_sequences]])
...as well as by my own knowledge of tuning theory.
...as well as by my own knowledge of tuning theory.


Line 1,574: Line 1,574:
if len(n) - len([ sedo for sedo in m ]) >= min_simplifications:
if len(n) - len([ sedo for sedo in m ]) >= min_simplifications:
results.append(edo)
results.append(edo)
return results
# 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(7))
def dieses( max_n=4, gs=odd_lim(9), targets=None, show=False, minerr=steps(20000/19683,1)/4 ):
if not targets:
targets = gs
dieses_found = dict()
for g in gs:
for target in targets+[(2,1)]:
for n in range(2,max_n+1):
candidate = reduce(div_iv( target, mul_iv(*[g]*n) ))
if steps(candidate,1)>1/2:
candidate = div_iv((2,1),(candidate))
if steps(candidate,1)/n >= steps(20000/19683,1)/4 and steps(250/243,1) >= steps(candidate,1):
if candidate not in dieses_found:
dieses_found[candidate] = []
dieses_found[candidate].append(( n, g, target, steps(candidate,ed(1200))/n ))
if show:
for diesis in dieses_found:
mindamage = min([ dieses_found[diesis][k][3] for k in range(len( dieses_found[diesis] )) ])
if mindamage >= minerr:
def equiv(d):
return ', '.join([ '('+striv(eq[1])+')^'+str(eq[0])+' ~ '+striv(eq[2])+' (~'+
str( int(eq[3]*100+.5)/100 )[:5]+'c)' for eq in dieses_found[d] ])
print(
pad( striv(diesis), 12 ),
pad( str( int(mindamage*100+.5)/100 )[:6]+'c', 7, '.' ),
equiv(diesis)
)
results = [diesis for diesis in dieses_found]
results.sort(key=lambda x: as_float(x))
return results
return results
</syntaxhighlight>
</syntaxhighlight>