Module:Temperament data: Difference between revisions
ArrowHead294 (talk | contribs) No edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (15 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | |||
local rat = require("Module:Rational") | local rat = require("Module:Rational") | ||
local u = require("Module:Utils") | local u = require("Module:Utils") | ||
local function gcd(a,b) | local function gcd(a, b) | ||
if type(a) == "number" and type(b) == "number" and a == math.floor(a) and b == math.floor(b) then | if type(a) == "number" and type(b) == "number" and a == math.floor(a) and b == math.floor(b) then | ||
if b == 0 then | if b == 0 then | ||
| Line 66: | Line 67: | ||
local function matinv(a) | local function matinv(a) | ||
local | local xn = scalarmatmul(a, 1e-7) | ||
for i = 1, | |||
for i = 1, 75 do | |||
xn = matsub(scalarmatmul(xn, 2), matmul(xn, matmul(a, xn))) | |||
end | end | ||
return xn | return xn | ||
end | end | ||
| Line 255: | Line 245: | ||
comma_matrix = rat_list_to_matrix(subgroup, comma_matrix) | comma_matrix = rat_list_to_matrix(subgroup, comma_matrix) | ||
local unparsed_gens = mysplit(frame.args["generators"], ",") | local unparsed_gens = mysplit(frame.args["generators"], ",") | ||
local generators = mysplit(frame.args[ | local generators = mysplit(frame.args["generators"], ",") | ||
for i = 1, #generators do | for i = 1, #generators do | ||
generators[i] = rat.parse(generators[i]) | generators[i] = rat.parse(generators[i]) | ||