Module:Interval table: Difference between revisions
CompactStar (talk | contribs) No edit summary |
CompactStar (talk | contribs) No edit summary |
||
| Line 5: | Line 5: | ||
local ud = require('Module:Ups and downs notation') | local ud = require('Module:Ups and downs notation') | ||
local ET = require('Module:ET') | local ET = require('Module:ET') | ||
-- Get prime limit of n/d | |||
local function get_limit(n,d) | |||
local result = 2 | |||
for k,_ in get_monzo(n, d) do | |||
if k > result then | |||
result = k | |||
end | |||
end | |||
return result | |||
end | |||
-- Gets mapping of a monzo in a val | -- Gets mapping of a monzo in a val | ||
| Line 19: | Line 30: | ||
end | end | ||
-- Generates list of ratios up to a max numerator & denominator, | -- Generates list of ratios up to a max numerator & denominator, max ratio size, and prime limit | ||
local function get_ratios_list(max_nd, max_size) | local function get_ratios_list(max_nd, max_size, prime_limit) | ||
local ratios = {} | local ratios = {} | ||
local ratio_strings = {} | local ratio_strings = {} | ||
| Line 26: | Line 37: | ||
for j=1,max_nd do | for j=1,max_nd do | ||
t = i/gcd(i,j) .. "/" .. j/gcd(i,j) | t = i/gcd(i,j) .. "/" .. j/gcd(i,j) | ||
if (i/j) >= 1 and (i/j) <= max_size and not u.table_contains(ratio_strings, t) then | if (i/j) >= 1 and (i/j) <= max_size and get_limit(i, j) <=prime_limit and not u.table_contains(ratio_strings, t) then | ||
ratios[#ratios + 1] = {i/gcd(i,j),j/gcd(i,j)} | ratios[#ratios + 1] = {i/gcd(i,j),j/gcd(i,j)} | ||
ratio_strings[#ratio_strings + 1] = t | ratio_strings[#ratio_strings + 1] = t | ||
| Line 71: | Line 82: | ||
local dual_sharp_fifth = ET.approximate(et, 3/2, 1) | local dual_sharp_fifth = ET.approximate(et, 3/2, 1) | ||
-- List of all ratios with numerator and denominator <= | -- List of all 13-limit ratios with numerator and denominator <= 100 and in the range 1/1 - 5/1 | ||
local ratios_list = get_ratios_list( | local ratios_list = get_ratios_list(100, 5, 13) | ||
wikitext = wikitext .. '!Steps\n' | wikitext = wikitext .. '!Steps\n' | ||