[sage list added]

"Travis E. Oliphant" <[EMAIL PROTECTED]> writes:

> The SAGE people may be interested in this, but I doubt there will more 
> than a handful of users of these algebraic base classes.

SAGE has quite a sophisticated type hierarchy, and a sophisticated set
of coercion methods.  What is done in SAGE should definitely be
consulted, since it is probably the most complex set of mathematical
types yet written in python.  The SAGE tutorial is at

  http://www.sagemath.org/doc/html/tut/tut.html

and Section 2.2 gives a brief introduction to numbers:

  http://www.sagemath.org/doc/html/tut/node9.html

The SAGE reference manual is at

  http://www.sagemath.org/doc/html/ref/index.html

Chapter 20:

  http://www.sagemath.org/doc/html/ref/node198.html

and nearby chapters are quite relevant for this discussion.

> For general purpose Python, I would do something like
>
> Complex
>    Rational_Complex
>      Integer_Complex
>    Floating_Complex  # uses hardware float
>    Decimal_Complex
>    Real
>      Rational
>        Integer
>      Floating        # uses hardware float
>      Decimal

Note also that double-precision reals are a subset of the rationals,
since each double precision real is exactly representable as a
rational number, but many rational numbers are not exactly
representable as double precision reals.  Not sure if this means
that reals should be a subclass of the rationals.

I believe that in SAGE these relationships aren't expressed using
subclassing.

Dan


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to