MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Finding Optimal Integer Ratio for Any Decimal Fraction



Benjamin Tubb wrote:
> 
> I'm trying to find an optimal integer ratio for any given decimal value
> within two constraints: 1) a maximum denominator and 2) a specified
> decimal precision of match accuracy. For example: given a maximum
> denominator of 2048, what is the smallest lowest common denominator
> (LCD) ratio equaling close to 1.00057779 with a precision to the fifth
> decimal place (i.e. the first '7' in this case)? The intent is to
> generate a table of LCD integer ratios for each of the 1200 cents in 12
> tone equal temperament.
> 
> ----------------
> Benjamin Tubb
> AIM: brtubb
> brtubb@cybertron.com
> http://home.cybertron.com/~brtubb


No guarantees, but Rationalize with a tolerance specified may often be
of assistance. For example,

In[21]:= Rationalize[1.00057779, 10^-6]
         1732
Out[21]= ----
         1731

In[23]:= N[%%]//InputForm
Out[23]//InputForm= 1.000577700751011

Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: MATLAB to Mathematica Program Conversion Needed
  • Next by Date: Mathematica 3.0 Palette for Physics SI Fundamental Constants
  • Prev by thread: Finding Optimal Integer Ratio for Any Decimal Fraction
  • Next by thread: How Mathematica select one of the roots?