Normal forms: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
+intro and place normal val list above normal interval list cuz it's simpler
Rework normal val list
Line 22: Line 22:


== Normal val list ==
== Normal val list ==
=== Hermite normal form ===
=== Canonical form ===
If L is a list of ''n'' vals, we may write it as an ''n''×''m'' matrix, where the rows of the matrix are the vals, and ''m'' = π (''p''), where ''p'' is the prime limit. To get the normal val list, we do the following:
If A is a list of ''n'' vals, we may write it as an ''n''×''m'' matrix, where the rows of the matrix are the vals, and ''m'' = π (''p''), where ''p'' is the prime limit. To get the '''canonical form''', we do the following:
 
# Defactor it.
# Hermite reduce it.
# Throw away all rows which consist of nothing but zeros, resulting in a ''k''×''m'' matrix.
 
=== Positive generator form ===
To obtain the '''positive generator form''', we find the [[Wikipedia: Moore–Penrose pseudoinverse|Moore–Penrose pseudoinverse]] of the ''k''×''m'' matrix, and multiply this from the left by the row vector 1200·[1 log<sub>2</sub>3 log<sub>2</sub>5 … log<sub>2</sub>''p'']. If the ''i''-th entry in the result is negative, multiply the corresponding val by -1. Return the result.
 
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).


# Hermite reduce the matrix for L
The "mapping" (though not the "Map to lattice") listed on temperament pages of this wiki are in this form; an example would be [{{val| 1 0 -4 -13 }}, {{val| 0 1 4 10 }}], the mapping for septimal meantone. Using this as input, the generators are 1199.25¢, 1899.45¢ (tempered 2/1, tempered 3/1).
# Throw away all rows which consist of nothing but zeros, resulting in a ''k''×''m'' matrix
# Find the [[Wikipedia: Moore–Penrose pseudoinverse|Moore–Penrose pseudoinverse]] of the ''k''×''m'' matrix, and multiply this from the left by the row vector 1200·[1 log<sub>2</sub>3 log<sub>2</sub>5 … log<sub>2</sub>''p'']. If the ''i''-th entry in the result is negative, multiply the corresponding val by -1. Return the result.  


The point of steps two and three 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 "mapping" (though not the "Map to lattice") listed on temperament pages of this wiki are all normal val lists; an example would be [{{val| 1 0 -4 -13 }}, {{val| 0 1 4 10 }}], the normal val list for septimal meantone. Using this as input, the output is 1199.25¢, 1899.45¢ (tempered 2/1, tempered 3/1).
=== Equave-reduced generator form ===
The '''equave-reduced generator form''' is similar to the positive generator form, but the matrix is further normalized such that each generator is reduced by the formal prime represented by the first column of the matrix.  


=== Canonical form ===
=== Minimal generator form ===
{{See also| Canonical form }}
The '''minimal generator form''' (or '''mingen form''') is a form specific to rank-2 temperaments, where the matrix is normalized such that the generator is positive and no greater than half the period.


The canonical form of the val list requires that the normal val list be defactored, therefore uniquely characterizing each temperament.  
[[Graham Breed]]'s [http://x31eq.com/temper/ temperament finder] uses this form for all rank-2 temperaments.  


== Normal interval list ==
== Normal interval list ==
Line 61: Line 69:
The canonical form of the comma list, however, requires that the normal comma sequence be defactored. There is only one such form of any temperament. For example, both [27/25, 36/35] and [27/25, 49/48] are normal, and they both characterize Beep. But the latter is enfactored, so the former is Beep's canonical form.
The canonical form of the comma list, however, requires that the normal comma sequence be defactored. There is only one such form of any temperament. For example, both [27/25, 36/35] and [27/25, 49/48] are normal, and they both characterize Beep. But the latter is enfactored, so the former is Beep's canonical form.


=== Tenney-minimal form ===
=== Minimal ratio form ===
In each temperament page on this wiki, however, the "comma lists" are not normal interval lists as defined above. Instead, it shows ratio-wise the simplest comma sequence sufficient to define the temperament, which may be called the Tenney-minimal form.
In each temperament page on this wiki, however, the "comma lists" are not normal interval lists as defined above. Instead, it shows ratio-wise the simplest comma sequence sufficient to define the temperament, which may be called the Tenney-minimal form.



