· Portal  Help Search Members Calendar 
Welcome Guest ( Log In  Register )  Resend Validation Email 
Welcome to Dozensonline. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access memberonly sections, and use many memberonly features such as customizing your profile, and sending personal messages. Registration is simple, fast, and completely free. (You will be asked to confirm your email address before we sign you on.) Join our community! If you're already a member please log in to your account to access all of our features: 
Dan 
Posted: Apr 4 2017, 04:26 AM


Dozens Disciple Group: Members Posts: 1,463 Member No.: 19 Joined: 8August 05 
Here are functions for converting rational numbers from the continued fraction representation [a, b, c, d, ...] to the Fraction object a+1/(b + 1/(c + 1/(d + ...))) that it represents.
I realize that recursion isn't the most efficient way of doing things (and throws an exception if you hit the 1000 stack frame limit), but it's simple. I may post an "optimized" version later. Note that since all finite float values are rational, they will all have a finite continued fraction representation. Some interesting "irrational" values are:


icarus 
Posted: Apr 4 2017, 09:17 PM


Dozens Demigod Group: Admin Posts: 1,913 Member No.: 50 Joined: 11April 06 
Mathematica has the ContinuedFraction command and does the same thing. For instance OEIS A003417 = e is generated by
This gives the first great gross of terms. (We could just use ContinuedFraction[E, 120] if we just wanted two dozen handfuls of terms.) We could also write a "cheat" for it:
This gives the first 3 dozen terms, recognizing it is 2, 1, 2, then repeats 1, 1, and 2(n/3) for every digit in a position that is congruent to 0 (mod 3). Unfortunately Mathematica (Wolfram) is really my only language that I use nowadays (unfortunate for it is proprietary and is not a widely known language because of it). At least Python has sympy and other packages that help it along mathwise. There is also PARI and Matlab. 

jrus 
Posted: Apr 19 2017, 10:16 PM

Regular Group: Members Posts: 195 Member No.: 1,156 Joined: 23October 15 

Ruthe 
Posted: Apr 26 2017, 08:28 PM


Regular Group: Members Posts: 360 Member No.: 47 Joined: 27February 06 
Romans had no way to represent most fractional values but relied on listing a value as the sum of ever smaller fractions up to a point they felt was of sufficient accuracy. These fractions were invariably submultiples of twelfths and eighths, written as the names of each fraction down to the smallest used by the Romans which was 1/2304 which is 1/(2^4 x 12^2) = approx 0.000434027 (Added this: or 0.0009 uncial) PPS The Romans used mainly twelfths for fractional values but also saw the usefullness of eighths, so had names for halves, quarters, eighths and sixteenths and their combinations with sub multiples of twelfths. They saw that 1/8 was just 1½ twelfths. 
