Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7001
| From | "Dr. Wolfgang Hintze" <weh@snafu.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: 100 rows and 100 columns random matrix |
| Date | 2011-12-08 10:23 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jbq36a$ieb$1@smc.vnet.net> (permalink) |
| 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@yahoo.com> schrieb im Newsbeitrag
news:jbniam$497$1@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
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
100 rows and 100 columns random matrix Sahar Nazemi <nazemisahar@yahoo.com> - 2011-12-07 11:23 +0000 Re: 100 rows and 100 columns random matrix "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-12-08 10:23 +0000 Re: 100 rows and 100 columns random matrix "Nasser M. Abbasi" <nma@12000.org> - 2011-12-08 10:32 +0000 Re: 100 rows and 100 columns random matrix David Skulsky <edskulsky@gmail.com> - 2011-12-08 10:36 +0000
csiph-web