Skip to main content
13 events
when toggle format what by license comment
Jul 24, 2014 at 2:51 history edited kglr CC BY-SA 3.0
deleted 6 characters in body
Jul 24, 2014 at 2:37 comment added kglr @Ben, it is indeed puzzling that matrixform2 does not work with a.b -- that could be a good new question to post. Re extending bracketF to work with an ordinary matrix, there must be a cleaner and more direct way to do it, but a quick-and-dirty way is to use Composition[bracketF,Grid].
Jul 24, 2014 at 2:26 vote accept Ben Allgeier
Jul 24, 2014 at 2:26 comment added Ben Allgeier That answers what I originally asked very well. Your use of Options in gab and ToBox and TagBox in bracketF taught me a few things. I was hoping to extend your bracketF to an ordinary matrix but what comes out looks like an ordinary matrix (the FullForm suggests otherwise). I don't know if the matrixform I came up with above is the right approach, but it does take in a ordinary matrix and outputs in [ ] 's. However, if I pass in a product a.b or even if I execute a.b and then use % in matrix form, what comes out is not nice. Why is this happening? How to modify?
Jul 23, 2014 at 22:53 comment added kglr @Ben, please see the update for a way to wrap matrices with square brackets.
Jul 23, 2014 at 22:51 history edited kglr CC BY-SA 3.0
added 451 characters in body
Jul 23, 2014 at 21:07 comment added Ben Allgeier I can pass in 2a or a+1 but I cannot pass in a product of matrices. Any ideas of how to change that?
Jul 23, 2014 at 21:02 comment added Ben Allgeier Found a modification of matrixform above that handles dividers: matrixform2 = DisplayForm[RowBox[{StyleBox["[", SpanMaxSize -> [Infinity]], GridBox[#1,GridBoxDividers -> {"Columns" -> ReplacePart[Table[False, {Dimensions[#1][[2]]}],(Map[List, #2] + 1) -> Red], "Rows" -> ReplacePart[Table[False, {Dimensions[#1][[1]]}], (Map[List, #3] + 1) -> Red]}], StyleBox["]", SpanMaxSize -> [Infinity]]}]] &; matrixform2[a,{2},{2}] does what I want but not matrixform2[a.b,{2},{2}]
Jul 23, 2014 at 18:43 comment added Ben Allgeier Edit to the above comment. But I can't simply combine these functions. Any ideas on how to do so?
Jul 23, 2014 at 18:37 comment added Ben Allgeier I came up with this for wrapping the matrix with []. But I simply combine this with the function given. matrixform[mat_] := RowBox[{StyleBox["[", SpanMaxSize -> \[Infinity]], GridBox[mat], StyleBox["]", SpanMaxSize -> \[Infinity]]}] // DisplayForm // TraditionalForm
Jul 23, 2014 at 17:16 comment added Ben Allgeier Thanks. That is better and easier than I expected. I have been wondering in general how to express matrices with [ ] 's around them, instead of ( )'s. Is there a way to wrap these matrices in [ ] 's? If so, would this method extend to a way to do so for matrices in other cells such as Text cells?
Jul 23, 2014 at 0:28 history edited kglr CC BY-SA 3.0
added 8 characters in body
Jul 23, 2014 at 0:20 history answered kglr CC BY-SA 3.0