up previous next
subst

substitute values for indeterminates

Syntax
subst(E: OBJECT, X, F): OBJECT
subst(E: OBJECT,[[X_1, F_1],...,[X_r, F_r]]): OBJECT
  where each X or X_i is an indeterminate
  and each F or F_i is a RINGELEM

Description
The first form of this function substitutes F_i for X_i in the expression E. The second form is a shorthand for the first in the case of a single indeterminate. When substituting for the indeterminates in order, it is easier to use eval .

Example
/**/  Use R ::= QQ[x,y,z,t];
/**/  F := x +y +z +t^2;
/**/  subst(F, x, -2);
t^2 +y +z -2

/**/  subst(F, [[x,x^2], [y,y^3], [z,t^5]]);
t^5 +y^3 +x^2 +t^2

/**/  eval(F, [x^2,y^3,t^5]); -- the same thing as above
t^5 +y^3 +x^2 +t^2

/**/  MySubst := [[y,1], [t, 3*z-x]];
/**/  subst(x*y*z*t, MySubst);  -- substitute into the function x*y*z*t
-x^2*z +3*x*z^2

See Also