back to list

A simpler, affine-space view on the "find generators" algorithm I just posted

🔗Mike Battaglia <battaglia01@gmail.com>

5/16/2012 11:53:19 AM

Consider interval space to be an affine space. Then in addition to
having vectors in this space, we also have a new type of object, which
is a "point." I'll represent vectors by |a b c> and points by |a b c),
with a parenthesis on the end.

We can represent both points and vectors in this space in the standard
way by using homogeneous coordinates. So in this approach, 3/2 is the
point |-1 1 0), which represented in homogeneous coordinates becomes
|-1 1 0;1>. (The semicolon was Keenan's suggestion, and means that the
following coordinate is intended to be the homogeneous "w" or whatever
you'd like to call it.) Because these are homogeneous coordinates, |-1
1 0;1> = |-2 2 0;2>, but |-1 1 0;1> != |-2 2 0;1>.

The difference of two points is a vector, which is distinguished by
having a homogeneous component of 0. For instance, |0 1 0) - |-1 1 0)
= |0 1 0;1> - |-1 1 0;1> = |1 0 0;0> = |1 0 0>, with the 0 on the end
denoting that this is a vector. Although you can consider both |1 0
0;0> and |2 0 0;0> to be equal (as a "point at infinity"), it's also
useful to keep them distinct as a way of notating vectors.

Homogeneous coordinates cleverly let us represent affine subspaces of
a vector space as follows: for instance, here's the affine subspace of
interval space consisting of all intervals of the form (3/2) *
(81/80)^k, represented for visual clarity with monzos as row vectors:

[-1 1 0;1]
[-4 4 -1;0]

Note that the semicolons are just there for formatting, to designate
that the last column consists of the homogeneous coordinate. You can
see that it consists of all intervals of the form k*|-1 1 0;1> + l*|-4
4 -1;0>. However, since all k*|-1 1 0;1> are homogeneously equivalent
to the same point, then this matrix effectively consists of |-1 1 0) +
k*|-4 4 -1>, meaning it's a translation of the subspace going through
81/80 that's translated so that the origin is at the point |-1 1 0).

This representation of affine subspaces lets us solve a few regular
temperament problems that are a bit difficult otherwise. For instance,
say we want to find the generators for meantone. In order to find the
interval |x y> for a particular basis of meantone, we can take the
mapping matrix

[1 1 0]
[0 1 4]

And add the |x y> as a homogeneous coordinate as follows

[1 1 0;x]
[0 1 4;y]

So if what we want is |0 1>, then it'll be this:

[1 1 0;0]
[0 1 4;1]

Note that we've turned the lower val, which is the generator, into a
point. (If we didn't pick something like |0 1>, it would still always
be possible to perform elementary row operations on the matrix to put
it in the above form, with one row representing a point and the rest
representing vectors.)

If we take the null space of this matrix, we get the following matrix:

[-4 1]
[ 4 -1]
[-1 0]
[ 0 1] <-- homogeneous coordinate

Note that the null space of the above matrix is k*|-4 4 -1;0> + l*|1
-1 0;1>. Since all l*|1 -1 0;1> are considered equivalent to |1 -1
0;1>, then using my notation from before, this is the same subspace as
k*|-4 4 -1> + |1 -1 0). In other words, it's the subspace spanned by
81/80, translated so that 2/3 is the origin.

This isn't quite the affine subspace of interval space corresponding
to all generators in meantone - it's instead the affine subspace of
interval space corresponding to all inverted, upside-down generators
in meantone. In other words, it's the thing which, if you add it TO
the generator, cancels out and gives you the null vector, which makes
sense, because this is the null space of that matrix. So we can easily
invert and figure out that |-1 1 0) + k*|-4 4 -1> is the subspace of
intervals mapping to |0 1> under that matrix.

(If you don't like this, you can append |-x -y> instead of |x y> to
the original mapping matrix to do the same thing.)

This also has some nice properties in val space - although the concept
of an "affine val" isn't quite as intuitive as an "affine interval,"
it still makes algebraic sense enough to easily find answers to
questions like "what's the set of all vals that support meantone and
are Bosanquet singly-negative," meaning "what's the set of all vals
that map 81/80 to 0 and 128/125 to 1?"

It's the same basic sort of question, just formulated from the reverse
perspective. Doing this will also allow us to define some nice "dual"
properties for affine subspaces, in a similar way to how we do it for
linear subspaces. I'll post about that next.

-Mike

🔗genewardsmith <genewardsmith@sbcglobal.net>

5/16/2012 5:56:18 PM

--- In tuning-math@yahoogroups.com, Mike Battaglia <battaglia01@...> wrote:
>
> Consider interval space to be an affine space.

If it's an affine space, you should call it note space or pitch space.

