Module:Q-odd-limit intervals: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
experiment with a larger limit |
||
| (10 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | |||
bit32 = require("bit32") | bit32 = require("bit32") | ||
ET = require("Module:ET") | ET = require("Module:ET") | ||
getArgs = require("Module:Arguments").getArgs | |||
limits = require("Module:Limits") | limits = require("Module:Limits") | ||
utils = require("Module:Utils") | |||
yesno = require("Module:Yesno") | |||
local PRIME_LIST = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61} | local PRIME_LIST = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61} | ||
| Line 110: | Line 111: | ||
} | } | ||
end | end | ||
table.sort(error_list, function(a, b) return a.error_abs_val < b.error_abs_val end) | |||
table.sort(error_list, function(a, b) | |||
return a.error_abs_val < b.error_abs_val | |||
end) | |||
return error_list | return error_list | ||
end | end | ||
| Line 120: | Line 125: | ||
local errlist_val = {} | local errlist_val = {} | ||
local val = {} | local val = {} | ||
local bgclr | local bgclr, result | ||
for i = 1, #subgroup do | for i = 1, #subgroup do | ||
| Line 199: | Line 204: | ||
local t_head_1 = "|-\n" | local t_head_1 = "|-\n" | ||
.. "! class=\"unsortable\" | Interval and complement" | .. "! class=\"unsortable\" | Interval and complement" | ||
.. " !! Error (abs, [[Cent| | .. " !! Error (abs, [[Cent|¢]])" | ||
.. " !! Error (rel, [[Relative cent|%]])\n" | .. " !! Error (rel, [[Relative cent|%]])\n" | ||
local t_foot = "\n|}" | local t_foot = "\n|}" | ||
| Line 212: | Line 217: | ||
if approx_t == "direct" then | if approx_t == "direct" then | ||
result = t_head_0 .. t_title .. tag_direct .. "\n" .. t_head_1 .. table.concat(t_body_direct, "\n") .. t_foot | |||
elseif approx_t == "val" then | elseif approx_t == "val" then | ||
result = t_head_0 .. t_title .. tag_val .. "\n" .. t_head_1 .. table.concat(t_body_val, "\n") .. t_foot | |||
else | else | ||
result = "" | |||
end | end | ||
return result | |||
end | end | ||
function p.q_odd_limit_intervals(frame) | function p.q_odd_limit_intervals(frame) | ||
local args = getArgs(frame) | |||
local steps = tonumber(frame.args["steps"]) | local steps = tonumber(frame.args["steps"]) | ||
local limit = math.max(tonumber(frame.args["limit"]), 2) | local limit = math.max(tonumber(frame.args["limit"]), 2) | ||
local constcy = limits.consistency_limit(ET.parse(steps .. "edo"), false, | local constcy = limits.consistency_limit(ET.parse(steps .. "edo"), false, 63) | ||
local | local wtext = yesno(frame.args["wtext"] or args["wtext"]) | ||
local note = frame.args["note"] | local note = frame.args["note"] | ||
local title = frame.args["title"] | local title = frame.args["title"] | ||
| Line 273: | Line 277: | ||
end | end | ||
if wtext then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||