MathGroup Archive 2009

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

Search the Archive

Re: Creating Matrix from vectors

  • To: mathgroup at
  • Subject: [mg100703] Re: [mg100691] Creating Matrix from vectors
  • From: Murray Eisenberg <murray at>
  • Date: Thu, 11 Jun 2009 21:40:09 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <>
  • Reply-to: murray at

Mathematica does not have "matrix" as a built-on primitive type of data 
structure.  To Mathematica a matrix is just a list of lists, with the 
individual lists being its rows.  For example,

   v1 = {1, 2, 3}; v2 = {4, 5, 6};
   m = {v1, v2}

And if you want to display such a list of lists to look like a 
conventional matrix, wrap it in MatrixForm:


If you want to interchange "rows" with "columns", you may use Transpose:


And now if you wrap that with MatrixForm, you'll see the sort of display 
you want, where the original "vectors" v1 and v2 appear as the columns.

Kinu wrote:
> Suppose i have a n number of vectors say s1, s2,... sn. I want to
> create a matrix such that these n vectors are the n columns of the matrix.
> I tried using A = {s1,s2,..,sn};
> however this keep the vectors intact and stacks them one below the
> other. How can i make a matrix from these??
> Can anyone please help me with this.

Murray Eisenberg                     murray at
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Re: AnimationDirection when Exporting
  • Next by Date: Re: problem writing debugging utility function
  • Previous by thread: Re: Creating Matrix from vectors
  • Next by thread: Re: Creating Matrix from vectors