Module:Uniform map: Difference between revisions

m Fix error message
m Fixing more bugs...
Line 73: Line 73:
-- Generate table of p-limit uniform maps between min and max, for use with print_table
-- Generate table of p-limit uniform maps between min and max, for use with print_table
function make_table(p, min, max)
function make_table(p, min, max)
if u.index_of(primes, p) == nil then
maptable = {}                          -- Reset table
return 'Error: ' .. p .. ' is not prime!'
for i=1, u.index_of(primes, p) do
else
map[i] = 0                        -- Reset to p-limit null map
maptable = {}                          -- Reset table
lower[i] = 0
for i=1, u.index_of(primes, p) do
upper[i] = 0
map[i] = 0                        -- Reset to p-limit null map
end
lower[i] = 0
map = simple_map(min, p)              -- Set p-limit map for minimum size
upper[i] = 0
lb = lowerbound(map)                  -- Update minimum size for new map
end
ub = upperbound(map)                  -- Update maximum size for new map
map = simple_map(min, p)              -- Set p-limit map for minimum size
row = {'Min. size', 'Max. size', '[[Wart notation]]'}
lb = lowerbound(map)                  -- Update minimum size for new map
for i=1, #map do
ub = upperbound(map)                  -- Update maximum size for new map
table.insert(row, primes[i])
row = {'Min. size', 'Max. size', '[[Wart notation]]'}
end
for i=1, #map do
table.insert(maptable, row)
table.insert(row, primes[i])
while lb < max do
row = {string.format("%.4f", lb), string.format("%.4f", ub), wart(map)}
for j=1, #map do
table.insert(row, map[j])
end
end
table.insert(maptable, row)
table.insert(maptable, row)
while lb < max do
map[pbi] = map[pbi] + 1
row = {string.format("%.4f", lb), string.format("%.4f", ub), wart(map)}
lb = lowerbound(map)
for j=1, #map do
ub = upperbound(map)
table.insert(row, map[j])
end
table.insert(maptable, row)
map[pbi] = map[pbi] + 1
lb = lowerbound(map)
ub = upperbound(map)
end
return maptable
end
end
return maptable
end
end


Line 112: Line 108:
function p._print_table(p, min, max)
function p._print_table(p, min, max)
if u.index_of(primes, u.eval_num_arg(p, 5)) == nil then
if u.index_of(primes, u.eval_num_arg(p, 5)) == nil then
return 'Error: ' .. p .. ' is not prime!'
p = 5                              -- Default to 5-limit
end
end
luatable = make_table(p, u.eval_num_arg(min, 11.5), u.eval_num_arg(max, 12.5))
luatable = make_table(p, u.eval_num_arg(min, 11.5), u.eval_num_arg(max, 12.5))