# .. (Range Specifier)

## Purpose:

Generates a series consisting of a monotonic range of numbers.

## Syntax:

start..increment..end

 start - A real. Starting value for the range. increment - Optional. A real. Step size for the range. Defaults to 1.0. end - A real. Ending value for the range.

A series.

## Example:

1..5

returns the series {1, 2, 3, 4, 5}.

## Example:

1..0.8..5

returns the series {1, 1.8, 2.6, 3.4, 4.2, 5}.

## Example:

5..1

returns {}, an empty series.

## Example:

5..-1..1

returns the series {5, 4, 3, 2, 1}.

## Example:

t = -2..0.01..2

f = 3

W1: sin(2*pi*f*t)

W1 contains 401 samples of a 3 Hertz sinewave over the range

–2 <= t <= 2

## Remarks:

The .. acts as a numeric range specification and can be used in array references. For example, the following statements:

a = {2, 4, 6, 8, 10, 12};

b = a[2..6];

c = a[2..2..6];

d = a[..];

f = a[6..-1..2];

assign the values to the variables a, b, c, d, and f as shown below:

a == {2, 4, 6, 8, 10, 12}

b == {4, 6, 8, 10, 12}

c == {4, 8, 12}

d == {2, 4, 6, 8, 10, 12}

f == {12, 10, 8, 6, 4}

The following statements:

u = ravel(1..16, 4);

v = u[1..3, 2..4];

w = u[.., 1..3];

x = u[1..3, ..];

y = u[..];

assign the values to the variables u, v, w, x, and y as shown below:

u == {{1, 5, 9,  13},

{2, 6, 10, 14},

{3, 7, 11, 15},

{4, 8, 12, 16}}

v == {{5, 9,  13},

{6, 10, 14},

{7, 11, 15}}

w == {{1, 5,  9},

{2, 6, 10},

{3, 7, 11},

{4, 8, 12}}

x == {{1, 5,  9, 13},

{2, 6, 10, 14},

{3, 7, 11, 15}}

y == {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}

As indicated by examples, the .. operator without a specified range implies all rows or columns. For tabular data, the .. operator by itself implies all the values of the table unraveled into a single column.

Assignments are also valid. For example, from above, the statement:

u[1..3, 1] = -1;

assigns the values to variable u as:

u == {{-1, 5,  9, 13},

{-1, 6, 10, 14},

{-1, 7, 11, 15},

{ 4, 8, 12, 16}}

Assigning elements to the empty series, {}, removes values. For example:

u[2, ..] = {}

Removes the 2nd row and returns the array:

{{-1, 5,  9, 13},

{-1, 7, 11, 15},

{ 4, 8, 12, 16}}

See END to specify the last array index or last array row or column index.

The range specifier can be implemented as:

gline(int((end-start)/inc)+1,1,inc,start)