back to list

From wedgies to mappings?

🔗Petr Pařízek <p.parizek@...>

7/16/2009 10:48:53 AM

Hi tuners,

a few years ago, there was some discussion here about converting period/generator mappings into wedgies. But how can I do the opposite? Anyone who could help?

Thanks in advance.

Petr

🔗Herman Miller <hmiller@...>

7/16/2009 8:13:57 PM

Petr Pařízek wrote:
> Hi tuners,
> > a few years ago, there was some discussion here about converting > period/generator mappings into wedgies. But how can I do the opposite? > Anyone who could help?
> > Thanks in advance.
> > Petr

I know a method, but it's not very straightforward. Maybe someone can figure out a better way.

For convenience, I'll notate the period, generator, and wedgie as follows (taking a 7-limit example):

<p2 p3 p5 p7]
<g2 g3 g5 g7]
<<w2,3 w2,5 w2,7 w3,5 w3,7 w5,7]]

First, if we assume the usual convention for period/generator mappings (the octave is a period or multiple of periods), we can find the number of periods in an octave by finding the greatest common divisor of the first few wedgie components (the ones starting with w2). Then the number of generators is zero.

p2 = GCD(w2,3 w2,5 w2,7)
g2 = 0

The first few wedgie components (the ones starting with w2) then give the generator mapping (when divided by the GCD).

g3 = w2,3 / p2
g5 = w2,5 / p2
g7 = w2,7 / p2

Here's where it gets tricky. In general, there's more than one possible value for p3 that can work. Take the example of meantone, where the generator can be considered as either a fourth or a fifth; if it's a fifth, p3 = 1, but if it's a fourth, p3 = 2 and the generator is negative. I.e.,

<1, 1, 0, -3] octave
<0, 1, 4, 10] fifth

<1, 2, 4, 7] octave
<0, -1, -4, -10] fourth

So there's not a unique solution; you need to find an appropriate value for p3 that results in integer values for p5 and p7, while keeping the size of the generator within the desired range (e.g. less than half the period).

Take miracle as an example:

<<6, -7, -2, -25, -20, 15]]

p2 = 1 (the GCD of 6, 7, and 2)
g3 = 6 (or -6)
g5 = -7 (or 7)
g7 = -2 (or 2)

By trial and error you can find that p3 = 1 results in integer values for p5 and p7. Once you have p3, note that w3,5 = p3g5 - p5g3, so p5 = (p3g5 - w3,5) / g3, and p7 = (p3g7 - w3,7) / g3.

(If g3 = 0, skip p3 and start with p5, or the first one with a non-zero number of generators...)

🔗Graham Breed <gbreed@...>

7/19/2009 12:00:52 PM

2009/7/16 Petr Pařízek <p.parizek@...>:

> a few years ago, there was some discussion here about converting
> period/generator mappings into wedgies. But how can I do the opposite?
> Anyone who could help?

Did this come up here or on tuning-math in that past year? The
easiest way is, of course, not to start from there ;-) Anyway, it can
be done.

The wedgie is the distinct entries from a matrix like this:

( 0 w1 w2 w3)
(-w1 0 w4 w5)
(-w2 -w4 0 w6)
(-w3 -w5 -w6 0)

The details will be different for different sizes, but it's the same
pattern. You take any two linearly independent rows of that matrix
and you get a mapping, which may have contorsion. Getting a mapping
without contorsion is a problem I still haven't solved. (If the rows
aren't linearly dependent, you'll get a row of zeros when you try to
reduce them. So try a different choice.)

If you have a library for doing exterior algebra, you can choose a
"chromatic unison vector" (or whatever we're supposed to call them),
wedge it with the comma-space version of the wedgie, and take the
complement. That gets you the mapping for an equal temperament that
you can use to find the rank 2 mapping. Note that using an octave as
an "equivalence vector" (something like a unison vector that isn't
unisonous) gets you the octave-equivalent part of the mapping
multiplied by the number of periods to an octave.

You can also solve a system of linear equations, probably as explained
here (I haven't checked that in detail, but I think a good algorithm
was there before):

http://en.wikipedia.org/wiki/Euclidean_subspace#Null_space_of_a_matrix

I'm not sure where those equations came from. A while back I found a
thread (sorry, no reference now) where Gene Smith thought it was so
obvious that he wouldn't explain it to me. And Paul Erlich thought
the algorithm to solve the equations was so obvious that he wouldn't
explain that either. It's taken me a few years to work out what they
were probably talking about but I still get contorsion. And I'd
rather not start with wedgies.

Graham

🔗Carl Lumma <carl@...>

7/20/2009 6:27:45 PM

--- In tuning@yahoogroups.com, Graham Breed <gbreed@...> wrote:

> I'm not sure where those equations came from. A while back I found a
> thread (sorry, no reference now) where Gene Smith thought it was so
> obvious that he wouldn't explain it to me. And Paul Erlich thought
> the algorithm to solve the equations was so obvious that he wouldn't
> explain that either. It's taken me a few years to work out what they
> were probably talking about but I still get contorsion. And I'd
> rather not start with wedgies.
>
> Graham

Here is some Gene code that may be helpful:

ml7 := proc(l)
# mapping list for 7-limit wedgie
local a;
a := convert(ihermite(lval7(l)), listlist);
fx7([a[1],a[2]]) end:

listlist looks like a maple datatype, to which the
output of ihermite is being cast. ihermite is
described here:

http://www.maplesoft.com/support/help/view.aspx?sid=24763

Here's lval7:

lval7 := proc(l)
# subgroup vals of 7-limit wedgie
[[0, -l[1], -l[2], -l[3]], [l[1], 0, -l[4], -l[5]],
[l[2], l[4], 0, -l[6]], [l[3], l[5], l[6], 0]] end:

Rest of the functions:

fx7 := proc(m)
# reduction of 7-limit mapping in listlist form
local k,n;
k := m;
n := [[0,0,0,0], [0,0,0,0]];
while not k=n do
n := k;
k := fxx7(n) od;
RETURN(k) end:

fxx7 := proc(m)
local g, u;
u := m;
g := gf7(transpose(matrix(m)));
if g[1]<0 then
RETURN([-u[1],u[2]]) fi;
if g[2]<0 then
RETURN([u[1],-u[2]]) fi;
if g[1]<g[2] then
RETURN([u[1]+u[2], u[2]]) fi;
if g[1]<2*g[2] then
RETURN([u[1]+u[2], -u[2]]) fi;
RETURN(u) end:

gf7 := proc(m)
# 7-limit linear temperament least squares
local l;
l:= ge7(m);
[1200*evalf(l[1]), 1200*evalf(l[2])] end:

ge7 := proc(m)
local r,s,t, u;
t := tl7(m);
if m[1,1]=0 then print(`Invalid matrix`) else
r := subs(a=1/m[1,1], t) fi;
u := simplify(solve(diff(r,b)));
[1/m[1,1], u] end:

So I think this first finds the "subgroup vals" of the
wedgie, converts them (when taken as a matrix) to hermite
normal form, and finally fxx7s that matrix until just
before it turns into a matrix of zeros. Exactly what
fxx7 does is a bit of a mystery, but apparently it's
finding least-squares fittings of something (generators?).

-Carl

🔗Carl Lumma <carl@...>

7/20/2009 11:15:22 PM

I wrote:

> ge7 := proc(m)
> local r,s,t, u;
> t := tl7(m);
> if m[1,1]=0 then print(`Invalid matrix`) else
> r := subs(a=1/m[1,1], t) fi;
> u := simplify(solve(diff(r,b)));
> [1/m[1,1], u] end:

Whoops, forgot tl7.

tl7 := proc(m)
local i, t, v;
t := 0;
for i from 1 to 6 do
v := matrix(1,4,[ordp(in7[i], 2), ordp(in7[i], 3), ordp(in7[i],5), ordp(in7[i], 7)]);
v := evalm(v &* m);
t := t + (v[1,1]*a + v[1,2]*b - ll(in7[i]))^2 od;
t end:

Here's ordp:

http://www.maplesoft.com/support/help/view.aspx?path=padic/ordp

Natch, this leads to in7, which, incredibly, is the end
of the line:

in7 := {3, 5, 7, 5/3, 7/3, 7/5}:

-Carl

🔗Graham Breed <gbreed@...>

7/21/2009 12:46:39 AM

2009/7/21 Carl Lumma <carl@...>:

> Here is some Gene code that may be helpful:

There was some code like this in the thread I remember as well.

> ml7 := proc(l)
> # mapping list for 7-limit wedgie
> local a;
> a := convert(ihermite(lval7(l)), listlist);
> fx7([a[1],a[2]]) end:
>
> listlist looks like a maple datatype, to which the
> output of ihermite is being cast.  ihermite is
> described here:
>
> http://www.maplesoft.com/support/help/view.aspx?sid=24763

Unfortunately that documentation's inadequate. It doesn't define what
Hermite Normal Form (HNF) is, other than being the same as reduced row
echelon form. But the matrix "B" is plainly not in reduced row
echelon form. So the function does something else, probably useful,
but exactly what we can only guess at.

Gene claimed it was this function that removed the torsion. Maybe it
does. The documentation doesn't say anything about that. It does say
"The Hermite normal form is obtained by doing elementary row
operations. This includes interchanging rows, multiplying through a
row by -1, and adding an integral multiple of one row to another."
which is guaranteed to *preserve* torsion.

> Here's lval7:
>
> lval7 := proc(l)
> # subgroup vals of 7-limit wedgie
> [[0, -l[1], -l[2], -l[3]], [l[1], 0, -l[4], -l[5]],
> [l[2], l[4], 0, -l[6]], [l[3], l[5], l[6], 0]] end:

That's the matrix with zero diagonals I gave before. You can get it
by treating each of the primes as something like a unison vector.
It's also easy to produce directly from the wedgie, for any number of
prime dimensions, which I hadn't noticed in the original thread.

> So I think this first finds the "subgroup vals" of the
> wedgie, converts them (when taken as a matrix) to hermite
> normal form, and finally fxx7s that matrix until just
> before it turns into a matrix of zeros.  Exactly what
> fxx7 does is a bit of a mystery, but apparently it's
> finding least-squares fittings of something (generators?).

I don't know what the fxx7 is about, I haven't seen it before. It
looks like he's finding a least squares tuning instead of simply
returning the mapping.

The point of the HNF is that a rank 2 temperament will always have two
non-zero rows in its HNF (that is the HNF of a matrix containing a
load of mappings for it), which will always be at the top. So if you
don't know which rows of the original matrix are linearly independent,
you just find the HNF of all of them, and take the top two rows. The
problem is that will introduce spurious contorsion. Gene claimed he
got rid of contorsion and I'd still like to know how he did it.

Graham

🔗Carl Lumma <carl@...>

7/21/2009 11:34:15 AM

> > ihermite is
> > described here:
> >
> > http://www.maplesoft.com/support/help/view.aspx?sid=24763
>
> Unfortunately that documentation's inadequate. It doesn't define
> what Hermite Normal Form (HNF) is, other than being the same as
> reduced row echelon form. But the matrix "B" is plainly not in
> reduced row echelon form. So the function does something else,
> probably useful, but exactly what we can only guess at.

Just wait till you see the docs for ordp. Do you understand
p-adic evaluations? I looked that up on wikipedia and my head
almost exploded.

A search for "hermite" on tuning-math would probably be very
helpful. In addition, you can see this page:

http://lumma.org/tuning/gws/hermbas.htm

> > So I think this first finds the "subgroup vals" of the
> > wedgie, converts them (when taken as a matrix) to hermite
> > normal form, and finally fxx7s that matrix until just
> > before it turns into a matrix of zeros. Exactly what
> > fxx7 does is a bit of a mystery, but apparently it's
> > finding least-squares fittings of something (generators?).
>
> I don't know what the fxx7 is about, I haven't seen it before. It
> looks like he's finding a least squares tuning instead of simply
> returning the mapping.
>
> The point of the HNF is that a rank 2 temperament will always
> have two non-zero rows in its HNF (that is the HNF of a matrix
> containing a load of mappings for it), which will always be at
> the top. So if you don't know which rows of the original matrix
> are linearly independent, you just find the HNF of all of them,
> and take the top two rows. The problem is that will introduce
> spurious contorsion. Gene claimed he got rid of contorsion and
> I'd still like to know how he did it.

Here's the blurb from his site where he explains it:

""By reducing the wedge product, we eliminate the possibility
that our mappings are not epimorphisms. For instance, we might
take h2 = <2 3 5| and h8 = <8 13 19|, and hope to produce an
icon by [h2, h8]. However, h2+h8 = <10 16 24|; hence the sum
of the two coordinates is always even, and the mapping is not
epimorphic. The cokernel of the mapping is a cyclic group of
order two, so we may say this mapping has torsion problems.

""Taking wedge products gives us h2/\h8 = <<2 -2 -8||; the
complement of this is |-8 2 2>, which represents
225/256 = (15/16)^2; hence the wedgie is <<1 -1 -4||, which
we may equate with |-4 1 1>, or 15/16; reducing this a
standard form where the comma in question is greater than
one gives 16/15. If we now find an icon which gives this
for a wedgie, we have eliminated the torsion problem.
All such icons will have the same wedgie, so 16/15 defines
a 5-limit linear temperament (the fourth-thirds temperament.)""

Everything is easy except the magic step where we "find
the icon that gives this for a wedgie". The icon is the
mapping.

-Carl

🔗Graham Breed <gbreed@...>

7/21/2009 2:04:46 PM

2009/7/21 Carl Lumma <carl@...>:

> Just wait till you see the docs for ordp.  Do you understand
> p-adic evaluations?  I looked that up on wikipedia and my head
> almost exploded.

The best reference for p-adic valuations (no "e") is in the Valuation
(algebra) entry:

http://en.wikipedia.org/wiki/Valuation_(algebra)#p-adic_valuation

But, no, I still don't understand it.

> A search for "hermite" on tuning-math would probably be very
> helpful.  In addition, you can see this page:
>
> http://lumma.org/tuning/gws/hermbas.htm

I've been on tuning-math since the start. I even went through the
archive last year. All I find is myself asking the questions I still
want answered.

That page doesn't define Hermite Normal Form. It points to Mathworld,
which says "Given a square nonsingular integer matrix..." Well,
great, unfortunately square nonsingular matrices don't correspond to
temperaments, by definition. But, still, make some common sense
generalizations and you get a good standard form for the mapping.
Defining the off-diagonal entries to be non-negative instead of
non-positive is better, and the Maple examples show that's what
they're doing. Doesn't help get rid of torsion.

> Here's the blurb from his site where he explains it:

<snip>

> Everything is easy except the magic step where we "find
> the icon that gives this for a wedgie".  The icon is the
> mapping.

That's it. Everything's easy except for the problem we're trying to
solve, which is swept under the carpet.

Graham