Re: Stumped again on a simple list
- To: mathgroup at smc.vnet.net
- Subject: [mg32823] Re: [mg32795] Stumped again on a simple list
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Thu, 14 Feb 2002 01:43:45 -0500 (EST)
- References: <200202121123.GAA12116@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
A few ways come to mind at once. Surely there are many more.
In[1]:=
ii = Table[z, {z, 50, 1400, 5}];
In[2]:=
jj = (If[#1 < 100, 50, 200] & ) /@ ii;
In[3]:=
jj = ii /. (z_)?NumberQ -> If[z < 100, 50, 200];
In[4]:=
jj = Cases[ii, (z_)?NumberQ -> If[z < 100, 50, 200]];
The best one depends, of course, on what exactly you want to do.
Tomas Garza
Mexico City
----- Original Message -----
From: "1.156" <rob at piovere.com>
To: mathgroup at smc.vnet.net
Subject: [mg32823] [mg32795] Stumped again on a simple list
> Greetings cypherers all,
>
> 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]
>
> I've looked around a good bit but have not stumbled into any topic that
appears to bear on this problem.
>
> Can I please ask a kind soul to (again) point me in the right direction?
>
> Thanks, Rob
>
>
- References:
- Stumped again on a simple list
- From: "1.156" <rob@piovere.com>
- Stumped again on a simple list