> We can represent both points and vectors in this space in the standard
> way by using homogeneous coordinates.

Now you are saying it's a projective space?? By the way, you never define your homogenous coordinates. I don't want to try to figure out what you are doing without, at least, definitions.

🔗Mike Battaglia <battaglia01@gmail.com>

5/16/2012 6:06:22 PM

On Wed, May 16, 2012 at 8:56 PM, genewardsmith <genewardsmith@sbcglobal.net>
wrote:
>
> --- In tuning-math@yahoogroups.com, Mike Battaglia <battaglia01@...>
> wrote:
> >
> > Consider interval space to be an affine space.
>
> If it's an affine space, you should call it note space or pitch space.

OK, note space.

> > We can represent both points and vectors in this space in the standard
> > way by using homogeneous coordinates.
>
> Now you are saying it's a projective space??

I'm saying it's an affine space, but that a useful representation of
the elements in this space is to treat A(R^n), the affine space on
R^n, as P(R^(n+1)), the projective space on R^(n+1). This allows you
to express affine transformations as matrices, and to differentiate
between points and vectors. This is a common technique in computer
graphics programming.

> By the way, you never define
> your homogenous coordinates. I don't want to try to figure out what you are
> doing without, at least, definitions.

The standard way: http://en.wikipedia.org/wiki/Homogeneous_coordinates

I'm using the definition where points become projective lines we
append a "1" to the end of the point. So in other words, the point (x,
y, z) becomes (x, y, z, 1). Then, in general, (wx, wy, wz, w) = (x, y,
z, 1).

-Mike

🔗Mike Battaglia <battaglia01@gmail.com>

5/16/2012 6:35:49 PM

On Wed, May 16, 2012 at 9:06 PM, Mike Battaglia <battaglia01@gmail.com> wrote:
>
>> By the way, you never define
>> your homogenous coordinates. I don't want to try to figure out what you are
>> doing without, at least, definitions.
>
> The standard way: http://en.wikipedia.org/wiki/Homogeneous_coordinates
>
> I'm using the definition where points become projective lines we
> append a "1" to the end of the point. So in other words, the point (x,
> y, z) becomes (x, y, z, 1). Then, in general, (wx, wy, wz, w) = (x, y,
> z, 1).

OK, here's the complete spec. This is the only way I've ever seen
homogeneous coordinates make sense, so it's hardly my invention. But
here goes:

POINTS
1) Points in A(R^3) are mapped to lines in P(R^4).
2) The mapping is that (x, y, z) |-> U {w*(x, y, z, 1)}, where U is
union, and w is any nonzero scalar in R.
3) We can represent this line by any set of homogeneous coordinates
(x, y, z, 1), and note that (wx, wy, wz, w) represents the same line
for nonzero w.
4) The canonical representation of any point is where the latter
coordinate is 1.
5) I'm going to put a semicolon before the last coefficient to signify
that the following number is the homogeneous coordinate; e.g. I will
write (x, y, z; 1) instead of (x, y, z, 1).

VECTORS
5) The difference between two points in the affine space is done by
first homogenizing the last coordinate to 1, and then subtracting. In
other words, (x, y, z, 1) - (a, b, c; 1) = (x-a, y-b, z-c; 0).
6) Note that the difference between two points is something with the
last coordinate set to 0. You can consider this a projective "point at
infinity" if you want, but algebraically it makes more sense to
consider this object to be a -vector-, and if you do so, all of the
math will work out, especially when it comes to representing affine
subspaces as matrices.
7) Note that since the homogeneous coordinate is 0, (a, b, c; 0) is
not considered to be the same as (wa, wb, wc; 0).

ADDING POINTS
8) It makes no sense to add points in an affine space. However, it
does make sense to take a weighted combination of points, provided the
sum of weights is 1.
9) In our representation, we can thus add the points (1, 0, 0) to (0,
1, 0) by doing 1/2 * (1, 0, 0; 1) + 1/2 * (0, 1, 0; 1) = (0.5, 0.5, 0;
1).
10) However, note that in our representation, 1/2 (1, 0, 0; 1)
represents the same point as (1, 0, 0; 1). So provided we've
normalized our points so that they're in the canonical representation
where the latter coordinate is 1, we can just add them and then
re-normalize. So (1, 0, 0; 1) + (0, 1, 0; 1) = (1, 1, 0; 2) = (0.5,
0.5, 0; 1).
11) If we agree to renormalize like this, then we can just add affine
points (x, y, z; w1) + (a, b, c; w2) directly, and the normalization
takes care of making sure all the weights sum to 1 for us.

That's it. So if I want to represent the point (1, 1, 1), that turns
into the point (1, 1, 1; 1). If I want to represent the vector (1, 1,
1), that turns into the point (1, 1, 1; 0). Simple.

