MathGroup Archive 2004

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

Search the Archive

Re: How to construct a matrix like this ?


In article <cj63a6$qpr$1 at smc.vnet.net>, zhoukm at hotmail.com wrote:

> With Array[a, {2,2}] I can get an array like:
> | a[1,1] a[1,2] |
> | a[2,1] a[2,2] |.
> But occasionally I want matrix like:
> | a11 a12 |
> | a21 a22 |
> I remember I once figured out a way to do it but now I forgot. Anyone
> can give me a hand?

Others have answered this question. Personally, I like

  Array[Subscript[a, ##] &, {2, 2}] 

or 

  Table[Subscript[a, i, j], {i,2}, {j,2}]

or 

  Outer[Subscript[a, ##] &, Range[2], Range[2]]

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: GUIKit, GraphEdit and global variables
  • Next by Date: GUIKit and GraphEdit
  • Previous by thread: Re: How to construct a matrix like this ?
  • Next by thread: PlotRange-> {0, All}