How about adding rational fraction to Python?
M.-A. Lemburg
mal at egenix.com
Mon Feb 25 10:56:29 CET 2008
If you're interested in rationals, then you might want to have a look
at mxNumber which is part of the eGenix mx Experimental
Distribution:
http://www.egenix.com/products/python/mxExperimental/mxNumber/
It provides fast rational operations based on the GNU MP
library.
On 2008-02-25 07:58, Carl Banks wrote:
> On Feb 24, 10:56 pm, Mensanator <mensana... at aol.com> wrote:
>> But that doesn't mean they become less manageable than
>> other unlimited precision usages. Did you see my example
>> of the polynomial finder using Newton's Forward Differences
>> Method? The denominator's certainly don't settle out, neither
>> do they become unmanageable. And that's general mathematics.
>
> No, that's a specific algorithm. That some random algorithm doesn't
> blow up the denominators to the point of disk thrashing doesn't mean
> they won't generally.
>
> Try doing numerical integration sometime with rationals, and tell me
> how that works out. Try calculating compound interest and storing
> results for 1000 customers every month, and compare the size of your
> database before and after.
It is well possible to limit the denominator before storing it
in a database or other external resource using Farey neighbors:
http://en.wikipedia.org/wiki/Farey_sequence#Farey_neighbours
mxNumber implements an algorithm for this (not the most efficient
one, but it works nicely).
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Feb 25 2008)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-list
mailing list