Module:Powharmonic series: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local yesno = require("Module:Yesno") | |||
function p.powharmonic(frame) | function p.powharmonic(frame) | ||
local n = tonumber(frame.args["n"]) | local n = tonumber(frame.args["n"]) | ||
local expo = tonumber(frame.args["expo"]) | local expo = tonumber(frame.args["expo"]) | ||
local | local result = "{| class=\"wikitable center-all\"\n" | ||
.. "|+ style=\"font-size: 105%;\" | " .. string.format("Intervals of the %s-Powharmonic series\n", expo) | .. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Intervals of the %s-Powharmonic series\n", expo) | ||
.. "|-\n" | .. "|-\n" | ||
.. "! rowspan=\"2\" | Pitch !! colspan=\"2\" | Frequency multiplier !! colspan=\"3\" | Pitch\n" | .. "! rowspan=\"2\" | Pitch !! colspan=\"2\" | Frequency multiplier !! colspan=\"3\" | Pitch\n" | ||
| Line 17: | Line 19: | ||
for i = 1, n do | for i = 1, n do | ||
p_current = 1200 * math.log(i) / math.log(2) * expo | p_current = 1200 * math.log(i) / math.log(2) * expo | ||
result = result | |||
.. "|-\n" | .. "|-\n" | ||
.. "| ".. string.format("%s", i) | .. "| ".. string.format("%s", i) | ||
| Line 29: | Line 31: | ||
end | end | ||
result = result .. "|}" | |||
return | |||
-- Debugger option | |||
local debugg = yesno(frame.args["debug"]) | |||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||