Module:Q-odd-limit intervals: Difference between revisions
Created page with "bit32 = require( 'bit32' ) local p = {} local PRIME_LIST = {2, 3, 5, 7, 11, 13, 17, 19} local function get_monzo_list (limit) local monzo_list = {} if limit >= 3 then t..." |
We've noted that relative error is interesting too |
||
| Line 153: | Line 153: | ||
ratiocomp = string.format ("%d/%d, %d/%d", error_list[i].ratio.num, error_list[i].ratio.den, 2*error_list[i].ratio.den, error_list[i].ratio.num) | ratiocomp = string.format ("%d/%d, %d/%d", error_list[i].ratio.num, error_list[i].ratio.den, 2*error_list[i].ratio.den, error_list[i].ratio.num) | ||
error_abs = string.format ("%.3f", error_list[i].error_abs) | error_abs = string.format ("%.3f", error_list[i].error_abs) | ||
error_rel = string.format ("%.1f", error_list[i].error_rel) | |||
if bit32.band (error_list[i].ratio.den, error_list[i].ratio.den - 1) == 0 and is_in (error_list[i].ratio.num, subgroup) then -- check power of 2 for den and prime for num | if bit32.band (error_list[i].ratio.den, error_list[i].ratio.den - 1) == 0 and is_in (error_list[i].ratio.num, subgroup) then -- check power of 2 for den and prime for num | ||
ratiocomp = "'''" .. ratiocomp .. "'''" | ratiocomp = "'''" .. ratiocomp .. "'''" | ||
error_abs = "'''" .. error_abs .. "'''" | error_abs = "'''" .. error_abs .. "'''" | ||
error_rel = "'''" .. error_rel .. "''" | |||
end if error_list[i].error_rel > 50 then | end if error_list[i].error_rel > 50 then | ||
ratiocomp = "''" .. ratiocomp .. "''" | ratiocomp = "''" .. ratiocomp .. "''" | ||
error_abs = "''" .. error_abs .. "''" | error_abs = "''" .. error_abs .. "''" | ||
error_rel = "''" .. error_rel .. "''" | |||
end | end | ||
t_body[i] = string.format ("|-\n| %s\n| %s", ratiocomp, error_abs) | t_body[i] = string.format ("|-\n| %s\n| %s\n| %s", ratiocomp, error_abs, error_rel) | ||
end | end | ||
| Line 168: | Line 171: | ||
"! Interval, complement\n" .. | "! Interval, complement\n" .. | ||
"! Error (abs, [[Cent|¢]])\n" .. | "! Error (abs, [[Cent|¢]])\n" .. | ||
"! Error (rel, [[Relative cent|%]]\n" .. | |||
table.concat (t_body, "\n") .. | table.concat (t_body, "\n") .. | ||
"\n|}" | "\n|}" | ||
| Line 182: | Line 186: | ||
local title = frame.args['title'] | local title = frame.args['title'] | ||
if title == nil or #title == 0 then | if title == nil or #title == 0 then | ||
title = string.format (" | title = string.format ("%d-odd-limit intervals by patent val mapping", limit) | ||
end | end | ||
local subgroup = table_filter (PRIME_LIST, limit) | local subgroup = table_filter (PRIME_LIST, limit) | ||