Max function for two array arguments

The max function does what I expect for two scalar arguments, but why is max([3,5],[1,6]) equal to [3,5] and max([2,5],[3,3]) equal to [3,3]?

I can get Fortran-like behavior with max.([3,5],[1,6]) which gives [3,6].

Here max is comparing [3,5] and [1,6] or [2,5] and [3,3], but comparison for vectors is lexicographic (that is, it compares the first element and each time it needs to break ties, it compares the next one, and so on)

7 Likes