Group Abstract Group Abstract

Message Boards Message Boards

0
|
54 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

The Row icon in the Basic Math Assistant palette.

Posted 1 day ago

Hello everyone,

In the Basic Math Assistant palette, there's a Row icon (two squares) that's equivalent to {{ a,b}}. Is there a way to perform the inverse operation? That is, to convert {{a,b}} to that format?

Regards,

Sinval

POSTED BY: Sinval Santos
4 Replies
Posted 21 hours ago

Yes, I know the key combinations control-comma and control-return and I use them quite often. The second procedure you created works well.

Thank you very much for the information, Michael.

POSTED BY: Sinval Santos

I don't know of a built-in way. You could make a button to do it. Something like the following:

Button["gridify",
 With[{mat = MakeExpression[
     NotebookRead[EvaluationNotebook[]],
     StandardForm]},
  If[MatrixQ[Thread /@ Thread[mat]],
   NotebookWrite[
    EvaluationNotebook[],
    GridBox @@ Replace[
      mat,
      _ :> "\[Placeholder]",
      {3}
      ]
    ],
   Message[General::matrix, "selection", 1]
   ]
  ]
 ]

It converts a selection to the grid of placeholders, if the selection is a matrix. You could put such a function into a palette.

Another way is to create the grid from a matrix, fill it in, and paste it where you want:

mat = {{a, b}};
CellPrint[Cell[BoxData[GridBox[Map["\[Placeholder]" &, mat, {2}]]], "Input"]]

Finally, do you know about control-comma and control-return? They create the type of grid you want. I find it easy to hold the control key down and hit comma or return until I have a matrix of the right dimensions. If I overshoot, I can select a row or column and hit delete.

In terms of how I like to use Mathematica, my three suggestions go from worst (but cleverest?) to best, for some reason. The only reason I can think for using one of the cleverer approaches is to create a user-interface in which I want to create an input grid that depends on user input. Otherwise, control-comma/return is what I actually do all the time.

POSTED BY: Michael Rogers

Hi David,

I would like it to revert to the same format that appears in the palette, that is, the two squares.

POSTED BY: Sinval Santos

Maybe you are looking to display your row in TraditionalForm?

enter image description here

MatrixForm alternatively produces similar results.

POSTED BY: David Trimas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard