> < ^ Date: Thu, 01 Sep 1994 11:52:00 +0200
> < ^ From: Alexander Hulpke <hulpke@math.colostate.edu >
< ^ Subject: Re: Substitutions in Polynomials

Dear GAP Forum,

Lewis McCarthy asked:

I'm looking for the GAP
equivalent of e.g. Maple's 'subs' procedure, which performs substitutions of
variables, expressions, etc. in expressions.

GAP has (and will hardly ever get) a command of the 'universality' of the
'subs' command in Maple. The reason is (among others) the way of
representing objects: Each GAP object is converted immediately to some kind
of 'normal form' (it is evaluated immediately) while Maple deals with some
kind of "expression sequence" (I do not have enough knowledge of Maple's
internal workings to be more specific here).
As a result, GAP does not need commands like 'collect',
'simplify' or 'normal'. (To be honest, this philosophy would break down when
trying to allow function fields like in Maple.)
On the other hand, this makes a generic "substitution" command unfeasible,
as objects might have completely different internal representations (The way
an object is printed out can be completely different from its internal
representation).

In particular, I'd like to
substitute a variable for an expression in a polynomial. I know I could
write a routine using Position and the list accessing functions, but matters
become complicated when it comes to, for example, exponents of the expression
to be replaced. Is there an easier way ?

You can use 'Value' to specialize the indeterminate to a value in the base
ring. The replacement value might contain the indeterminate again, i.e.
Value(f,x+1) would apply a Tschirnhaus transformation.
Replacements in the coefficients will require some user function to
work on the coefficients. However - unless you have a polynomial ring
over a polynomial ring - the coefficients will be evaluated expressions
already.

Probably I have not understood completely what you want to do (after all,
'subs' is a very 'universal' command). If you are stuck with your problem
after all, can you probably give a more specific description of the
transformation(s) you want to apply.

Alexander Hulpke


> < [top]