On Feb 11, 2007, at 3:22 AM, Carl Witty wrote:
> That's one of the uses of interval arithmetic. My own use for
> interval arithmetic is dealing with algebraic numbers. It is possible
> to do exact computations with algebraic numbers, but if the question
> you are asking is not too difficult then it is often far more
> efficient to compute with interval approximations of the numbers in
> question. Here "difficult" means "requires computing the sign of an
> algebraic number which is very close to 0"; so checking that
> (sqrt(2)+sqrt(3))^5 >= 300 is easy, since the true value of the left
> hand side is about 308.302, but checking that phi^150 <
> 22291846172619859445381409012498 is hard, since the two sides differ
> by less than 10^{-31}. (You need intervals with at least 217-bit
> mantissas to prove the latter fact; for proving the former, 8-bit
> mantissas suffice.)
Hmmmm.... apart from what's "mathematically correct", there is
another problem I just noticed.
According to
http://docs.python.org/ref/customization.html
it says "The only required property is that objects which compare
equal have the same hash value". We've already broken this rule
numerous times in SAGE. For example:
sage: R.<x> = PowerSeriesRing(ZZ)
sage: f = x + O(x^2)
sage: g = x + 2*x^2 + O(x^3)
sage: f == g
True
sage: hash(f), hash(g)
(813759615, 1049482705)
Ditto for the current implementation of RealInterval, pAdicField, etc.
I'm not sure exactly why the python people impose this rule. I guess
if you are looking up a key in a hashtable, you hash the key, look in
the appropriate bucket, loop over all items in the bucket. Things are
going to be pretty weird if the keys are something like a
RealInterval, but I still don't quite see why that rule is necessary.
David
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---