Function: math[sortranges] - sorts ranges in numerical ascending order

Calling Sequence:

sortranges(seq);
sortranges(seq, 'reduce');

Parameters:

seq - a sequence of one or more ranges, RealRanges, and/or realcons

'reduce' - the name

Description:

sortranges sorts one or more range s, or RealRange s, or realcons in ascending order. The result is a sequence.

The two operands in the range or RealRange may be calls to the Open property function. -infinity or +infinity are accepted, as well.

If a realcons p is passed to sortranges, it is converted to a range p .. p.

If a range r actually is a point p, i.e. op(1, r) = op(2, r), then by specifying the optional last argument 'reduce' this range is returned as a realcons, otherwise the r is returned as a range.

This function is part of the math package, and so can be used only after performing the command with(math) or with(math, sortranges).

Examples:

> with(math, sortranges):

[Maple Math]

[Maple Math]

[Maple Math]
[Maple Math]

> sortranges(1 .. 2, -10 .. Open(0));

[Maple Math]

> sortranges(-3 .. -2, 1 .. Open(2), Open(2) .. infinity);

[Maple Math]

> sortranges(1, -2 .. Open(0));

[Maple Math]

> sortranges(3 .. 4, -1 .. -1, 1);

[Maple Math]

> sortranges(1 .. 2, 5 .. 7, 3 .. 3, -1 .. 0);

[Maple Math]

See Also:

convert/range , convert/RealRange , math/rangemembers , math/sortsols .

Version History:

Version 1.0 - June 09, 1998

Version 2.0 - October 19, 1998