MathGroup Archive 2009

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

Search the Archive

Re: Matrices with square brackets

  • To: mathgroup at
  • Subject: [mg102625] Re: Matrices with square brackets
  • From: cca at
  • Date: Mon, 17 Aug 2009 04:03:47 -0400 (EDT)

George Woodrow III wrote: 

>>Use TraditionalForm[].

Thank you for your response. However, the question is: how to use matrices 
delimited by square brackets. MatrixForm and TraditionalForm return 
matrices with round brackets (parentheses). 

The problem, of course, is that square brackets in Mathematica are reserved 
to functional aplication. Even so, it is possible to teach the system how 
to parse matrices with square brackets and how to output matrices in the 
same format. For $VersionNumber<=6, I have done this using $PreRead, 
$PrePrint and box programming. (Almost anything is possible with boxes!) 
For $VersionNumber>=7, here is an example of what I meant. (Below I use the 
new typesetting function TemplateBox.) 

 TemplateBox[{GridBox[{{"a", "b"}, {"c", "d"}}]}, "Identity",
  DisplayFunction -> (RowBox[{StyleBox["[", SpanMaxSize -> \[Infinity]], #1,
       StyleBox["]", SpanMaxSize -> \[Infinity]]}] &)]] 

This pastes a matrix with square brackets that can be used normally (as you 
would do with determinants with vertical bars in Mathematica since older 
versions). You cand add rows or columns without destroying the hidden box 
structure. You can copy, paste and evaluate to try other things. Given this 
box representation, now its is easy to make the system output matrices with 
square brackets (in StandardForm or TraditionalForm). You can also create a 
dialog box with input fields to paste such matrices with any dimensions. 

My concern here is that this solution, although easy for me, could be much 
simpler. I myself prefer matrices with parentheses, but many pre-college 
teachers in my country do not. 

Carlos Cesar de Araujo
Gregos & Troianos Educacional
Belo Horizonte, MG, Brasil
(31) 3283-1122

  • Prev by Date: Re: Symbolic integration
  • Next by Date: Re: Re: Problem with a 1st order IV ODE
  • Previous by thread: Re: Matrices with square brackets
  • Next by thread: Intersection of line and a surface of revolution - a problem with