Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Fastest method for comparing overlapping times in random time series

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64954] Re: Fastest method for comparing overlapping times in random time series
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Fri, 10 Mar 2006 05:14:45 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <dulspn$3an$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <dulspn$3an$1 at smc.vnet.net>,
 "Prince-Wright, Robert G SEPCO" <robert.prince-wright at shell.com> 
 wrote:

> I have two lists, list1{ {t1,t1+dt1}, {t2,t2+dt2},..{ti,ti+dti}}, and 
> list2, each representing 'time(i)' and corresponding 'time(i) + 
> deltatime(i)'. The time(i) values are determined by an exponential 
> inter-arrival time model, and the durations are a scaled uniform random 
> variable. Both lists are ordered on time(i). You can think of list 1 as 
> representing periods when System 1 is not working, and list 2 as the 
> periods when System 2 is not working. 
> ...
> The challenge is 
> to develop a fast method for determining the periods when both Systems 
> are not working, i.e. to create a list corresponding to the start and 
> finish times of the overlaps.

How about using Interval arithmetic?

 ints = Outer[IntervalIntersection, Interval /@ list1, Interval /@ list2]

 List @@ IntervalUnion @@ Flatten[ints]

For your data I get 

  {{0, 0}, 
   {7.9785370986659725, 7.9795152152343825},   
   {23.964317142793323, 24.053482621096574},   
   {31.09821651735643, 31.141635693642247},   
   {32.51349069353666, 32.5469642626066}}

Perhaps this will be sufficiently fast? Note that using Outer is 
inefficient because IntervalIntersection is commutative, so that each 
intersection is computed twice. This can be overcome by using Map 
instead of Outer. 
 
> Example lists are given as Cell Expressions below together with code to convert to a ticker-tape Plot 
> (you may need to stretch the graphic to see clearly). 

This Cell Expression was corrupted by some spurious ">" characters 
(possibly due to the code being "quoted"). For example,

>              RowBox[> {"{",
>                RowBox[{
>                "12.599440581844581", ",", "12.69944058184458"}], "}"}],

Cheers,
Paul

_______________________________________________________________________
Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    
AUSTRALIA                               http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: Fastest method for comparing overlapping times in random time series
  • Next by Date: Re: ndsolve & compile
  • Previous by thread: Re: Fastest method for comparing overlapping times in random time series
  • Next by thread: Re: Fastest method for comparing overlapping times in random time series