MathGroup Archive 2002

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

Search the Archive

RE: Extraction of positive values from list of both +/- values

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34653] RE: [mg34637] Extraction of positive values from list of both +/- values
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Fri, 31 May 2002 04:26:31 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

First of all, in your example,

lst=Take[lstvals, 7]

doesn't select all the positive values.  (Possibly that other +100 in
position 9 is a typo?)

Secondly, you didn't say... and the typo obscures if you meant to say...
that you intend lstvals to be in reverse (rather than arbitrary) order.
For large lists you might want to take advantage of structure like that
in the task of selecting the positive entries.

Otherwise, the following does what you want:

posVals = Select[lstvals, Positive]

Bobby


-----Original Message-----
From: O.A. Linares, M.D., Ph.D. [mailto:divinesaam at aol.com] 
To: mathgroup at smc.vnet.net
Subject: [mg34653] [mg34637] Extraction of positive values from list of both +/-
values

Dear Colleagues,

I have a list of values:

lstvals={700, 600, 500, 400, 300, 200, 100, -50, 100, -200, -300}

I want to create a list that contains only the positive values. I know I
can use 

lst=Take[lstvals, 7]

The problem is, the size of the vectors vary. Help appreciated.

Thanks,

Oscar





  • Prev by Date: Re: Pb Limit ArcTan to : - Infinity
  • Next by Date: RE: Mathematica graphs in PowerPoint
  • Previous by thread: RE: Extraction of positive values from list of both +/- values
  • Next by thread: RE: Extraction of positive values from list of both +/- values