back to list

Method for approximating intervals?

🔗rick <rick_ballan@...>

3/8/2010 3:22:52 AM

Hi everyone,

Does anyone know of a good method for finding lower intervals from higher ones? For eg, given major third 81/64, the next closest interval down is 62/49. My idea is to apply this method repeatedly until we arrive at the lowest one, in this case 5/4. So far I've been doing it with mediants (a + p)/(b + q) which seems to be working but is a bit laborious. John Chalmers kindly wrote me a 'brute force' algorithm which works perfectly (thanks John) but I'm not good with programming languages. Also Kraig sent me Viggo Brun's algorithm but without an example I find it hard to understand.

Thanks

-Rick

🔗hfmlacerda <hfmlacerda@...>

3/8/2010 6:49:13 AM

--- In tuning@yahoogroups.com, "rick" <rick_ballan@...> wrote:
> Does anyone know of a good method for finding lower intervals from higher ones?

Math software can have this facility.

For example, with GNU Octave, there is the function "rats" with arbitrary "tolerance":

===========================================================
-- Function File: S = rats (X, TOL)
Convert X into a rational approximation represented as a string.
You can convert the string back into a matrix as follows:

eval(["[",rats(hilb(4)),"];"])

The optional second argument defines the tolerance to that the
rational approximation will be calculated to.
See also: rat.
===========================================================

Examples:

octave:21> rats(81/64,.1)
ans = 5/4
octave:22> rats(81/64,.01)
ans = 19/15
octave:23> rats(81/64,.001)
ans = 81/64

🔗hpiinstruments <aaronhunt@...>

3/8/2010 7:32:03 AM

Hi Rick. I think you're looking for 'convergents':
<http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfCALC.html?>
Cheers,
AAH
=====

--- In tuning@yahoogroups.com, "rick" <rick_ballan@...> wrote:
>
> Hi everyone,
>
> Does anyone know of a good method for finding lower intervals from higher ones? For eg, given major third 81/64, the next closest interval down is 62/49. My idea is to apply this method repeatedly until we arrive at the lowest one, in this case 5/4. So far I've been doing it with mediants (a + p)/(b + q) which seems to be working but is a bit laborious. John Chalmers kindly wrote me a 'brute force' algorithm which works perfectly (thanks John) but I'm not good with programming languages. Also Kraig sent me Viggo Brun's algorithm but without an example I find it hard to understand.
>
> Thanks
>
> -Rick
>

🔗rick <rick_ballan@...>

3/9/2010 4:57:13 AM

Thanks very much,

I've been trying to figure out a similar thing with Mathematica 7 but its sooo deep. I'll have to look up this other program and language. What does rats stand for btw?

-Rick

--- In tuning@yahoogroups.com, "hfmlacerda" <hfmlacerda@...> wrote:
>
>
> --- In tuning@yahoogroups.com, "rick" <rick_ballan@> wrote:
> > Does anyone know of a good method for finding lower intervals from higher ones?
>
> Math software can have this facility.
>
> For example, with GNU Octave, there is the function "rats" with arbitrary "tolerance":
>
> ===========================================================
> -- Function File: S = rats (X, TOL)
> Convert X into a rational approximation represented as a string.
> You can convert the string back into a matrix as follows:
>
> eval(["[",rats(hilb(4)),"];"])
>
> The optional second argument defines the tolerance to that the
> rational approximation will be calculated to.
> See also: rat.
> ===========================================================
>
> Examples:
>
> octave:21> rats(81/64,.1)
> ans = 5/4
> octave:22> rats(81/64,.01)
> ans = 19/15
> octave:23> rats(81/64,.001)
> ans = 81/64
>

🔗rick <rick_ballan@...>

3/9/2010 4:54:15 AM

Thanks Aaron,

Very handy indeed. I've bookmarked that site.

-Rick

--- In tuning@yahoogroups.com, "hpiinstruments" <aaronhunt@...> wrote:
>
> Hi Rick. I think you're looking for 'convergents':
> <http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfCALC.html?>
> Cheers,
> AAH
> =====
>
> --- In tuning@yahoogroups.com, "rick" <rick_ballan@> wrote:
> >
> > Hi everyone,
> >
> > Does anyone know of a good method for finding lower intervals from higher ones? For eg, given major third 81/64, the next closest interval down is 62/49. My idea is to apply this method repeatedly until we arrive at the lowest one, in this case 5/4. So far I've been doing it with mediants (a + p)/(b + q) which seems to be working but is a bit laborious. John Chalmers kindly wrote me a 'brute force' algorithm which works perfectly (thanks John) but I'm not good with programming languages. Also Kraig sent me Viggo Brun's algorithm but without an example I find it hard to understand.
> >
> > Thanks
> >
> > -Rick
> >
>

🔗hfmlacerda <hfmlacerda@...>

3/9/2010 4:42:52 PM

--- In tuning@yahoogroups.com, "rick" <rick_ballan@...> wrote:
>
> What does rats stand for btw?

I guess it is something like "ratio as string". Its output is a character string.

🔗rick <rick_ballan@...>

3/9/2010 4:37:29 PM

Oh I'll take a wild guess that Rats = Ratios!

--- In tuning@yahoogroups.com, "hfmlacerda" <hfmlacerda@...> wrote:
>
>
> --- In tuning@yahoogroups.com, "rick" <rick_ballan@> wrote:
> > Does anyone know of a good method for finding lower intervals from higher ones?
>
> Math software can have this facility.
>
> For example, with GNU Octave, there is the function "rats" with arbitrary "tolerance":
>
> ===========================================================
> -- Function File: S = rats (X, TOL)
> Convert X into a rational approximation represented as a string.
> You can convert the string back into a matrix as follows:
>
> eval(["[",rats(hilb(4)),"];"])
>
> The optional second argument defines the tolerance to that the
> rational approximation will be calculated to.
> See also: rat.
> ===========================================================
>
> Examples:
>
> octave:21> rats(81/64,.1)
> ans = 5/4
> octave:22> rats(81/64,.01)
> ans = 19/15
> octave:23> rats(81/64,.001)
> ans = 81/64
>