Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8280 > unrolled thread

Re: select 1st column element based on criteria in 2nd AND 3rd column

Started byDrMajorBob <btreat1@austin.rr.com>
First post2012-02-01 08:50 +0000
Last post2012-02-01 08:50 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: select 1st column element based on criteria in 2nd AND 3rd column DrMajorBob <btreat1@austin.rr.com> - 2012-02-01 08:50 +0000

#8280 — Re: select 1st column element based on criteria in 2nd AND 3rd column

FromDrMajorBob <btreat1@austin.rr.com>
Date2012-02-01 08:50 +0000
SubjectRe: select 1st column element based on criteria in 2nd AND 3rd column
Message-ID<jgaucb$er9$1@smc.vnet.net>
You could type the word "and" or "AND" or "And" into Mathematica,  
highlight it, and push the Help key.

Bobby

On Tue, 31 Jan 2012 07:55:38 -0600, Hanciong hanciong <hanciong@gmail.com>  
wrote:

> thank you for your effort guys. yes I realize there is no AND in
> mathematica, that's why I am asking the correct way (syntax) to do it.
>
> On Sat, Jan 21, 2012 at 9:08 PM, DrMajorBob <btreat1@austin.rr.com>  
> wrote:
>
>> Legal syntax is helpful:
>>
>>
>> pairs = {{1, 3, 4}, {2, 4, 6}, {3, 6, 7}, {4, 1, 8}, {5, 3, 9}, {6, 2,
>>     10}, {7, 5, 11}, {8, 2, 13}, {2, 3, 4}, {5, 6, 7}};
>>
>> Select[pairs, 5 >= #[[2]] >= 3 && 10 >= #[[3]] >= 7 &]
>>
>> {{5, 3, 9}}
>>
>> Cases[pairs, {a_, b_, c_} /; 3 <= b <= 5 && 7 <= c <= 10]
>>
>> {{5, 3, 9}}
>>
>> Bobby
>>
>>
>> On Sat, 21 Jan 2012 04:20:05 -0600, hanciong awesome  
>> <hanciong@gmail.com>
>> wrote:
>>
>>  Hello all, suppose I have a table:
>>>
>>> pairs = {{1, 3, 4}, {2, 4, 6}, {3, 6, 7}, {4, 1, 8}, {5, 3, 9}, {6, 2,
>>>    10}, {7, 5, 11}, {8, 2, 13}, {2, 3, 4}, {5, 6, 7}}
>>>
>>> how to select rows for which the 2nd column is between 3 and 5, AND
>>> the 3rd column is between 7 and 10? So I want to do something similar
>>> to this:
>>>
>>> Select[pairs, 5 >= #[[2]] >= 3 &  AND  10 >= #[[3]] >= 7]
>>>
>>> but I just couldn't get it to work. what should I do? Thank you
>>>
>>>
>>
>> --
>> DrMajorBob@yahoo.com
>>


-- 
DrMajorBob@yahoo.com

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web