Module:Limits: Difference between revisions
Distinct consistency of 0edo should be 1 |
Improve documentation and request answers |
||
Line 3: | Line 3: | ||
local p = {} | local p = {} | ||
-- | -- returns a table of 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) | ||
Line 38: | Line 38: | ||
end | end | ||
-- | -- returns a table of all q-integer-limit ratios | ||
-- 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 55: | Line 55: | ||
end | end | ||
-- check additive consistency for a set of ratios (modulo powers of equave): | -- check additive consistency for a set of ratios (modulo powers of equave) | ||
-- of an equal tuning: | |||
-- approx(a*b) = approx(a) + approx(b) for all a, b: a, b, ab in ratios | -- 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 | ||
Line 87: | Line 88: | ||
end | end | ||
end | end | ||
-- ??? | |||
if type(distinct) == "number" then | if type(distinct) == "number" then | ||
return true | return true | ||
end | end | ||
local previous_ordered = {} | local previous_ordered = {} | ||
for _, a in pairs(previous) do | for _, a in pairs(previous) do | ||
Line 138: | Line 142: | ||
end | end | ||
-- find additive consistency limit | -- find additive consistency limit of an equal tuning | ||
-- `distinct`: whether distinct ratios are required to be mapped to distinct approximations | -- `distinct`: whether distinct ratios are required to be mapped to distinct approximations | ||
-- - if an integer, it is the regular consistency limit already known | -- - if an integer, it is the regular consistency limit already known (why?) | ||
-- `max_n`: returns nil if the result is equal to or greater than this | |||
function p.consistency_limit(et, distinct, max_n) | function p.consistency_limit(et, distinct, max_n) | ||