Module:Limits: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 18: | Line 18: | ||
end | end | ||
-- compute all positive ratios n/m with n and m <= q modulo powers of equave | |||
function p.limit_modulo_equave(q, equave) | function p.limit_modulo_equave(q, equave) | ||
equave = equave or 2 | equave = equave or 2 | ||
Line 32: | Line 33: | ||
end | end | ||
-- check additive consistency for a set of ratios (modulo powers of equave): | |||
-- approx(a*b) = approx(a) + approx(b) forall a, b: a, b, ab in ratios | |||
-- `distinct`: whether distinct ratios are required to be mapped to distinct approximations | |||
function p.additively_consistent(equave, size, ratios, distinct) | function p.additively_consistent(equave, size, ratios, distinct) | ||
distinct = distinct or false | distinct = distinct or false | ||
Line 73: | Line 77: | ||
end | end | ||
-- find additive consistency limit | |||
-- returns nil when at least `max_n` | |||
-- `distinct`: whether distinct ratios are required to be mapped to distinct approximations | |||
function p.consistency_limit(size, equave, distinct, max_n) | function p.consistency_limit(size, equave, distinct, max_n) | ||
max_n = max_n or 1/0 | max_n = max_n or 1/0 |