Calculate the discrete Laplace
operator.
For a 2-dimensional matrix m this is defined as

1 / d^2 d^2 \
D = --- * | --- M(x,y) + --- M(x,y) |
4 \ dx^2 dy^2 /

For N-dimensional arrays the sum in parentheses is expanded to include second derivatives
over the additional higher dimensions.

The spacing between evaluation points may be defined by h, which is a
scalar defining the equidistant spacing in all dimensions. Alternatively,
the spacing in each dimension may be defined separately by dx, dy,
etc. A scalar spacing argument defines equidistant spacing, whereas a vector
argument can be used to specify variable spacing. The length of the spacing vectors
must match the respective dimension of m. The default spacing value
is 1.

At least 3 data points are needed for each dimension. Boundary points are
calculated from the linear extrapolation of interior points.

Return the factorial of n where n is a positive integer. If
n is a scalar, this is equivalent to prod (1:n). For
vector or matrix arguments, return the factorial of each element in the
array. For non-integers see the generalized factorial function
gamma.

Compute the greatest common divisor of the elements of a. If more
than one argument is given all arguments must be the same size or scalar.
In this case the greatest common divisor is calculated for each element
individually. All elements must be integers. For example,

Calculate the gradient of sampled data or a function. If m
is a vector, calculate the one-dimensional gradient of m. If
m is a matrix the gradient is calculated for each dimension.

[dx, dy] = gradient (m) calculates the one
dimensional gradient for x and y direction if m is a
matrix. Additional return arguments can be use for multi-dimensional
matrices.

A constant spacing between two points can be provided by the
s parameter. If s is a scalar, it is assumed to be the spacing
for all dimensions.
Otherwise, separate values of the spacing can be supplied by
the x, … arguments. Scalar values specify an equidistant spacing.
Vector values for the x, … arguments specify the coordinate for that
dimension. The length must match their respective dimension of m.

At boundary points a linear extrapolation is applied. Interior points
are calculated with the first approximation of the numerical gradient

y'(i) = 1/(x(i+1)-x(i-1)) * (y(i-1)-y(i+1)).

If the first argument f is a function handle, the gradient of the
function at the points in x0 is approximated using central
difference. For example, gradient (@cos, 0) approximates the
gradient of the cosine function in the point x0 = 0. As with
sampled data, the spacing values between the points from which the
gradient is estimated can be set via the s or dx,
dy, … arguments. By default a spacing of 1 is used.

For a vector argument, return the maximum value. For a matrix
argument, return the maximum value from each column, as a row
vector, or over the dimension dim if defined. For two matrices
(or a matrix and scalar), return the pair-wise maximum.
Thus,

max (max (x))

returns the largest element of the matrix x, and

max (2:5, pi)
⇒ 3.1416 3.1416 4.0000 5.0000

compares each element of the range 2:5 with pi, and
returns a row vector of the maximum values.

For complex arguments, the magnitude of the elements are used for
comparison.

If called with one input and two output arguments,
max also returns the first index of the
maximum value(s). Thus,

For a vector argument, return the minimum value. For a matrix
argument, return the minimum value from each column, as a row
vector, or over the dimension dim if defined. For two matrices
(or a matrix and scalar), return the pair-wise minimum.
Thus,

min (min (x))

returns the smallest element of x, and

min (2:5, pi)
⇒ 2.0000 3.0000 3.1416 3.1416

compares each element of the range 2:5 with pi, and
returns a row vector of the minimum values.

For complex arguments, the magnitude of the elements are used for
comparison.

If called with one input and two output arguments,
min also returns the first index of the
minimum value(s). Thus,

and is written such that the correct modulus is returned for
integer types. This function handles negative values correctly. That
is, mod (-1, 3) is 2, not -1, as rem (-1, 3) returns.
mod (x, 0) returns x.

An error results if the dimensions of the arguments do not agree, or if
either of the arguments is complex.

Note that if you need a specific number of primes you can use the
fact the distance from one prime to the next is, on average,
proportional to the logarithm of the prime. Integrating, one finds
that there are about k primes less than
k*log(5*k).