Previous Page Next Page Contents

.. -- range operator

Introduction

l..r defines a ``range'' with the left bound l and the right bound r.

Call(s)


l .. r _range(l, r)

Parameters

l, r - arbitrary MuPAD objects

Returns

an expression of type "_range".

Overloadable:

l, r

Related Functions

$, Dom::Interval

Details

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
                               1..42, 1..42

In the following call, the range represents an interval:

>> int(x, x = l..r)
                                   2    2
                                  r    l
                                  -- - --
                                  2    2

Ranges can be used for accessing the operands of expressions or to define the dimension of an array:

>> op(f(a, b, c, d, e), 2..4)
                                  b, c, d
>> array(1..3, [a1, a2,a3])
                              +-          -+
                              | a1, a2, a3 |
                              +-          -+

Ranges can also be used for creating expression sequences:

>> i^3 $ i = 1..5
                             1, 8, 27, 64, 125

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
                                            1/2
                                           2
                            3.141592654..- ----
                                            3

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000