Re: Stumped again on a simple list

*To*: mathgroup at smc.vnet.net*Subject*: [mg32813] Re: Stumped again on a simple list*From*: AGUIRRE ESTIBALEZ Julian <mtpagesj at lg.ehu.es>*Date*: Thu, 14 Feb 2002 01:43:28 -0500 (EST)*Organization*: Universidad del Pais Vasco/Euskal Herriko Unibertsitatea*References*: <a4auba$bu0$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On Tue, 12 Feb 2002, 1.156 wrote: > > I make a simple list ii and I find I can make other lists easily by > algebraic moves like jj=ii/2, etc. But when I want make a new list > which splits two different formula, I'm stumped. > > Here's a stripped down version to illustrate my problem. I want to > use the value in the original array to determine how to make the new > array. The If[] is the only thing I can find to make this decision. > But, it seems I'm not even close when I try: > > > ii=Table[z,{z,50,1400,5}]; > > jj=If[ii<100,50,200] Define the function that determines the new array f = If[# < 100, 50, 200]& Map the function to the original array f/@ii As always with Mathematica, there are different ways of doing something. This is another posibility: Clear[f]; SetAttributes[f, Listable]; f[x] := If[x < 100, 50, 200]; f[ii] Julian Aguirre | Voice: +34 946012659 Departamento de Matematicas | Fax: +34 944648500 Universidad del Pais Vasco | Postal: Aptdo. 644, 48080 Bilbao, Spain | email: mtpagesj at lg.ehu.es