rlwhitcomb / utilities

Some of my personal utility programs
MIT License
2 stars 0 forks source link

Add Calc functions to compute the continued fraction representation of any number and the number from its continued fraction #643

Open rlwhitcomb opened 6 months ago

rlwhitcomb commented 6 months ago

See here: https://en.wikipedia.org/wiki/Continued_fraction and here: https://www.johndcook.com/blog/2013/01/30/rational-approximations-to-e/

And for pi here: https://oeis.org/A001203

We can use the general function to compute both pi and e and phi and other things (arctan ?) both to rational approximations as well as their decimal expansions to arbitrary places ....

We could even allow the continued fraction notation as in [a0; a1, a2, a3...] (where the first comma position is a semicolon instead) as a new data type.

rlwhitcomb commented 1 month ago

Here's another good (simple to understand) article: https://pi.math.cornell.edu/~gautam/ContinuedFractions.pdf

Suggest a new ContinuedFraction object with expected contents. "inverse()" is a simple method (see the paper) for rational.

Good correspondence between ContinuedFraction and BigFraction (interchangeable values, etc.)