Now let's construct a matrix whose row space represents the affine
subspace going through the points (-1, 1, 0) and (3, -3, 1). So we
just do it using the homogeneous system set above:

[-1 1 0 1]
[3 -3 1 1]

Note that all k*[-1 1 0 1] lie in this row space, but these all
represent the same point as [-1 1 0 1], which is the point (-1, 1, 0;
1). Note also that you can get terms like k*[-1 1 0 1] * l*[3 -3 1 1]
in there for nonzero k, l, which because of the renormalization that
takes place when you add homogeneous coordinates as per #11, different
k and l count as taking different weighted averages of the points.
Therefore, this will hence trace out the affine hull of the points
represented by the row vectors of the matrix.

More revealing is to put the matrix into this form, row-equivalent to the above:

[-1 1 0 1]
[-4 4 -1 0]

Now you can see that it consists the point indexed by (-1, 1, 0; 1),
with the set of all k*(-4, 4, -1; 0) being added to it. In other
words, it's the translation of the subspace spanned by (-4, 4, -1; 0),
such that the origin becomes (-1, 1, 0; 1).

-Mike

🔗genewardsmith <genewardsmith@sbcglobal.net>

5/16/2012 8:51:39 PM

--- In tuning-math@yahoogroups.com, Mike Battaglia <battaglia01@...> wrote:

> > By the way, you never define
> > your homogenous coordinates. I don't want to try to figure out what you are
> > doing without, at least, definitions.
>
> The standard way: http://en.wikipedia.org/wiki/Homogeneous_coordinates

Not really. You say a zero on the end denotes a vector. Ordinarily, it denotes a point at infinity. Can we just use standard notation and save outselves wear and tear on the brain?

🔗Mike Battaglia <battaglia01@gmail.com>

5/16/2012 8:55:03 PM

On Wed, May 16, 2012 at 11:51 PM, genewardsmith
<genewardsmith@sbcglobal.net> wrote:
>
> --- In tuning-math@yahoogroups.com, Mike Battaglia <battaglia01@...>
> wrote:
>
> > > By the way, you never define
> > > your homogenous coordinates. I don't want to try to figure out what
> > > you are
> > > doing without, at least, definitions.
> >
> > The standard way: http://en.wikipedia.org/wiki/Homogeneous_coordinates
>
> Not really. You say a zero on the end denotes a vector. Ordinarily, it
> denotes a point at infinity. Can we just use standard notation and save
> outselves wear and tear on the brain?

What is the "standard" way to represent vectors in an affine space?
This is the only way I know.

-Mike

🔗genewardsmith <genewardsmith@sbcglobal.net>

5/16/2012 9:05:05 PM

--- In tuning-math@yahoogroups.com, Mike Battaglia <battaglia01@...> wrote:

> 6) Note that the difference between two points is something with the
> last coordinate set to 0. You can consider this a projective "point at
> infinity" if you want, but algebraically it makes more sense to
> consider this object to be a -vector-, and if you do so, all of the
> math will work out, especially when it comes to representing affine
> subspaces as matrices.

That makes no sense to me. Normally, if (a b c d) is such that d is not zero, then it is in the affine patch leaving off the plane d=0 at infinity, with coordinates (a/d b/d c/d).

> 7) Note that since the homogeneous coordinate is 0, (a, b, c; 0) is
> not considered to be the same as (wa, wb, wc; 0).

Not considered by you. Standard math definitions says it is the same. Would it not be possible to do this in a standard, less confusing, way?

🔗Mike Battaglia <battaglia01@gmail.com>

5/16/2012 9:08:31 PM

On Thu, May 17, 2012 at 12:05 AM, genewardsmith
<genewardsmith@sbcglobal.net> wrote:
>
> > 7) Note that since the homogeneous coordinate is 0, (a, b, c; 0) is
> > not considered to be the same as (wa, wb, wc; 0).
>
> Not considered by you. Standard math definitions says it is the same.
> Would it not be possible to do this in a standard, less confusing, way?

If you have a simpler way to do it, I'm all for it. This is just the
way I know, and it's useful because it lets you represent affine
subspaces as row spaces in matrices. How are we supposed to do that
otherwise?

-Mike

🔗genewardsmith <genewardsmith@sbcglobal.net>

5/16/2012 9:09:07 PM

--- In tuning-math@yahoogroups.com, Mike Battaglia <battaglia01@...> wrote:

> What is the "standard" way to represent vectors in an affine space?
> This is the only way I know.

If (x1 y1 z1) and (x2 y2 z2) are two points in a 3D affine space, then |x1-x2 y1-y2 z1-z2> is a vector.