Discussion:
[Axiom-math] The right type for the right job
Igor Khavkine
2006-08-22 02:00:08 UTC
Permalink
Looking at this thing I would say that if you take
R = Q[s,c] -- polynomial ring in two variables over rationals
I = (s^2+c^2-1)R -- ideal in R
A = R/I -- factor structure
S = A[[x]] -- formal power series
then S would be a perfect candidate for the result type of the above
expression. And there is no "Expression Integer".
While constructing the result of "series", Axiom should try hard to get
a reasonable (in some sense minimal) type for the result.
The above is a very nice example of a domain for a restricted use,
where only the algebraic relation s^2+c^2=1 is important in the
coefficients of the power series we wish to work with.

I have a very different purpose in mind, and I wonder if anyone can
come up with the right type for it. 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?

Igor
Martin Rubey
2006-08-22 05:50:15 UTC
Permalink
Dear Igor,
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
Ralf Hemmecke
2006-08-22 11:57:50 UTC
Permalink
Hi igor,

[...]
Post by Igor Khavkine
The above is a very nice example of a domain for a restricted use,
where only the algebraic relation s^2+c^2=1 is important in the
coefficients of the power series we wish to work with.
I have a very different purpose in mind, and I wonder if anyone can
come up with the right type for it. 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?
Your coefficients are integers your variables are "formal expressions"
of the form "g(x,y)" where x and y are from a fixed (finite) set of
variables. That is VERY easy. Assume you have n variables in the set
V={x,y,...,z} then the set of "formal" expressions

W = {g(x,x), g(x,y), ..., g(y, x), g(y,y), ..., g(z,z)}

has exactly n^2 elements.

If you form the rational function field

Q(T_xx, T_xy, ..., T_yx, T_yy, ..., T_zz)

you have exactly what you described above.

BTW, I strongly believe that what you described is not what you want.
Read my previous mail
http://lists.nongnu.org/archive/html/axiom-math/2006-08/msg00029.html
where I describe that / is not available for the rational numbers if you
just consider them to be a ring.

That is the same here. What you get is a field of rational functions,
but you certainly see easily that you cannot express
g(x, g(x,y)) in that ring. But, it is your fault. You did not give a
proper specification. If you want to talk to a computer you have to be
precise. You cannot expect that it guesses, that your specification
might not be the thing you want. Current computer systems are in general
not that advanced (yet).
Post by Igor Khavkine
None of the Polynomial or
similar domains in Axiom can handle this situation because non-symbols
like g(x,y).
Have you ever tried to convert g(x,y) into a symbol?
I cannot do it since you haven't given me the type of g(x,y). But if we
could say for a moment that we consider "g(x,y)" then I just type...

"g(x,y)"::Symbol

at the axiom prompt and get

(2) g(x,y)
Type: Symbol

So don't say, it's not a symbol.

Ralf

Loading...