MathGroup Archive 2011

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

Search the Archive

Re: 100 rows and 100 columns random matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123450] Re: 100 rows and 100 columns random matrix
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Thu, 8 Dec 2011 05:21:36 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jbniam$497$1@smc.vnet.net>

Something like this works

(* set dimension of your matrix *)
n = 100;

(* create random matrix *)
a = Array[Random[] & , {n, n}];

(* flatten out matrix to get a 1 dimensional list *)
af = Flatten[a];

(* select numerical range *)
Select[af, #1 < 0.5 & ];

(* calculate length of the selection, i.e. number of elements of matrix 
in the selection range *)
Length[%]
5110

Regards,
Wolfgang

"Sahar Nazemi" <nazemisahar at yahoo.com> schrieb im Newsbeitrag 
news:jbniam$497$1 at smc.vnet.net...
> 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 




  • Prev by Date: Re: Evaluate[expr]
  • Next by Date: Re: 100 rows and 100 columns random matrix
  • Previous by thread: Re: 100 rows and 100 columns random matrix
  • Next by thread: Re: 100 rows and 100 columns random matrix