Macaulay2 » Documentation
Packages » Macaulay2Doc » rings » manipulating polynomials » size
next | previous | forward | backward | up | index | toc

size -- the size of an object

Description

size x returns the size of x, which usually gives a rough indication of memory space required to store it.

For a polynomial, the size is the number of terms.

i1 : R = QQ[x,y,z,w]

o1 = R

o1 : PolynomialRing
i2 : f = z^2 - y*w

      2
o2 = z  - y*w

o2 : R
i3 : size f

o3 = 2

For lists, size reports the capacity of the underlying sequence, which may exceed the number of elements when the list is mutable. This reflects the amount of memory currently allocated to allow efficient growth without reallocating on every insertion.

i4 : x = new MutableList

o4 = MutableList{}

o4 : MutableList
i5 : x#5 = 2;
i6 : #x

o6 = 6
i7 : size x

o7 = 8

Ways to use size:

  • size(BasicList)
  • size(RingElement)

For the programmer

The object size is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.26.11+ds/M2/Macaulay2/packages/Macaulay2Doc/doc_rings.m2:327:0.