MathGroup Archive 2002

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

Search the Archive

random matrix initialisation...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37576] random matrix initialisation...
  • From: Manuel Marques-Pita <manuxu at mac.com>
  • Date: Tue, 5 Nov 2002 05:01:26 -0500 (EST)
  • Organization: HCRC or CCS, University of Edinburgh
  • Reply-to: m.marques-pita at ed.ac.uk
  • Sender: owner-wri-mathgroup at wolfram.com

   
hello,

i have a question regarding matrices. searched on the web and forums
but maybe due to using wrong keywords i am not finding an answer... 

i need a way or function X to initialise matrices in mathematica such
that each time i call X i get a matrix with a predetermined number of
elements initialised as "1" and the rest as "0"

examples

X(4,3)

{{0,0,0,0}, {0,0,1,0}, {0,0,0,1}, {1,0,0,0}}

again X(4,3)

{{1,1,0,0}, {0,0,0,0}, {0,0,0,0}, {0,1,0,0}}

etc.. (first argument means that the matrix is 4x4 and second means
that there should be 3 "1's" present in the matrix

any help, pointers, etc will be appreciated!

thanks a lot

m

--


  • Prev by Date: Re: machine-size problem again?
  • Next by Date: Re: OO in Mathematica
  • Previous by thread: Re: without linefeed?
  • Next by thread: Re: random matrix initialisation...