Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: List processing

  • To: mathgroup at
  • Subject: [mg37214] RE: List processing
  • From: "DrBob" <drbob at>
  • Date: Thu, 17 Oct 2002 00:08:33 -0400 (EDT)
  • Reply-to: <drbob at>
  • Sender: owner-wri-mathgroup at

Here's a very simple solution:

v = {{100, 200}, {150, 250}, {120, 270}, {300, 400}}; 
Interval @@ v
List @@ %

Interval[{100, 270},   {300, 400}]
{{100, 270}, {300, 400}}


-----Original Message-----
From: John Leary [mailto:leary at] 
To: mathgroup at
Subject: [mg37214]  List processing


This problem can be solved by conventional programming, but I wonder if 
there is an elegant Mathematica solution ?

A list contains pairs of values, with each pair representing the lower
upper edge of a sub-range.  Some of the sub-ranges partially overlap,
fully overlap, others don't overlap at all.  The problem is to produce a

second list that contains the overall upper and lower edges of the 
overlapping sub-ranges.

A simple example :  {{100,200},{150,250},{120,270},{300,400}}  would
in {{100,270},{300,400}}.

In the real case, the input list has several hundred elements and the 
output list typically has five elements.

I have a working solution based on loops, but there must be a more
one.  I would be very grateful for any suggestions.

Best regards

John Leary

  • Prev by Date: RE: List processing
  • Next by Date: Re: grouping and averaging {x,y} pairs of data
  • Previous by thread: RE: List processing
  • Next by thread: Re: List processing