Godtone (talk | contribs)
m correction!!
Godtone (talk | contribs)
Line 559: Line 559:
p = prime_limit(prime_idx( len(f)-1 ))
p = prime_limit(prime_idx( len(f)-1 ))
return sum([ f[i]*round(steps(p[i],et2)) for i in range(len(f)) ])
return sum([ f[i]*round(steps(p[i],et2)) for i in range(len(f)) ])
# the wart_tendency determines if a wart's behaviour is:
# 0: to change to second-best mapping (default)
# 1: to change to one-step-sharper mapping always
# -1: to change to one-step-flatter mapping always
# currently only one wart per gen is supported;
# if you want more its easier to specify the val yourself plus note that
# combined with wart_tendency you can sort of specify up to 2 warts per gen
def make_val(et2, gens, warts = [], wart_tendency = 0):
val = []
for g in gens:
gen_steps = steps(g,et2)
pval_steps = round(gen_steps)
if g in warts:
if wart_tendency != 0:
val.append(pval_steps + wart_tendency)
elif pval_steps - gen_steps > 0: # pval is sharp
val.append(pval_steps - 1)
elif pval_steps - gen_steps < 0:
val.append(pval_steps + 1)
else: # perfectly mapped
val.append(pval_steps)
else:
val.append(pval_steps)
return val
def map_iv(val_map, x): # assumes same harmonic subgroup
if type(x)==tuple:
x = fact(x)
return sum([ x[i]*val_map[i] for i in range(len(x)) ])
def consistent_err(x, et2, p=None):
def consistent_err(x, et2, p=None):
return pval(x if type(x)==list else fact(x,p), et2, p) - steps(as_float(x,p),et2)
return pval(x if type(x)==list else fact(x,p), et2, p) - steps(as_float(x,p),et2)