I've been out of school for a very long time, and can't wrap my head around calculating 2 whole numbers from a fraction. For instance, if I have 2 ratios --
4:3 1.33333...
16:9 1.77777...
?:? (automatically generated)
I want to be able to look up the whole number representations from a decimal point.(for a software program) I think there should be a fairly easy way to do this? I've seen some other questions possibly linked to this, however, I can't read math anymore either, so text answers would be wonderful :)
There's a straightforward algorithm for this. Allow me to demonstrate on
$$ 0.1\overline{37} = 0.1373737373737\ldots$$
The first step is to split off the non-repeating part:
$$ 0.1\overline{37} = 0.1 + 0.0\overline{37} $$
then you pull out the 'common factor' from the repeated part
$$ 0.1\overline{37} = 0.1 + 37 \cdot 0.0\overline{01} $$
then you multiply and divide by an appropriate number to make the repeated part all 9's
$$ 0.1\overline{37} = 0.1 + \frac{37}{99} \cdot 0.0\overline{99} $$
then you simplify repeated 9's:
$$ 0.1\overline{37} = 0.1 + \frac{37}{99} \cdot 0.1 $$
with practice you can do all of the above in a single step. Once here, you can simplify further if you need to
$$ 0.1\overline{37} = \frac{1}{10} + \frac{37}{99} \cdot \frac{1}{10} = \frac{68}{495} $$
If you need to do this in software rather than by hand, this is an example of the "rational reconstruction" problem, and some languages have solutions built-in. e.g. in
python, you can use the fractions module:although it takes some care to ensure that you get the right make sure you get it right. e.g. the default settings would give the wrong answer if I just used
'0.1373737'.The general algorithm is continued fractions, and it will work even when the part you have doesn't repeat, assuming you give enough information. The
pythonexample I mention above uses this method (I believe), and it can recover the fraction $1/7$ from a decimal approximation: