Home Online Manual
Back: vector declarations
Forward: vector operations
FastBack: string
FastForward: User defined types
Up: vector
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.20.2 vector expressions

A vector expression is:

  1. an identifier of type vector
  2. a function returning vector
  3. a polynomial expression (via the canonical embedding p ==> p*gen(1))
  4. vector expressions combined by the arithmetic operations + or -
  5. a polynomial expression and a vector expression combined by the arithmetic operation *
  6. a type cast to vector using the brackets [ , ]


  // ordering gives priority to components:
  ring rr=0,(x,y,z),(c,dp);
  vector v=[x2+y3,2,0,x*y]+gen(6)*x6;
==> [y3+x2,2,0,xy,0,x6]
  vector w=[z3-x,3y];
==> [y3-z3+x2+x,-3y+2,0,xy,0,x6]
==> [xy3+y3z+x3+x2z,2x+2z,0,x2y+xyz,0,x7+x6z]
  // ordering gives priority to monomials:
  // this results in a different output
  ring r=0,(x,y,z),(dp,c);
==> x6*gen(6)+y3*gen(1)+x2*gen(1)+xy*gen(4)+2*gen(2)

See Type conversion and casting; ring.