Module:Sandbox/Arccosecant/MathTagsTest

local mm = require('Module:Math') local p = {}

function p.factorial(num) out = 1 while num > 1 do		out = out * num num = num - 1 end return out end

function p.getN(n) if n == 0 then return "\\frac{1}{x}" end tn = 2 * n	num = p.factorial(tn) den = ((2 ^ tn) * (p.factorial(n) ^ 2) * (tn+1)) gcf = mm._gcd(num,den) return "\\frac{" .. string.format("%.0f",num/gcf) .. "}{" .. string.format("%.0f",den/gcf) .. "x^{" .. (tn+1) .. "}}" end

function p.getNe(n) if n == 0 then return "\\frac{1}{x}" end tn = 2 * n	return "\\frac{" .. tn .. "!}{4^{" .. n .. "}(" .. n .. "!)^2" .. (tn+1) .. "x^{" .. (tn+1) .. "}}" end

function p.getSeriesRight(m) n = 1 s = p.getNe(0) while n <= m do s = s .. " + " .. p.getNe(n) n = n + 1 end return s end

function p.getSeriesLeft(m) return "\\sum\\limits_{n=0}^{" .. m .. "} =" end

function p.getSeries(m) return p.getSeriesLeft(m) .. p.getSeriesRight(m) end

function p.term(frame) return p.getN(mm._cleanNumber(frame.args[1])) end

function p.termE(frame) return p.getNe(mm._cleanNumber(frame.args[1])) end

function p.series(frame) return p.getSeries(mm._cleanNumber(frame.args[1])) end

function p.renderMath(frame) return frame:extensionTag("math",frame.args[1],{}) end

return p