Re: 100 rows and 100 columns random matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg123459] Re: 100 rows and 100 columns random matrix
- From: Heike Gramberg <heike.gramberg at gmail.com>
- Date: Thu, 8 Dec 2011 05:23:21 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201112071115.GAA04259@smc.vnet.net>
The syntax of Count is Count[ list, pattern] or Count[list, pattern,
levelspec] where pattern is a pattern specification, and levelspec is a
level specification to tell Mathematica at what levels in list to look
for the elements you want to count . To learn more about patterns, you
could for example read the introduction to patterns in the documentation
of Mathematica.
For this particular example, you could do something like
Count[a, b_ /; 0 <= b < .5, {2}]
The construct b_ /; 0<= b< .5 basically means any expression b which
satisfies the condition 0 <= b < .5. I'm specifying levelspec {2}
because I'm only interested in element appearing at level 2 in a.
Heike
On 7 Dec 2011, at 12:15, Sahar Nazemi wrote:
> Hello
> I'm a student of geology who works with
> Mathematica sofware .I'm learning it by myself recently.
> I have a question and will appreciate if you
> help me in this regard.
> I have created a 100 rows and 100 columns random
> matrix which its elements are between 0 to 1(for example it consists
of
> 0.687,...).
> Now I want to know how many of these elements
> are in the range of "0 to 0.5" and how many are in the range of
> "0.5 to 1".
> I also use "Count" function as below
> but it doesnt answer:
> Count[a,{0,0.5}]
> ("a" is my random matrix).
> Regards
> Sahar Nazemi
- References:
- 100 rows and 100 columns random matrix
- From: Sahar Nazemi <nazemisahar@yahoo.com>
- 100 rows and 100 columns random matrix