MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Count


"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