back to list

a*x + b*y = n

🔗Gene Ward Smith <genewardsmith@coolgoose.com>

3/22/2007 12:15:10 AM

This eqation, for fixed integers a, b, n and integer variables x and y
is the simplest of all Diophantine equations, but it is important and
relevant in particular to the notation issue.

We assume a and b are nonzero and relatively prime. Then a solution to

a*x + b*y = 1

can be found via continued fractions. We can reduce to the case where a
and b are positive. Consider a/b on the bth level of the Farey sequence.
Then we get a1/b1 < a/b < a2/b2, with (a1+a2)/(b1+b2) = a/b, and
a*b1 - b*a1 = 1, -a*b2 + b*a2 = 1. Moreover, if a*u + b*v = 1 for
particular values u and v, then a*(n*u) + b*(n*v) = n for particular
values n*u and n*v. Hence, we may always obtain a particular solution
to a*x + b*y = n. Since a*b - b*a = 0, the general solution can be
obtained as x = n*u + m*b, y = n*v - m*a for arbitary integer m.

Note that this means we can fix mod b residue classes for x, or mod a
residue classes for y.

For example, let's consider a generator g=7, and a period h=12. Now one
the Faery sequence, or from continued fractions, we find that
4/7 < 7/12 < 3/5. So we can find particular solutions to 7*x + 12*y=1
as as 7*(-5)+12*3 = 1 or 7*7-12*4=1. So for instance, a general
solution to 7*x+12*y=1 is x=12*m-5, y=-7*m+3. Suppose we want to
restrict g to a gamut running from -3 to +8, corresponding to Eb to G#,
then we must enforce -3 <= 12*m-5 < 8, which has the single solution
m=1, x=7. These special solutions, restricted to a gamut, can easily be
computed using the floor and mod functions; for example -5 mod 12 = 7,
floor((8-7)/12) = 0, so x=7 and therefore m = (5+7)/12 = 1.

Now suppose instead g=7 and h=6, and we are looking at mod 12 (midi
style) note numbers in terms of pajara. Now the gamut consists not of
12 notes but of six. There's a project under way to get "LT" notation
working for Scala, and I think to do that we should specify not only
generator and period (g and h), but the gamut range also, which should
be h consecutive integers. I hope Manuel finds these observations
useful.

🔗Gene Ward Smith <genewardsmith@coolgoose.com>

3/22/2007 2:13:20 AM

--- In tuning-math@yahoogroups.com, "Gene Ward Smith"
<genewardsmith@...> wrote:

> There's a project under way to get "LT" notation
> working for Scala, and I think to do that we should specify not
only
> generator and period (g and h), but the gamut range also, which
should
> be h consecutive integers.

I suspect people don't need any help here, but here's how to find
g*x + h*y = n, with x restricted to a gamut a <= x <= b of h
consectutive integers. If mod(u, v) is u mod v reduced to the range
0 ... v-1, then x = mod(n/g + a, h)-a will be congruent to n/g mod h,
and will lie in the gamut range. Then g*x will be congruent to n mod
h, and y = (n-g*x)/h will be an integer. You now have x.y in LT
notation.

mod(w/g, h) can be found since g is prime to h. In particular, the
inverse gi = mod(1/g, h), such that gi * g is congruent to 1 mod h,
is computable by the Euclidean algorithm/continued fraction stuff
mentioned before. Then mod(w/g, h) is mod(gi*w, h).

Hence, if we have a generator g and a period h, and want to reduce to
LT form, all we need to make the answer unique is to supply a, the
lower limit of the gamut. Input g, h, and a, and Scala or some other
program is in a position to output a unique x.y, generator.period,
value corresponding to any integer n.

🔗Manuel Op de Coul <manuel.op.de.coul@eon-benelux.com>

3/23/2007 9:22:04 AM

--- In tuning-math@yahoogroups.com, "Gene Ward Smith"
<genewardsmith@...> wrote:

> Hence, if we have a generator g and a period h, and want to reduce to
> LT form, all we need to make the answer unique is to supply a, the
> lower limit of the gamut. Input g, h, and a, and Scala or some other
> program is in a position to output a unique x.y, generator.period,
> value corresponding to any integer n.

Gene, thanks. I added the lower bound for the gamut to the LT notation
parameters (SET LT_PARS). I also fixed a problem with the midi to .seq
conversion (EXAMPLE/CREATE/SCALE) in combination with this notation.
So please have a look, and thanks again for the test work.

Manuel

🔗Gene Ward Smith <genewardsmith@coolgoose.com>

3/23/2007 1:42:25 PM

--- In tuning-math@yahoogroups.com, "Manuel Op de Coul"
<manuel.op.de.coul@...> wrote:

> Gene, thanks. I added the lower bound for the gamut to the LT notation
> parameters (SET LT_PARS). I also fixed a problem with the midi to .seq
> conversion (EXAMPLE/CREATE/SCALE) in combination with this notation.
> So please have a look, and thanks again for the test work.

Great news! I'll get on it.

🔗Gene Ward Smith <genewardsmith@coolgoose.com>

3/23/2007 2:13:09 PM

--- In tuning-math@yahoogroups.com, "Manuel Op de Coul"
<manuel.op.de.coul@...> wrote:

> Gene, thanks. I added the lower bound for the gamut to the LT notation
> parameters (SET LT_PARS).

When I ran SET LT_PARS just now in 2.23r, it asked for generator and
division, not generator, period, gamut. Also, what does setting the
octave do?