.., _range

Range operator

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


l .. r
_range(l, r)


l..r defines a “range” with the left bound l and the right bound r.

A range is a technical construct that is used to specify ranges of numbers when calling various system functions such as int, array, op, or the sequence operator $. Usually, l..r represents a real interval (e.g., int(f(x), x = l..r)), or the sequence of integers from l to r.

_range(l, r) is equivalent to l..r.

To create and operate on intervals in a mathematical sense, use the data type Dom::Interval.


Example 1

A range can be defined with the .. operator as well as with a call to the function _range:

_range(1, 42), 1..42

In the following call, the range represents an interval:

int(x, x = l..r)

Ranges can be used for accessing the operands of expressions or to define the size of arrays and hfarrays:

op(f(a, b, c, d, e), 2..4)

array(1..3, [a1, a2,a3])

hfarray(1..3, 1..2)

Ranges can also be used for creating expression sequences:

i^3 $ i = 1..5

Example 2

The range operator .. is a technical device that does not check its parameters with respect to their semantics. It just creates a range which is interpreted in the context in which it is used later. Any bounds are accepted:

float(PI) .. -sqrt(2)/3


l, r

Arbitrary MuPAD® objects

Return Values

Expression of type "_range".

Overloaded By

See Also

MuPAD Domains

MuPAD Functions