MathGroup Archive 2007

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

Search the Archive

Re: Number of interval Intersections for a large number of intervals


Using the command Cases with IntervalMemberQ seems to be pretty quick:

intervallist = Table[Interval[{i, i + 1}], {i, 1, 20000, .25}];
number = 5.5;
Cases[intervallist, _?(IntervalMemberQ[#, number] &)] // Timing

Januk

On Oct 1, 5:03 am, P_ter <peter_van_summe... at yahoo.co.uk> wrote:
> Hello,
> I have as example on the interval [0.0,12000.0] thousands of smaller intervals which overlap. I construct for each interval a UnitStep up and one down(a block). I order and sum them and I give it to Reduce with the question Reduce[SumOfAllBlocks[x]==<number>,x]. The result gives me the overlapping intervals  which overlap <number>. From the result I take out the length of the overlaps and Tally them. It is safe, but slow.
> Does anyone know something about this type of problems? With better algorithms?




  • Prev by Date: Re: Sort problem
  • Next by Date: Re: Other bug in ContourPlot
  • Previous by thread: Number of interval Intersections for a large number of intervals
  • Next by thread: Re: Number of interval Intersections for a large number of intervals