Godtone
Joined 17 December 2020
new section linking subpages |
m →My Python 3 code: add function for calculating the dwarf scale for a given val w.r.t a given subgroup |
||
| Line 1,450: | Line 1,450: | ||
def strict_optimal_edo_sequence(ivs,edo_set=range(2,311+1),weighting=lambda x: iv_complexity(x),combine='avg',mapping=True): | def strict_optimal_edo_sequence(ivs,edo_set=range(2,311+1),weighting=lambda x: iv_complexity(x),combine='avg',mapping=True): | ||
return optimal_edo_sequence(lambda edo: et_badness(ivs,edo,lambda rel_err: rel_err**2,weighting,combine,mapping),edo_set) | return optimal_edo_sequence(lambda edo: et_badness(ivs,edo,lambda rel_err: rel_err**2,weighting,combine,mapping),edo_set) | ||
# returns a set of odds in the subgroup that are sorted by their octave-reduced size | |||
# which map to every distinct number of steps/degrees of the val given, therefore, | |||
# dwarf(lim(p),N) is the set of odds for the dwarf scale of N EDO in the p-limit | |||
def dwarf(sg,v): | |||
if type(v)==int: # to be able to specify N for the patent val for N EDO | |||
v = val( lim(max(sg)), ed(v) ) | |||
result = [0] * v[0] # implies you can have a tritave dwarf if sg and v agree on the subgroup | |||
odd = 1 | |||
while 0 in result: | |||
if in_subgroup(odd,sg) and result[ map_iv(v,(odd,1)) % v[0] ]==0: | |||
result[ map_iv(v,(odd,1)) % v[0] ] = odd | |||
odd += 2 | |||
return result | |||
def scalestr(liststr): | def scalestr(liststr): | ||