MathGroup Archive 2002

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

Search the Archive

Re: Stumped again on a simple list

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

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


As always with Mathematica, there are different ways of doing
something. This is another posibility:

	SetAttributes[f, Listable];
	f[x] := If[x < 100, 50, 200];

Julian Aguirre			| Voice:  +34 946012659
Departamento de Matematicas	| Fax:    +34 944648500
Universidad del Pais Vasco	| Postal: Aptdo. 644, 48080 Bilbao, Spain
				| email:  mtpagesj at

  • Prev by Date: Re: A problem with an integral
  • Next by Date: Re: Understanding the Output
  • Previous by thread: Re: Stumped again on a simple list
  • Next by thread: RE: Stumped again on a simple list