MathGroup Archive 2006

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

Search the Archive

Re: Remove Indeterminate elements

  • To: mathgroup at
  • Subject: [mg64309] Re: Remove Indeterminate elements
  • From: Bill Rowe <readnewsciv at>
  • Date: Fri, 10 Feb 2006 02:14:02 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 2/9/06 at 2:44 AM, berbas at (Baris Erbas) wrote:

>I have been trying to remove some elements of a list which should
>be quite straightforward. The list is as follows:

>All the components are real numbers apart from some Indeterminate
>expressions. I want the list without the Indeterminate terms. I
>have been trying to use Delete with If command but cannot succeed.

>Can anyone help please?

Instead of Delete which needs to know the position of the element to be removed try DeleteCases, i.e.,

data = {{x1, y1}, {x2, y2}, {xi, yi}, {Indeterminate, Indeterminate}, 
    {xn, yn}}; 

DeleteCases[data, {Indeterminate, _}]

{{x1, y1}, {x2, y2}, {xi, yi}, {xn, yn}}

In your particular example, whenever Interminate occurred in the second position it also occurred in the first. If this is always the case then the second argument I used for DeleteCases will do what you want. But if this is not the case the second argument would need to be changed thusly

DeleteCases[data, {Indeterminate, _} | {_, Indeterminate]

Another approach to solving this problem assuming all of the (xn,yn} pairs consisted of numeric items would be to use Cases, i.e.,

data = ReplacePart[
         Table[{Random[], Random[]}, {10}], 
         Indeterminate, {{4, 2}, {5, 1}, {2, 2}}]; 

Cases[data, {_?NumericQ, _?NumericQ}]

To reply via email subtract one hundred and four

  • Prev by Date: Re: Digital Image Processing: showing graylevel images in
  • Next by Date: Re: Number-Theory :: All-Digit Perfect Squares
  • Previous by thread: Re: Remove Indeterminate elements
  • Next by thread: Poisson equation