Revision as of 10:26, 2 October 2021

Since a regular temperament can be represented by multiple equivalent val lists (aka mappings) or monzo lists (or comma lists), we have developed normal lists in order to uniquely identify each temperament.

Introduction to Hermite normal form

An integral matrix is a matrix whose entries are all integers. An important normalized form for integral matrices is Hermite normal form, and by using Hermite normal form we may define normalized forms of lists of intervals or monzos (aka comma lists) or lists of vals, the normal interval/monzo list and the normal val list.

There are slightly different definitions of Hermite normal form in use, and if you are using a computer program to compute it, you should take care that the same normal monzo or val list is finally achieved. The definition used by the Wikipedia article on Hermite form, probably the most standard, works as follows.

An n by m integral matrix H is in Hermite normal form if when we define a function F such that F (i) = 0 if all of the entries in the i-th column of H are 0, and otherwise F (i) is equal to the row number of the first nonzero entry in the i-th column, checking up from the bottom, i.e. from the n-th row, we have

  1. If i > j, H[i, j] = 0 (H is upper triangular.)
  2. F (i) is a function of the column number i.
  3. F (i) = 0 if and only if all of the entries in the i-th column are 0.
  4. F is an increasing function of the column number i, and becomes strictly increasing after F (i) becomes positive.
  5. If k > F (i) > 0 then H[k, i] = 0; that is, F (i) is the row of the first nonzero entry in the i-th column, counting up from the bottom.
  6. If F (i) > 0 then H[F (i), i] > 0; that is, the first nonzero entry in the i-th column, counting up from the bottom, is positive.
  7. If F (i) > 0 and i < j then H[F (i), i] > H[F (i), j] ≥ 0; that is, the first nonzero entry in the i-th column, counting up from the bottom, is greater than any of the rest along that row, which however are all non-negative.

There is some redundancy in the statement of these conditions, but that does no harm.

Normal val list

Canonical form

If A is a list of n vals, we may write it as an n×m matrix, where the rows of the matrix are the vals, and m = π (p), where p is the prime limit. To get the canonical form, we do the following:

  1. Defactor it.
  2. Hermite reduce it.
  3. Throw away all rows which consist of nothing but zeros, resulting in a k×m matrix.

Positive generator form

To obtain the positive generator form, we find the Moore–Penrose pseudoinverse of the k×m matrix, and multiply this from the left by the row vector 1200·[1 log23 log25 … log2p]. If the i-th entry in the result is negative, multiply the corresponding val by -1. Return the result.

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).

The "mapping" (though not the "Map to lattice") listed on temperament pages of this wiki are in this form; an example would be [1 0 -4 -13], 0 1 4 10]], the mapping for septimal meantone. Using this as input, the generators are 1199.25¢, 1899.45¢ (tempered 2/1, tempered 3/1).

Equave-reduced generator form

The equave-reduced generator form is similar to the positive generator form, but the matrix is further normalized such that each generator is reduced by the formal prime represented by the first column of the matrix.

Minimal generator form

The minimal generator form (or mingen form) is a form specific to rank-2 temperaments, where the matrix is normalized such that the generator is positive and no greater than half the period.

Graham Breed's temperament finder uses this form for all rank-2 temperaments.

Normal interval list

Hermite normal form

Given a list of p-limit intervals, we can convert it to a normal list by the following procedure:

  1. Convert the list to a list of monzos
  2. Reverse the order of the elements of the monzos
  3. Form a matrix whose rows are these reversed monzos
  4. Hermite reduce this matrix to Hermite normal form
  5. Reverse (once again) the entries in each row of the Hermite normal form matrix, and use these re-reversed rows to form a new list of monzos
  6. Discard all of the all-zero monzos, corresponding to the unison 1/1
  7. Reverse the whole list (not the entries) of the remaining monzos
  8. Convert this list back to a list of p-limit rational numbers
  9. For any number q < 1 on this list, replace q with 1/q

