Re: Count

• To: mathgroup at smc.vnet.net
• Subject: [mg47349] Re: Count
• From: "Peter Pein" <petsie at arcor.de>
• Date: Tue, 6 Apr 2004 06:36:34 -0400 (EDT)
• References: <c4re7c\$mhs\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```"paolo " <tarpanelli at libero.it> schrieb im Newsbeitrag
news:c4re7c\$mhs\$1 at smc.vnet.net...
> if i have a time serie, how can i Count the elements of this time serie
that are within a defined range
> Example:
>
> x={1,1.023,1.056,2.45,5.67,....}
>
> how can i Count the elements inside the range (1,3)?
>
> thanks
>
> Paolo

In[2]:= Count[x, a_ /; 1 < a < 3]
Out[2]= 3
In[3]:= Select[x, 1 < # < 3 &] // Length
Out[3]= 3
In[4]:= Plus @@ (If[1 < # < 3, 1, 0] & /@ x)
Out[4]= 3

In[5]:= Plus @@ (Im[Log[(# - 1)(# - 3)]] & /@ x)/Pi
Out[5]= 3.
--
Peter Pein, Berlin
for not being filtered, start the subject with [
...and don't mention viagara-falls ;-)

```

• Prev by Date: Scientific Notation in ListPlot Axes
• Next by Date: Re: Problem with AltGr key on german keyboard
• Previous by thread: RE: Count
• Next by thread: RE: Count