Normal forms: Difference between revisions
Wikispaces>genewardsmith **Imported revision 142172981 - Original comment: ** |
Wikispaces>genewardsmith **Imported revision 143888077 - Original comment: ** |
||
| Line 1: | Line 1: | ||
<h2>IMPORTED REVISION FROM WIKISPACES</h2> | <h2>IMPORTED REVISION FROM WIKISPACES</h2> | ||
This is an imported revision from Wikispaces. The revision metadata is included below for reference:<br> | This is an imported revision from Wikispaces. The revision metadata is included below for reference:<br> | ||
: This revision was by author [[User:genewardsmith|genewardsmith]] and made on <tt>2010-05- | : This revision was by author [[User:genewardsmith|genewardsmith]] and made on <tt>2010-05-22 03:16:05 UTC</tt>.<br> | ||
: The original revision id was <tt> | : The original revision id was <tt>143888077</tt>.<br> | ||
: The revision comment was: <tt></tt><br> | : The revision comment was: <tt></tt><br> | ||
The revision contents are below, presented both in the original Wikispaces Wikitext format, and in HTML exactly as Wikispaces rendered it.<br> | The revision contents are below, presented both in the original Wikispaces Wikitext format, and in HTML exactly as Wikispaces rendered it.<br> | ||
| Line 67: | Line 67: | ||
The point of steps three and four is that now the vals on the list correspond to a list of generators which are all positive (written additively) or equivalently greater than 1 (written multiplicatively.) Just as a normal comma list can be used to classify an abstract regular temperament, so can a normal val list. The val list is what on [[Graham Breed]]'s [[http://x31eq.com/temper/|web site]] is called a "mapping", put into a canonical form. | The point of steps three and four is that now the vals on the list correspond to a list of generators which are all positive (written additively) or equivalently greater than 1 (written multiplicatively.) Just as a normal comma list can be used to classify an abstract regular temperament, so can a normal val list. The val list is what on [[Graham Breed]]'s [[http://x31eq.com/temper/|web site]] is called a "mapping", put into a canonical form. | ||
==Maple code== | |||
Below is Maple code for finding the normal interval and val list, given an interval list or a val list. | |||
with(padic, ordp): | |||
with(LinearAlgebra): | |||
log2 := proc(x) evalf(ln(x)/ln(2)) end: | |||
pril := proc(n) | |||
# log2 of first n primes | |||
local i, u; | |||
u := NULL; | |||
for i from 1 to n do | |||
u := u,log2(ithprime(i)) od; | |||
[u] end: | |||
revlist := proc(l) | |||
# reverse of list | |||
local i, v, e; | |||
e := nops(l); | |||
for i from 1 to e do | |||
v[i] := l[e-i+1] od; | |||
convert(convert(v,array),list) end: | |||
plim := proc(q) | |||
# prime limit of rational number q | |||
local r, i, p; | |||
r := 1; | |||
i := 0; | |||
while not (r=q) do | |||
i := i+1; | |||
p := ithprime(i); | |||
r := r*p^ordp(q, p) od; | |||
i end: | |||
rat2monz := proc(q, n) | |||
# converts rational number q to monzo of length n | |||
local v, i; | |||
for i from 1 to n do | |||
v[i] := ordp(q, ithprime(i)) od; | |||
convert(convert(v, array), list) end: | |||
monz2rat := proc(m) | |||
# converts monzo to rational number | |||
local i, t; | |||
t := 1; | |||
for i from 1 to nops(m) do | |||
t := t * ithprime(i)^m[i] od; | |||
t end: | |||
herm := proc(l) | |||
# hermite normal form of listlist l | |||
local M; | |||
M := Matrix(l); | |||
convert(convert(HermiteForm[Z](M), array), listlist) end: | |||
nori := proc(l) | |||
# normal interval list from list of intervals l | |||
local i, p, u, v, w; | |||
p := 1; | |||
for i from 1 to nops(l) do | |||
p := max(p, plim(l[i])) od; | |||
u := []; | |||
for i from 1 to nops(l) do | |||
u := [op(u), revlist(rat2monz(l[i], p))] od; | |||
v := herm(u); | |||
for i from 1 to nops(l) do | |||
u := revlist(v[i]); | |||
u := monz2rat(u); | |||
w[i] := u od; | |||
u := []; | |||
for i from 1 to nops(l) do | |||
v := w[i]; | |||
if v<1 then v:=1/v fi; | |||
if not v=1 then u := [op(u), v] fi od; | |||
revlist(u) end: | |||
norv := proc(l) | |||
# normal val list from list of vals l | |||
local M, N, u, v, i, j, a; | |||
u := herm(l); | |||
j := Rank(Matrix(u)); | |||
v := NULL: | |||
for i from 1 to j do | |||
v := v,u[i] od; | |||
v := [v]; | |||
M := Matrix(v); | |||
N := SubMatrix(M, 1..j, 1..j); | |||
N := N^(-1); | |||
a := Vector[row](pril(j)); | |||
a := a.N; | |||
u := NULL; | |||
for i from 1 to j do | |||
if a[i] < 0 then u := u,-v[i] fi; | |||
if a[i] >= 0 then u := u,v[i] fi od; | |||
[u] end: | |||
</pre></div> | </pre></div> | ||
<h4>Original HTML content:</h4> | <h4>Original HTML content:</h4> | ||
| Line 129: | Line 227: | ||
[1 log2(3) log2(5) ... log2(p)]. If the ith entry in the result is negative, multiply the corresponding val by -1. Return the result as the normalized val list.<br /> | [1 log2(3) log2(5) ... log2(p)]. If the ith entry in the result is negative, multiply the corresponding val by -1. Return the result as the normalized val list.<br /> | ||
<br /> | <br /> | ||
The point of steps three and four is that now the vals on the list correspond to a list of generators which are all positive (written additively) or equivalently greater than 1 (written multiplicatively.) Just as a normal comma list can be used to classify an abstract regular temperament, so can a normal val list. The val list is what on <a class="wiki_link" href="/Graham%20Breed">Graham Breed</a>'s <a class="wiki_link_ext" href="http://x31eq.com/temper/" rel="nofollow">web site</a> is called a &quot;mapping&quot;, put into a canonical form.</body></html></pre></div> | The point of steps three and four is that now the vals on the list correspond to a list of generators which are all positive (written additively) or equivalently greater than 1 (written multiplicatively.) Just as a normal comma list can be used to classify an abstract regular temperament, so can a normal val list. The val list is what on <a class="wiki_link" href="/Graham%20Breed">Graham Breed</a>'s <a class="wiki_link_ext" href="http://x31eq.com/temper/" rel="nofollow">web site</a> is called a &quot;mapping&quot;, put into a canonical form.<br /> | ||
<br /> | |||
<!-- ws:start:WikiTextHeadingRule:4:&lt;h2&gt; --><h2 id="toc2"><a name="x-Maple code"></a><!-- ws:end:WikiTextHeadingRule:4 -->Maple code</h2> | |||
Below is Maple code for finding the normal interval and val list, given an interval list or a val list.<br /> | |||
<br /> | |||
with(padic, ordp):<br /> | |||
with(LinearAlgebra):<br /> | |||
<br /> | |||
log2 := proc(x) evalf(ln(x)/ln(2)) end:<br /> | |||
<br /> | |||
pril := proc(n)<br /> | |||
# log2 of first n primes<br /> | |||
local i, u;<br /> | |||
u := NULL;<br /> | |||
for i from 1 to n do<br /> | |||
u := u,log2(ithprime(i)) od;<br /> | |||
[u] end:<br /> | |||
<br /> | |||
revlist := proc(l)<br /> | |||
# reverse of list<br /> | |||
local i, v, e;<br /> | |||
e := nops(l);<br /> | |||
for i from 1 to e do<br /> | |||
v[i] := l[e-i+1] od;<br /> | |||
convert(convert(v,array),list) end:<br /> | |||
<br /> | |||
plim := proc(q)<br /> | |||
# prime limit of rational number q<br /> | |||
local r, i, p;<br /> | |||
r := 1;<br /> | |||
i := 0;<br /> | |||
while not (r=q) do<br /> | |||
i := i+1;<br /> | |||
p := ithprime(i);<br /> | |||
r := r*p^ordp(q, p) od;<br /> | |||
i end:<br /> | |||
<br /> | |||
rat2monz := proc(q, n)<br /> | |||
# converts rational number q to monzo of length n<br /> | |||
local v, i;<br /> | |||
for i from 1 to n do<br /> | |||
v[i] := ordp(q, ithprime(i)) od;<br /> | |||
convert(convert(v, array), list) end:<br /> | |||
<br /> | |||
monz2rat := proc(m)<br /> | |||
# converts monzo to rational number<br /> | |||
local i, t;<br /> | |||
t := 1;<br /> | |||
for i from 1 to nops(m) do<br /> | |||
t := t * ithprime(i)^m[i] od;<br /> | |||
t end:<br /> | |||
<br /> | |||
herm := proc(l)<br /> | |||
# hermite normal form of listlist l<br /> | |||
local M;<br /> | |||
M := Matrix(l);<br /> | |||
convert(convert(HermiteForm[Z](M), array), listlist) end:<br /> | |||
<br /> | |||
nori := proc(l)<br /> | |||
# normal interval list from list of intervals l<br /> | |||
local i, p, u, v, w;<br /> | |||
p := 1;<br /> | |||
for i from 1 to nops(l) do<br /> | |||
p := max(p, plim(l[i])) od;<br /> | |||
u := [];<br /> | |||
for i from 1 to nops(l) do<br /> | |||
u := [op(u), revlist(rat2monz(l[i], p))] od;<br /> | |||
v := herm(u);<br /> | |||
for i from 1 to nops(l) do<br /> | |||
u := revlist(v[i]);<br /> | |||
u := monz2rat(u);<br /> | |||
w[i] := u od;<br /> | |||
u := [];<br /> | |||
for i from 1 to nops(l) do<br /> | |||
v := w[i];<br /> | |||
if v&lt;1 then v:=1/v fi;<br /> | |||
if not v=1 then u := [op(u), v] fi od;<br /> | |||
revlist(u) end:<br /> | |||
<br /> | |||
norv := proc(l)<br /> | |||
# normal val list from list of vals l<br /> | |||
local M, N, u, v, i, j, a;<br /> | |||
u := herm(l);<br /> | |||
j := Rank(Matrix(u));<br /> | |||
v := NULL:<br /> | |||
for i from 1 to j do<br /> | |||
v := v,u[i] od;<br /> | |||
v := [v];<br /> | |||
M := Matrix(v);<br /> | |||
N := SubMatrix(M, 1..j, 1..j);<br /> | |||
N := N^(-1);<br /> | |||
a := Vector[row](pril(j));<br /> | |||
a := a.N;<br /> | |||
u := NULL;<br /> | |||
for i from 1 to j do<br /> | |||
if a[i] &lt; 0 then u := u,-v[i] fi;<br /> | |||
if a[i] &gt;= 0 then u := u,v[i] fi od;<br /> | |||
[u] end:</body></html></pre></div> | |||