[top][index]
search for:

substitute -- substitute values for variables

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]

o1 = R

o1 : PolynomialRing
i2 : f = x+2*y+3*z

o2 = x + 2y + 3z

o2 : R
i3 : substitute(f,{x=>x^3, y=>y^3})

      3     3
o3 = x  + 2y  + 3z

o3 : R
i4 : S = ZZ/101[z,y,x]

o4 = S

o4 : PolynomialRing
i5 : substitute(f,S)

o5 = 3z + 2y + x

o5 : 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 :

  • substitute(Divide,Thing)
  • substitute(Ideal,List)
  • substitute(Ideal,Matrix)
  • substitute(Ideal,Option)
  • substitute(Ideal,Ring)
  • substitute(Matrix,List)
  • substitute(Matrix,Matrix)
  • substitute(Matrix,Option)
  • substitute(Matrix,Ring)
  • substitute(Matrix,ZZ)
  • substitute(Module,List)
  • substitute(Module,Matrix)
  • substitute(Module,Option)
  • substitute(Module,Ring)
  • substitute(Power,Thing)
  • substitute(Product,Thing)
  • substitute(RingElement,List)
  • substitute(RingElement,Matrix)
  • substitute(RingElement,Option)
  • substitute(RingElement,Ring)
  • substitute(Sum,Thing)
  • substitute(Vector,List)
  • substitute(Vector,Matrix)
  • substitute(Vector,Option)
  • substitute(Vector,Ring)

  • [top][index]
    search for: