Post Reply 
Help with an algorithm for converting decimals to fractions
08-27-2014, 10:32 PM (This post was last modified: 08-28-2014 03:29 AM by Thomas Klemm.)
Post: #3
RE: Help with an algorithm for converting decimals to fractions
Let's assume you wan't to calculate the common fraction of the continued fraction of \(\pi\) = [3; 7, 15, 1, 292, ...].
Then you write this sequence down and below a matrix of 0 and 1:
Code:
  3  7  15    1  292  ...
0 1
1 0
Now you multiply each entry with the corresponding value of the sequence, add the value of the left and write it to the right:
Code:
  3  7  15    1  292  ...
0 1  3  22  333  355  ...
1 0  1   7  106  113  ...
Thus the approximations of \(\pi\) are \(\frac{3}{1}, \frac{22}{7}, \frac{333}{106}, \frac{355}{113}, \dots\)

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Help with an algorithm for converting decimals to fractions - Thomas Klemm - 08-27-2014 10:32 PM



User(s) browsing this thread: 1 Guest(s)