Re: Logical comparisons of items in a two lists
- To: mathgroup at smc.vnet.net
- Subject: [mg75462] Re: Logical comparisons of items in a two lists
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 2 May 2007 03:45:24 -0400 (EDT)
- Organization: Uni Leipzig
- References: <f16q2u$7er$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
l1 = Table[Random[], {10}];
l2 = Table[Random[], {10}];
k = 0;
MapThread[If[#1 > #2, k++] &, {l1, l2}];
k
Regards
Jens
actuary at mchsi.com wrote:
> Hello:
>
> I have two lists of real numbers, a & b. I want two compare
> individual items in one list to the corresponding items in the other
> list. For example Is a[[1]] > b[[1]]. At the end of the comparisons,
> I want to count the "Trues". I know how to do this use a "Table"
> statement and a "Count" statement. Is there a quicker, more efficient
> way of counting the number of "Trues".
>
> Thanks
>
> Larry
>
>