Re: The right type for the right job

Martin Rubey <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.general
Message-ID <[email protected]>
Dear Igor,

"Igor Khavkine" <[email protected]> writes:

> Say I have a few symbols [x,y,z,...] and a binary operagor g. I'm only
> interested in polynomials or rational functions with, say, integer
> coefficients in the formal expressions g(x,x), g(x,y), g(y,z), etc. Is there
> a type that restricts to just this sort of expressions? Expression Integer
> can handle them, but it will also allow other symbols like a,b,c,...  and
> different operators f(a), h(x,c), etc. None of the Polynomial or similar
> domains in Axiom can handle this situation because non-symbols like g(x,y).
> 
> What's the solution?

One possible solution is to mimick the internals of the expression domain. It
represents it's objects, i.e., the expressions, as rational functions with
the domain of variables being "Kernel EXPR INT".

So, let's start with polynomials. You first need a domain for the variables,
and that's the part where you will need to do some programming: it has to be an
OrderedSet, since SMP wants that. And it has to accomodate the symbols
specified by you as well as constructions like g(x,y), g(y,z) etc.

So you'll have something like

)abb domain IVD IgorsVariableDomain
IgorsVariableDomain: OrderedSet with
  
   makeAnElementOfThisDomain: DontKnowWhatGoesHere -> %

 == add

   makeAnElementOfThisDomain(s : DontKnowWhatGoesHere): % ==

   <<implement also all the operations of OrderedSet>>



The rational functions you then get for free, it is

FRAC SMP(INT, IgorsVariableDomain)

In fact, I suppose that this would be useful for the general public, too.

Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.