17.9 Mathematical Constants

 
: A = e
: A = e (n)
: A = e (n, m)
: A = e (n, m, k, …)
: A = e (…, class)

Return a scalar, matrix, or N-dimensional array whose elements are all equal to the base of natural logarithms.

The constant ‘e’ satisfies the equation log (e) = 1.

When called with no arguments, return a scalar with the value e.

When called with a single argument, return a square matrix with the dimension specified.

When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions.

The optional argument class specifies the return type and may be either "double" or "single".

See also: log, exp, pi, I.

 
: p = pi
: p = pi (n)
: p = pi (n, m)
: p = pi (n, m, k, …)
: p = pi (…, class)

Return a scalar, matrix, or N-dimensional array whose elements are all equal to the ratio of the circumference of a circle to its diameter.

When called with no arguments, return a scalar with the value of pi.

When called with a single argument, return a square matrix with the dimension specified.

When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions.

The optional argument class specifies the return type and may be either "double" or "single".

See also: e, I.

 
: A = I
: A = I (n)
: A = I (n, m)
: A = I (n, m, k, …)
: A = I (…, class)

Return a scalar, matrix, or N-dimensional array whose elements are all equal to the pure imaginary unit, defined as sqrt (-1).

I, and its equivalents i, j, and J, are functions so any of the names may be reused for other purposes (such as i for a counter variable).

When called with no arguments, return a scalar with the value i.

When called with a single argument, return a square matrix with the dimension specified.

When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions.

The optional argument class specifies the return type and may be either "double" or "single".

See also: e, pi, log, exp.

 
: A = Inf
: A = Inf (n)
: A = Inf (n, m)
: A = Inf (n, m, k, …)
: A = Inf (…, class)

Return a scalar, matrix or N-dimensional array whose elements are all equal to the IEEE representation for positive infinity.

Infinity is produced when results are too large to be represented using the IEEE floating point format for numbers. Two common examples which produce infinity are division by zero and overflow.

[ 1/0 e^800 ]
⇒ Inf   Inf

When called with no arguments, return a scalar with the value ‘Inf’.

When called with a single argument, return a square matrix with the dimension specified.

When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions.

The optional argument class specifies the return type and may be either "double" or "single".

See also: isinf, NaN.

 
: val = NaN
: val = NaN (n)
: val = NaN (n, m)
: val = NaN (n, m, k, …)
: val = NaN (…, "like", var)
: val = NaN (…, class)

Return a scalar, matrix, or N-dimensional array whose elements are all equal to the IEEE symbol NaN (Not a Number).

NaN is the result of operations which do not produce a well defined numerical result. Common operations which produce a NaN are arithmetic with infinity (Inf - Inf), zero divided by zero (0/0), and any operation involving another NaN value (5 + NaN).

Note that NaN always compares not equal to NaN (NaN != NaN). This behavior is specified by the IEEE standard for floating point arithmetic. To find NaN values, use the isnan function.

When called with no arguments, return a scalar with the value ‘NaN’.

When called with a single argument, return a square matrix with the dimension specified.

When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions.

If a variable var is specified after "like", the output val will have the same data type, complexity, and sparsity as var.

The optional argument class specifies the return type and may be either "double" or "single".

See also: isnan, Inf.

 
: d = eps
: d = eps (x)
: d = eps (n, m)
: d = eps (n, m, k, …)
: d = eps (…, class)

Return a scalar, matrix or N-dimensional array whose elements are all eps, the machine precision.

More precisely, eps is the relative spacing between any two adjacent numbers in the machine’s floating point system. This number is obviously system dependent. On machines that support IEEE floating point arithmetic, eps is approximately 2.2204e-16 for double precision and 1.1921e-07 for single precision.

When called with no arguments, return a scalar with the value eps (1.0).

Given a single argument x, return the distance between x and the next largest value.

When called with more than one argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions. The optional argument class specifies the return type and may be either "double" or "single".

See also: realmax, realmin, intmax, flintmax.

 
: Rmax = realmax
: Rmax = realmax (n)
: Rmax = realmax (n, m)
: Rmax = realmax (n, m, k, …)
: Rmax = realmax (…, class)

Return a scalar, matrix, or N-dimensional array whose elements are all equal to the largest floating point number that is representable.

The actual value is system dependent. On machines that support IEEE floating point arithmetic, realmax is approximately 1.7977e+308 for double precision and 3.4028e+38 for single precision.

When called with no arguments, return a scalar with the value realmax ("double").

When called with a single argument, return a square matrix with the dimension specified.

When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions.

The optional argument class specifies the return type and may be either "double" or "single".

See also: realmin, intmax, flintmax, eps.

 
: Rmin = realmin
: Rmin = realmin (n)
: Rmin = realmin (n, m)
: Rmin = realmin (n, m, k, …)
: Rmin = realmin (…, class)

Return a scalar, matrix, or N-dimensional array whose elements are all equal to the smallest normalized floating point number that is representable.

The actual value is system dependent. On machines that support IEEE floating point arithmetic, realmin is approximately 2.2251e-308 for double precision and 1.1755e-38 for single precision.

When called with no arguments, return a scalar with the value realmin ("double").

When called with a single argument, return a square matrix with the dimension specified.

When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions.

The optional argument class specifies the return type and may be either "double" or "single".

See also: realmax, intmin, eps.