Module:Powharmonic series: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 5: Line 5:
     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 out_str = "{| class=\"wikitable center-all\"\n"
     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%;\" | " .. string.format("Intervals of the %s-Powharmonic series\n", expo)
    .. "|-\n"
    .. "|-\n"
Line 18: Line 18:
     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
         out_str = out_str
         result = result
             .. "|-\n"
             .. "|-\n"
             .. "| ".. string.format("%s", i)
             .. "| ".. string.format("%s", i)
Line 30: Line 30:
     end
     end


     out_str = out_str .. "|}"
     result = result .. "|}"
      
      
     local debugg = yesno(frame.args["debug"])
     local debugg = yesno(frame.args["debug"])
     return frame:preprocess(debugg == true and "<pre>" .. out_str .. "</pre>" or out_str)
     return frame:preprocess(debugg == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
end


return p
return p