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: [mg34644] RE: [mg34637] Extraction of positive values from list of both +/- values
  • From: Juan Egea Garcia <jeg at um.es>
  • Date: Fri, 31 May 2002 04:26:19 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Oscar, try whith Select[list,crit] and pure functions:

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

positive=Select[lstvals,#>0&]

if you want to extract the negative values you have just to write #<0&
instead of #>0&, and in the same way with any other criteria.

============================
Juan Egea Garcia
Atica - Dpto. Matematica Aplicada
Universidad de Murcia - http://www.um.es
España

+34 968367144


-----Mensaje original-----
De: O.A. Linares, M.D., Ph.D. [mailto:divinesaam at aol.com]
Enviado el: jueves, 30 de mayo de 2002 8:55
Para: mathgroup at smc.vnet.net
Asunto: [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: Function as an argument of the function
  • Next by Date: Re: Pb Limit ArcTan to : - Infinity
  • 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