substitute(f,v) -- substitute values for the variables in the matrix, module, vector, polynomial, or monomial f as specified by v.
If f is a matrix over R, and v is a 1 by k matrix over another ring S, then the result is obtained by substituting the entries in v for the variables in R.
If f is a module over R, then substitution amounts to substitution in the matrices of generators and relations defining the module. This is not the same as tensor product!
If v is a ring, then the result is obtained by substituting the variables of v for the variables of R with the same name. The substitution extends to the coefficient ring of R, and so on.
If v is a list of options {a => f, b => g, ...} then the variable a is replaced by the polynomial f, etc. Warning: this may lead to surprising results if the ring containing f and g doesn't have the same coefficient ring as the ring containing f, because currently no checking is done to see whether the substitution requested corresponds to a well-defined ring homomorphism.
i1 : R = ZZ/101[x,y,z] |
i2 : f = x+2*y+3*z |
i3 : substitute(f,{x=>x^3, y=>y^3}) |
i4 : S = ZZ/101[z,y,x] |
i5 : substitute(f,S) |
Warning: the specified substitution is not checked to see whether the corresponding ring homomorphism is well-defined; this may produce surprising results, especially if rational coefficients are converted to integer coefficients.
A convenient abbreviation for substitute is sub.
Ways to use substitute :