next | previous | forward | backward | up | top | index | toc | home

maxPosition -- position of largest element

Synopsis

Description

If the largest element occurs more than once, then the first occurrence is used. If x has length 0 an error results.
i1 : maxPosition {1,6,4,2}

o1 = 1
Notice that the position of the maximal element is 1, as indexing in Macaulay 2 always starts at 0.

For elements in a polynomial ring, the order used is the monomial order associated with the ring.

i2 : R = QQ[r,s,x,y,z];
i3 : z^2 + x*y + s*z

                  2
o3 = x*y + s*z + z

o3 : R
i4 : maxPosition {z^2, s*z, x*y}

o4 = 2
i5 : maxPosition(z^2, s*z, x*y)

o5 = 2

See also

Ways to use maxPosition :