Working with Indeterminate in large numerical lists
- To: mathgroup at smc.vnet.net
- Subject: [mg100207] Working with Indeterminate in large numerical lists
- From: pfalloon <pfalloon at gmail.com>
- Date: Thu, 28 May 2009 04:28:07 -0400 (EDT)
Hi everyone, I'm wondering about the optimal way to work with Indeterminate in large matrices. I've been using this to replace "bad" data points that I want to prevent from polluting calculations involving lists of data, but I'm not sure I'm working as smartly as I could be. As an example, suppose I have a list of machine-precision reals and some Indeterminate elements: x = RandomSample[Join[RandomReal[1, 1000], ConstantArray [Indeterminate, 10]]; If I want to take only the valid entries, the best I have been able to find is something like: Select[x, NumberQ] This seems to work reasonably well. But if I want to specifically select the Indeterminate entries, there doesn't seem to be any function (equivalent to, say, "isnan" from another system), so I have to resort to something less succinct like Select[x, # === Indeterminate &] Does anyone have any suggestions on better ways to do this, or any general tips for working with Indeterminate in this context? I'm particularly keen to do things in the most efficient way possible as I'm working with rather large lists. Thanks, Peter.