Module:JI ratios: Difference between revisions
merge some helper functions; adopt is_within_int_limit function; comments |
m comments |
||
| Line 9: | Line 9: | ||
-- TODO | -- TODO | ||
-- - Move filtering functions to separate module? | -- - Move filtering functions to separate module? | ||
-- Template for handling multiple entry of JI ratios into a template, and for | -- Template for handling multiple entry of JI ratios into a template, and for | ||
| Line 79: | Line 78: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- Int limit search finds ratios from 1/1 to an equave | -- Int limit search finds ratios from 1/1 to an equave, where each ratio's | ||
-- numerator or denominator don't exceed the int limit. | |||
function p.search_by_int_limit(equave, int_limit) | function p.search_by_int_limit(equave, int_limit) | ||
local equave = equave or rat.new(2,1) -- Defualt equave is 2/1. | local equave = equave or rat.new(2,1) -- Defualt equave is 2/1. | ||
| Line 117: | Line 117: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- Prime limit search finds ratios with prime factors that don't exceed some | |||
-- prime limit. | |||
-- Upper bounds for searching is the equave and int limit. | |||
function p.search_by_prime_limit(equave, int_limit, prime_limit) | function p.search_by_prime_limit(equave, int_limit, prime_limit) | ||
local equave = equave or rat.new(2,1) -- Defualt equave is 2/1. | local equave = equave or rat.new(2,1) -- Defualt equave is 2/1. | ||
| Line 146: | Line 149: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- Subgroup search find ratios that are products of at least two (not | |||
-- necessarily unique) elements from the subgroup. EG, for 2.3.7, 2/1, 3/2, 7/4, | |||
-- and 7/6 are within the subgroup, but not 5/4 because there's no 5. | |||
-- Upper bounds for searching is the equave and int limit. | |||
function p.search_by_subgroup(equave, int_limit, subgroup) | function p.search_by_subgroup(equave, int_limit, subgroup) | ||
local equave = equave or rat.new(2,1) -- Defualt equave is 2/1. | local equave = equave or rat.new(2,1) -- Defualt equave is 2/1. | ||