MathGroup Archive 2007

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81694] Re: Number of interval Intersections for a large number of intervals
  • From: Januk <ggroup at sarj.ca>
  • Date: Tue, 2 Oct 2007 05:23:42 -0400 (EDT)
  • References: <fdqd50$n7j$1@smc.vnet.net>

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