Module:JI ratio finder: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Fixed error calculation; error should be how far the target cent value is from the JI ratio's cent value
Ganaram inukshuk (talk | contribs)
m Clarified int limit for candidate ratio search (it's a denominator limit, not an int limit)
Line 24: Line 24:
end
end


-- Finds candidate ratios up to a cent value and up to an integer limit
-- Finds candidate ratios up to a cent value and up to an integer limit that
-- Ratios found this way will range from 0 cents to the given cent value
-- applies to the denominator only.
-- These ratios should then be filtered as needed
-- Ratios found this way will range from 0 cents to the given cent value.
function p.find_candidate_ratios(cents, int_limit)
-- These ratios should then be filtered as needed.
function p.find_candidate_ratios(cents, denominator_limit)
local cents = cents or 1200
local cents = cents or 1200
local int_limit = int_limit or 99
local denominator_limit = denominator_limit or 99
local candidate_ratios = {}
local candidate_ratios = {}
for i = 1, int_limit do
for i = 1, denominator_limit do
local denominator = i
local denominator = i
local numerator = i
local numerator = i
Line 160: Line 161:
end
end


-- Finds approximated JI ratios for a cent value for a prime and odd limit
-- Finds approximated JI ratios for a cent value for a prime and denominator limit
-- Meant to find ratios within the range of a single cent value
-- Meant to find ratios within the range of a single cent value
-- TODO: use integer limit instead of odd limit
-- TODO: use integer limit instead of odd limit