CoCoA:Len

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Len

the length of an object

Description

This function returns the length of an object, as summarized in

the table below:

<verbatim>

     ----------------------------------------------
    | type   | length                              |
    -----------------------------------------------|
    | IDEAL  | length of Gens(E)                   |
    | INT    | 1                                   |
    | LIST   | number of items in the list         |
    | MAT    | number of rows of the matrix        |
    | MODULE | length of Gens(E)                   |
    | POLY   | number of monomials                 |
    | RATFUN | if E=F/G, then Len(E)=Len(F)+Len(G) |
    | VECTOR | number of components                |
     ----------------------------------------------
              The operator Len

</verbatim>

Example

  Use R ::= Q[x,y];
  L := [<quotes>a</quotes>,2,3,[4,5]];
  Len(L);
4
-------------------------------
  Len(L[1]);
1
-------------------------------
  Len(L[4]);
2
-------------------------------
   Len(x^2 + xy + y^2 + xy^4);
4
-------------------------------
  Len((x^2+y^2)/(x+y+y^2));
5
-------------------------------
  Len((x+y) - (xy/x));
1
-------------------------------
  Len(Ideal(x,x^2));
2
-------------------------------

The function <ttref>Size</ttref> returns the amount of memory used by the object.

Syntax

Len(E:OBJECT):INT

Count

Size

   <type>ideal</type>
   <type>integer</type>
   <type>list</type>
   <type>matrix</type>
   <type>module</type>
   <type>polynomial</type>
   <type>ratfun</type>
   <type>vector</type>