Re: Re: Count pattern
- To: mathgroup at smc.vnet.net
- Subject: [mg41341] Re: [mg41296] Re: Count pattern
- From: Bobby Treat <drmajorbob at mailblocks.com>
- Date: Thu, 15 May 2003 04:03:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
No, his description is fine.
t = {1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 27, 28, 30, 36, 50};
s = {1, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 8, 10, 12, 12,
14, 17, 20, 27, 27, 28, 30, 30, 36, 38, 40, 45, 50, 50, 50, 63,
132,
132};
hisResult = {33, 30, 28, 27, 26, 25, 24, 23, 21, 20, 18, 17, 15, 13,
12, 10,
6};
Tr /@ Outer[If[#2 >= #1, 1, 0] &, t, s]
% == hisResult
{33, 30, 28, 27, 26, 25, 24,
23, 21, 20, 18, 17, 15, 13,
12, 10, 6}
True
Bobby
-----Original Message-----
From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
To: mathgroup at smc.vnet.net
Subject: [mg41341] [mg41296] Re: Count pattern
Hi,
Length[Select[s, Function[se, And @@ (se >= # & /@ t)][#] &]]
You should check your example, it does not match the description.
Regards
Jens
Søren Merser wrote:
>
> hi there
>
> i need a litle help on a problem that has puzzeled me for some time
>
> i want to count the number of elements in s with value greater or
equal
> to each element in t
>
> t = {1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 27, 28, 30, 36, 50}
>
> s = {1, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 8, 10, 12, 12, 14, 17, 20, 27,
> 27, 28, 30, 30, 36, 38, 40, 45, 50, 50, 50, 63, 132, 132}
>
> the result should be: {33, 30, 28, 27, 26, 25, 24, 23, 21, 20, 18, 17,
> 15, 13, 12, 10, 6}
>
> kind regards soren