A plea to all who understand matrix math:
A week ago, I posted the pseudo-code for the formulas
in my Excel spreadsheet which calculates the coordinates
of a 2-dimensional periodicity-block from a given pair
of unison-vectors. It's quoted below, with some additional
comments inserted.
The algorithm sometimes calculates the proper coordinates,
but not always. I've tried to work from Paul's _Gentle
Introduction to Fokker Periodicity Blocks, part 3_
<
http://www.ixpres.com/interval/td/erlich/intropblock3.htm>,
but I'm just not getting it.
I am *begging* someone who knows how to do this to have
a look at my algorithm and correct it.
The two big problems:
1)
I find that sometimes in order to get the correct periodicity-block,
I have to enter one or both pairs of the unison-vector exponents
with the signs (=/-) reversed.
2)
Sometimes the blocks are centered on 1/1, as I intend
for them to be ... but sometimes they're not, with 1/1 being
plotted at a corner.
Also, it seems that sometimes the order in which I list the
unison-vectors makes a difference. Is it supposed to?
(I don't think so...)
The code within the "LOOP" is the part that needs fixing.
Thanks in advance for any help received!
-monz
> ----- Original Message -----
>
> > From: monz <
joemonz@...>
> > To: <
tuning-math@yahoogroups.com>
> > Sent: Sunday, December 23, 2001 12:28 AM
> > Subject: Re: [tuning-math] coordinates from unison-vectors (was: 55-tET)
> >
> >
> >
> > Here's the pseudo-code for the formulas in my spreadsheet.
> > Please feel free to correct any errors or to make the code
> > more elegant.
> >
> >
> >
> > unison-vectors =
> >
> > (3^a) * (5^b)
> > (3^c) * (5^d)
> >
> >
> >
> > unison-vector matrix =
> >
> > (a b)
> > (c d)
> >
> >
> >
> > determinant n of the matrix :
> >
> > n = (a*d) - (c*b)
> >
> >
> >
> > inverse of the matrix =
> >
> > ( d -b)
> > (-c a)
> > -------
> > n
> >
> >
> >
> > inverse coordinates p, q :
> >
> >
> > p = 0, q = 0
> >
> >
> > LOOP
> >
> > '-- This part finds the values p,q which fit into the unit-cube
> >
> > if ABS(p+d) > (ABS(n)/2)
> >
> > then p = MOD(p+d, ABS(n)) - ABS(n)
> >
> > else p = p + d
> >
> > end if
> >
> >
> >
> > if ABS(q-b) > (ABS(n)/2)
> >
> > then q = MOD(q-b, ABS(n)) - ABS(n)
> >
> > else q = q - b
> >
> > end if
> >
> >
> >
> > lattice coordinates x, y :
> >
> > '-- This part transforms back to the original space
> >
> > x = ( (q*c) + (p*a) ) / n
> >
> > y = ( (q*d) + (p*b) ) / n
> >
> >
> >
> > END LOOP
> >
> >
>
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at
http://mail.yahoo.com