i1 : X = for i from 1 to 10 list random(100)
o1 = {24, 65, 71, 72, 19, 19, 91, 72, 93, 79}
o1 : List
|
i2 : max X o2 = 93 |
If L contains elements in a polynomial ring, the MonomialOrder of the ring is used for comparisons.
i3 : R1 = QQ[x, y, z, MonomialOrder => Lex]; |
i4 : max {x*y^2, x*y^2 + z^2, y^4, y*z^5}
2 2
o4 = x*y + z
o4 : R1
|
i5 : R2 = QQ[x, y, z, MonomialOrder => GRevLex]; |
i6 : max (x*y^2, x*y^2 + z^2, y^4, y*z^5)
5
o6 = y*z
o6 : R2
|
More generally, the order of the elements is determined using the ? operator.
If X is a list of lists, max acts on the outermost level.
i7 : max {{3, 1, 2}, {2, 9, 6}, {3, 7, 5}}
o7 = {3, 7, 5}
o7 : List
|
i8 : max flatten {{3, 1, 2}, {2, 9, 6}, {3, 7, 5}}
o8 = 9
|
The object max is a method function with a single argument.