The result is a normal interval list. The set of elements of the original list generates a finitely generated free abelian subgroup of the positive rationals under multiplication, and therefore of any p-limit group it lives inside. The normalized list contains a minimal set of generators, each greater than zero, in an ordering of nondecreasing prime limit which is parsimonious in its use of higher limits. For example, if we normalize [81/80, 126/125] we obtain [81/80, 59049/57344]. The first interval is 5-limit, which is as small as possible. The second is 7-limit, which must be the case because the group these two generate is 7-limit. However, it uses only 2, 3 and 7 in its prime factorization, parsimoniously rejecting 5 as the next highest prime limit. Because abstract regular temperaments, where the prime mappings are known but not the specific tuning of the generators, are fully characterized by their kernel, the group of intervals they map to the unison, they can also be characterized by the regular interval list of a set of generators (called commas or unison vectors) for the kernel. The above normal interval list, for example, characterizes septimal meantone, defining the normal comma sequence of septimal meantone.

There is only one normal comma sequence that characterizes septimal meantone. But sometimes a temperament can be characterized by multiple normal comma sequences due to enfactoring, leading to the following section of canonical form.

Normal interval lists can also be used to characterize the just intonation subgroups on which subgroup temperaments are defined and using which subgroup scales may be constructed. On the pages chromatic pairs, subgroup temperaments and just intonation subgroups can be found many examples; the subgroup lists are given in a form where generators of the subgroup are separated by periods so as to flag the fact that the list defines a subgroup. An example would be the Barbados subgroup, 2.3.13/5.

Canonical form

The canonical form of the comma list, however, requires that the normal comma sequence be defactored. There is only one such form of any temperament. For example, both [27/25, 36/35] and [27/25, 49/48] are normal, and they both characterize Beep. But the latter is enfactored, so the former is Beep's canonical form.

Minimal ratio form

In each temperament page on this wiki, however, the "comma lists" are not normal interval lists as defined above. Instead, it shows ratio-wise the simplest comma sequence sufficient to define the temperament, which may be called the Tenney-minimal form.

Maple code

Below is Maple code for finding the normal interval and val list, given an interval list or a val list.

Code
log2 := proc(x) evalf(ln(x) / ln(2)) end:

# transpose of listlist w
transpos := proc(w)
    local u;
    u := Matrix(w);
    u := LinearAlgebra[Transpose](u);
    convert(u, listlist)
end:

# pseudoinverse of listlist w
pseudo := proc(w)
    local u;
    u := Matrix(w);
    u := LinearAlgebra[MatrixInverse](u, method='pseudo');
    convert(u, listlist)
end:

psu := proc(w) transpos(pseudo(w)) end:

# log2 of first n primes
pril := proc(n)
    local i, u;
    u := NULL;
    for i from 1 to n do
        u := u, log2(ithprime(i))
    od;
    [u]
end:

# reverse of list
revlist := proc(l)
    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:

orp := proc(w, p) padic[ordp](w, p) end:

# rank of p-limit of q
pim := proc(q)
    local r, i, p;
    r := 1;
    i := 0;
    while not (r = q) do
        i := i + 1;
        p := ithprime(i);
        r := r * p ^ orp(q, p)
    od;
    if i = 0 then RETURN(0) fi;
    i
end:

# prime limit of rational number q
plim := proc(q)
    ithprime(pim(q))
end:

# converts rational number q to monzo of length n
rat2monz := proc(q, n)
    local v, i;
    for i from 1 to n do
        v[i] := ordp(q, ithprime(i))
    od;
    convert(convert(v, array), list)
end:

# converts monzo to rational number
monz2rat := proc(m)
    local i, t;
    t := 1;
    for i from 1 to nops(m) do
        t := t * ithprime(i) ^ m[i]
    od;
    t
end:

# hermite normal form of listlist l
herm := proc(l)
    local M;
    M := Matrix(l);
    convert(convert(HermiteForm[Z](M), array), listlist)
end:

# normal interval list from list of intervals l
nori := proc(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 u, v, w, i, n, a;
    u := herm(l);
    n := rnk(u);
    v := NULL:
    for i from 1 to n do
        v := v, u[i]
    od;
    v := [v];
    u := pseudo(v);
    w := pril(nops(l[1]));
    a := op(matmul(w, u));
    u := NULL;
    for i from 1 to n do
        if a[i] < 0 then u := u, -v[i] fi;
        if a[i] >= 0 then u := u, v[i] fi
    od;
    [u]
end: