Module:Q-odd-limit intervals: Difference between revisions

ArrowHead294 (talk | contribs)
No edit summary
ArrowHead294 (talk | contribs)
No edit summary
Line 123: Line 123:
end
end


local function approx(steps, subgroup, monzo_list, t_title)
local function approx(steps, subgroup, monzo_list, t_title, approx_d, approx_v)
local t_body_direct = {}
local t_body_direct = {}
local elist_direct = {}
local errlist_direct = {}
local t_body_val = {}
local t_body_val = {}
local elist_val = {}
local errlist_val = {}
local val = {}
local val = {}
for i = 1, #subgroup do
for i = 1, #subgroup do
Line 158: Line 158:
end
end
elist_direct[i] = {
errlist_direct[i] = {
ratiocomp = ratiocomp,
ratiocomp = ratiocomp,
ead = ead,
ead = ead,
Line 166: Line 166:
}
}
elist_val[i] = {
errlist_val[i] = {
ratiocomp = ratiocomp,
ratiocomp = ratiocomp,
eav = eav,
eav = eav,
Line 175: Line 175:
end
end
table.sort(elist_direct, function(a, b) return a.ead < b.ead end)
table.sort(errlist_direct, function(a, b) return a.ead < b.ead end)
for i = 1, #error_list do
for i = 1, #error_list do
t_body_direct[i] = string.format("|-\n| %s\n| %s\n| %s", elist_direct[i].ratiocomp, elist_direct[i].error_abs_direct, elist_direct[i].error_rel_direct)
t_body_direct[i] = string.format("|-\n| %s\n| %s\n| %s", errlist_direct[i].ratiocomp, errlist_direct[i].error_abs_direct, errlist_direct[i].error_rel_direct)
t_body_val[i] = string.format("|-\n| %s\n| %s\n| %s", elist_val[i].ratiocomp, elist_val[i].error_abs_val, elist_val[i].error_rel_val)
t_body_val[i] = string.format("|-\n| %s\n| %s\n| %s", errlist_val[i].ratiocomp, errlist_val[i].error_abs_val, errlist_val[i].error_rel_val)
end
end


return "{| class=\"wikitable center-all mw-collapsible mw-collapsed sortable\"\n" ..
return "{| class=\"wikitable center-all mw-collapsible mw-collapsed sortable\"\n" ..
"|+ style=\"white-space: nowrap;\" | " .. t_title .. " (direct approximation)\n" ..
"|+ style=\"white-space: nowrap;\" | " .. t_title .. approx_d .. "\n" ..
"|-\n" ..
"|-\n" ..
"! class=\"unsortable\" | Interval and complement " ..
"! class=\"unsortable\" | Interval and complement " ..
Line 191: Line 191:
"\n|}\n\n" ..
"\n|}\n\n" ..
"{| class=\"wikitable center-all mw-collapsible mw-collapsed sortable\"\n" ..
"{| class=\"wikitable center-all mw-collapsible mw-collapsed sortable\"\n" ..
"|+ style=\"white-space: nowrap;\" | " .. t_title .. " (patent val mapping)\n" ..
"|+ style=\"white-space: nowrap;\" | " .. t_title .. approx_v .. "\n" ..
"|-\n" ..
"|-\n" ..
"! class=\"unsortable\" | Interval and complement " ..
"! class=\"unsortable\" | Interval and complement " ..
Line 211: Line 211:
local note = frame.args["note"]
local note = frame.args["note"]
local title = frame.args["title"]
local title = frame.args["title"]
local apx_d = " (approximated directly)"
local apx_v = " (approximated with val)"
if title == nil or #title == 0 then
if title == nil or #title == 0 then
title = string.format("%d-odd-limit interval mappings in " .. steps .. "edo", limit)
title = string.format("%d-odd-limit interval mappings in " .. steps .. "edo", limit)
end
end
local subgroup = table_filter(PRIME_LIST, limit)
local subgroup = table_filter(PRIME_LIST, limit)
local monzo_list = odd_limit_monzo_list_gen(limit)
local monzo_list = odd_limit_monzo_list_gen(limit)
Line 232: Line 236:
end
end
end
end
out_str = out_str .. approx(steps, subgroup, monzo_list, title)
out_str = out_str .. approx(steps, subgroup, monzo_list, title, apx_d, apx_v)
return out_str
return out_str
end
end


return p;
return p;