max(x [,squeeze:T] [,silent:T,undefval:U]), x REAL or LOGICAL or a structure with REAL or LOGICAL components, U a REAL scalar max(x, dimensions:J [,squeeze:T] [,silent:T,undefval:U]), vector of positive integers J max(x, margins:K [,squeeze:F] [,silent:T,undefval:U]), vector of positive integers K max(x1,x2,... [,silent:T,undefval:U]), x1, x2, ... REAL or LOGICAL vectors, all the same type. |

max(x) computes the maximum of the elements of a REAL or LOGICAL vector x. If x is LOGICAL, True is interpreted as 1.0 and False as 0.0 and hence max(x) is 1.0 if any element of x is True, and 0.0 if all elements are False. If x is a m by n matrix, max(x) computes a row vector (1 by n matrix) consisting of the maxima of the elements in each column of x. If x is an array with dimensions n1, n2, n3, ..., y <- max(x) computes an array with dimensions 1, n2, n3, ... such that y[1,j,k,...] = max(x[i,j,k,...], i=1,...,n1). This is consistent with what happens when x is a matrix. Note: MacAnova3.35 and earlier produced a result with dimensions n2, n3, ... . max(x, squeeze:T) does the same, except the first dimension of the result (of length 1) is squeezed out unless the result is a scalar. In particular, if x is a matrix, max(x,squeeze:T) will be identical to vector(max(x)), and if x is an array, max(x,squeeze:T) will be identical to array(max(x),dim(x)[-1]). max(NULL) is NULL. max(a,b,c,...) is equivalent to max(vector(a,b,c,...)) if a, b, c, ... are all vectors. They must all have the same type, REAL or LOGICAL, or be NULL. max(NULL,NULL,...,NULL) is NULL. min(x, silent:T) or min(a,b,c,...,silent:T) does the same but suppresses warning messages about MISSING values. If all the elements of a vector x are MISSING, max(x) is MISSING. max(x, undefval:U), where U is a REAL scalar does the same, except the returned value is U when all the elements of x are MISSING. max(x, dimensions:J [,squeeze:T] [,silent:T] [undefval:U]) finds the maximum over the dimensions in J = vector(j1,j2,...,jn) where j1, ..., jn are distinct positive integers <= ndims(x). Without 'squeeze:T', the result has the same number of dimensions as x, with dimensions j1, j2, ..., jn of length 1. With 'squeeze:T', these dimensions are removed from the result. The order of j1, j2, ... is ignored. It is an error if max(J) > ndims(x) or if there are duplicate elements in J. For example, if x is a matrix, max(x, dimensions:2) computes the row maxima as a nrows(x) by 1 matrix and max(x, dimensions:2,squeeze:T) computes them as a one dimensional vector. max(x, margins:K [,squeeze:F] [,silent:T] [undefval:U]) finds the maxima over the dimensions not in K = vector(k1, k2, ..., km), where k1, ..., km are distinct positive integers <= ndims(x). This computes maxima for the margins specified in K. Without 'squeeze:F', only the dimensions in K are retained in the result. Otherwise the other dimensions are retained but have length 1. This is opposite from the default with 'dimensions:J'. It is an error if max(K) > ndims(x) or if there are duplicate elements in K. If x is a structure, max(x [dimensions:J or margins:K] [,squeeze:T or F] [,silent:T] [undefval:U]) computes a structure, each of whose components is max() applied to that component of x. Examples: Cmd> x # matrix with labels B1 B2 A1 18 15 A2 17 26 A3 18 19 Cmd> max(x) # maxima down columns B1 B2 (1) 18 26 Cmd> max(x,dimensions:2) # maxima across rows; 3 by 1 matrix (1) A1 18 A2 26 A3 19 Cmd> max(x,dimensions:2,squeeze:T) # same, length 3 vector A1 A2 A3 18 26 19 Cmd> max(x,margins:1) # same as preceding A1 A2 A3 18 26 19 See also topics min(), 'NULL'.

Gary Oehlert 2003-01-15