MathGroup Archive 2013

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

Search the Archive

Re: ReplacePart -> eliminate


On 9/16/13 at 5:27 AM, Roberto.Brambilla at rse-web.it (Brambilla
Roberto Luigi (RSE)) wrote:

>I'd like to eliminate the Indeterminate  (or other non-numerical
>terms, as Infinite, etc...) items. Es.

>x = {-1.25664, 0.628319, -0.628319, 1.25664, Indeterminate, -1.25664,
>0.628319, -0.628319, 1.25664, Indeterminate};

>or

>x=Table[1/(3 - n), {n, 0, 5}]) {1/3, 1/2, 1, ComplexInfinity,
>-1,-1/2}

>How can I do it with a simple command?

In[1]:= x = {-1.25664, 0.628319, -0.628319, 1.25664,
   Indeterminate, -1.25664, 0.628319, -0.628319, 1.25664,
   Indeterminate};
Cases[x, _?NumericQ]

Out[2]= {-1.25664,0.628319,-0.628319,1.25664,-1.25664,0.628319,-0.628319, 1.25664}

In[3]:= x = Table[1/(3 - n), {n, 0, 5}];
Cases[x, _?NumericQ]

Out[4]= {1/3, 1/2, 1, -1, -(1/2)}




  • Prev by Date: Re: very odd failure of Solve
  • Next by Date: Re: Writing numeric data to CSV does not write final EOL
  • Previous by thread: ReplacePart -> eliminate
  • Next by thread: Re: ReplacePart -> eliminate