Once a ring is defined that has variables, values can be given to these variables using substitute. We give an example.
i1 : R = ZZ/101[x,y,z]; |
i2 : f = x^3+3*y^2*z+2*z^3; |
i3 : substitute(f,matrix{{-1,2,5}}) |
i4 : substitute(f,{x=>-1,y=>2,z=>5}) |
The same command works for putting values into ideals or matrices. Also, it is not required that the values be elements from the coefficient ring, nor do you have to give a value for every variable.
i5 : M = matrix{{x^2,x-y},{x-z,z^2},{y-z,y^2}} |
i6 : substitute(M,matrix{{-1,2,x+y}}) |
i7 : I = ideal M |
i8 : substitute(I,{x=>-1,y=>2}) |