axiom-math
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-math] POLY INT =\\= UP(x, INT)


From: William Sit
Subject: Re: [Axiom-math] POLY INT =\\= UP(x, INT)
Date: Fri, 10 Oct 2003 02:55:07 -0400

Dylan Thurston wrote:
> 
> On Wed, Oct 08, 2003 at 05:20:20PM -0400, Page, Bill wrote:
> > SetCategory exports only one function, = . ...
> 
> I was shocked by this, so I went and checked.  It's worse than that:
> SetCategory exports equality, printing (standard and LaTex), and
> hashing.  This was my major peeve with the Haskell type system (in
> Haskell terms, Print and Eq are parents of the Num class).
> 
> For a good reason why all 3 of these functions are absolutely wrong as
> parents of, say, Ring, consider trying to define a type of constructible
> reals: numbers that lazily compute themselves to as many digits as
> requested.  There are good algorithms for doing this, and it would be
> immensely useful for a CAS like AXIOM, but there is no way to make it
> support equality, printing, or hashing.  (Well, for printing you would
> probably just have it print some number of digits.  But how many digits?
> That really needs to be a parameter, but there's no room for that here.)
> 
> As another way to see that these definitions are wrong, consider that
> "printing" has nothing at all to do with the structure of, say, a group.
> If you have a function that needs its arguments to be both in a group
> and printable, it should say so, not have it be implied by the type
> system!
> 
> Peace,
>         Dylan

There seems to be some misunderstanding of the inheritance mechanism of the
Axiom hierarchy. Even though most types (group, ring, etc) are descendents of
SetCategory, and we all know that the word problem in group theory is in general
unsolvable, it does not mean that when a particular group or ring that has an
equality testing algorithm that this function must be inherited from the
SetCategory one. In fact, in any descendent domain the set equality function
will be overriden whenever the descendent actually defines equality. If the
descendent does not, then it is inherited, say, from the equality function of
the data-representation.  If a finite group has its elements somehow encoded by
a bijection to a set of integers, it would be reasonable, though not obligatory,
to inherit the equality test from integers. This inheritance can be explicitly
given as, for example,
  x = y == x$Rep = y$Rep

The same holds for the print function. Each domain can have its own print
function, or inherit it from the domain that is used as its representation.

  print(x) == print(x$Rep)

To print real numbers to a certain number of digits, one possible way is to do
something like in Mathematica SetPrecision or SetAccuracy. But in Axiom, because
the same mathematical objects can often be represented differently (for example,
a real number represented by decimal expansion or continued fraction or as root
of a polynomial if the number is algebraic), setting a global value is not a
good idea. Instead, the domain that uses the decimal expansion would have such a
parameter, the domain that uses continued fraction will have a different
parameter (the length of the continued fraction), and the domain for algebraic
numbers as a root of polynomial would not need any (the variable of the
polynomial is usually system generated using a symbol such as %).


William
-- 
William Sit
Department of Mathematics..............Email: address@hidden
City College of New York..........................Tel: 212-650-5179
Convent Ave at West 138th Street..................Fax: 212-862-0004
New York, NY 10031.....Asian Symposium on Computer Mathematics 2003
USA..........................http://www.mmrc.iss.ac.cn/~ascm/ascm03




reply via email to

[Prev in Thread] Current Thread [Next in Thread]