Module:Limits: Difference between revisions
merge changes from dev |
Distinct consistency of 0edo should be 1 |
||
Line 4: | Line 4: | ||
-- compute all positive ratios n/m with n and m <= q modulo powers of equave | -- compute all positive ratios n/m with n and m <= q modulo powers of equave | ||
-- previous: already computed ratios for q-1 | -- previous: already computed ratios for q - 1 | ||
function p.limit_modulo_equave(q, equave, previous) | function p.limit_modulo_equave(q, equave, previous) | ||
equave = equave or 2 | equave = equave or 2 | ||
Line 38: | Line 38: | ||
end | end | ||
-- compute q-integer limit | -- compute q-integer-limit | ||
-- if a function `norm` and a number `max_norm` are provided, the output will be additionally restricted | -- if a function `norm` and a number `max_norm` are provided, the output will be additionally restricted | ||
function p.integer_limit(q, norm, max_norm) | function p.integer_limit(q, norm, max_norm) | ||
Line 56: | Line 56: | ||
-- check additive consistency for a set of ratios (modulo powers of equave): | -- check additive consistency for a set of ratios (modulo powers of equave): | ||
-- approx(a*b) = approx(a) + approx(b) | -- approx(a*b) = approx(a) + approx(b) for all a, b: a, b, ab in ratios | ||
-- `distinct`: whether distinct ratios are required to be mapped to distinct approximations | -- `distinct`: whether distinct ratios are required to be mapped to distinct approximations | ||
-- `previous`: already computed ratios for the previous iteraton | -- `previous`: already computed ratios for the previous iteraton | ||
Line 143: | Line 143: | ||
-- - if an integer, it is the regular consistency limit already known | -- - if an integer, it is the regular consistency limit already known | ||
function p.consistency_limit(et, distinct, max_n) | function p.consistency_limit(et, distinct, max_n) | ||
-- 0edo, the answer is known already | |||
if et.size == 0 then | if et.size == 0 then | ||
if distinct then | |||
return "∞" | return "1" | ||
else | |||
return "∞" | |||
end | |||
end | end | ||
max_n = max_n or 1 / 0 | max_n = max_n or 1 / 0 | ||
distinct = distinct or false | distinct = distinct or false |