Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The first line gets a single sample path for an M/M/1 queue for time between 0 and 100. No problem, I can plot it, etc.

td = RandomFunction[QueueingProcess[9, 10], {0, 100}, 1];

Next, I want to look at the sample path of the process between time 10 and 50, so I do

subset = td["Part", 1, {10, 50}];

and MMA crashes on me. Ver 9.0.1.0 on windows 7 64 bit.

Any suggestions?

share|improve this question
1  
try td["Part", 1, {10, 50, 1}] –  belisarius Apr 8 '13 at 15:42
    
Thanks for that suggestion, it does stop it from crashing, but then I only get the subset at the 1 time unit resolution. I really want it at at all points of change. –  PeterR Apr 8 '13 at 15:53

1 Answer 1

up vote 9 down vote accepted

This is clearly a bug in part extraction for TemporalData. You can work around it by giving your times explicitly.

subset = td["Part", 1, {Cases[td["PathTimes"], x_ /; 10 <= x <= 50]}]

I have a feeling this is more in the spirit of what you want here anyway.

The "Part" property resamples the data so that it is uniformly spaced if you give {tmin, tmax, dt}. You omit the dt so it has to be inferred. In your case it should be trying to use the smallest time step in your data. This will result in a very large data object in this case because the smallest step is incredibly small compared to the time range you want.

EDIT

It is additionally worth mentioning that "Part" uses the "PathFunctions" to build the subset. When you just want a window it can be unnecessarily expensive for continuous time process data. It is trivial to get what you want from the data itself and avoid building "PathFunctions".

Cases[td["Path", 1], {t_/; 10<=t<=50, _}]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.