question about entering vectors by the keyboard
- To: mathgroup at smc.vnet.net
- Subject: [mg16862] question about entering vectors by the keyboard
- From: "David P. Johnson" <johnson at ae.msstate.edu>
- Date: Thu, 1 Apr 1999 21:35:29 -0500
- Organization: Mississippi State University
- Sender: owner-wri-mathgroup at wolfram.com
I have a question about entering vectors (1D lists) by keyboard. Unfortunately, it is difficult to explain in just text, so I have included a mathematica notebook file below. Any help would be most appreciated. (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info at wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 3942, 153]*) (*NotebookOutlinePosition[ 4783, 180]*) (* CellTagsIndexPosition[ 4739, 176]*) (*WindowFrame->Normal*) Notebook[{ Cell["\<\ I use the notebook front end on a Macintosh, although I suspect \ that the syntax is similar on other platforms.\ \>", "Text"], Cell[TextData[{ "When I evaluate ", "MatrixForm[{2,3,4}]", ", I get ", Cell[BoxData[ FormBox[ RowBox[{"(", GridBox[{ {"2"}, {"3"}, {"4"} }], ")"}], TraditionalForm]]], "." }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(MatrixForm[{2, 3, 4}]\)], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{"(", GridBox[{ {"2"}, {"3"}, {"4"} }], ")"}], MatrixForm[ {2, 3, 4}]]], "Output"] }, Open ]], Cell["\<\ I can copy the above output, paste it below as input, and evaluate \ it. I get {2,3,4}.\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ InterpretationBox[ RowBox[{"(", GridBox[{ {"2"}, {"3"}, {"4"} }], ")"}], MatrixForm[ {2, 3, 4}]]], "Input"], Cell[BoxData[ \({2, 3, 4}\)], "Output"] }, Open ]], Cell["This is good so far.", "Text"], Cell[TextData[{ "But now, I type \"( 2 \[ControlKey]-\[ReturnKey] 3 \[ControlKey]-\ \[ReturnKey] 4 \[ControlKey]-\[SpaceKey] )\", which looks the same as before, \ i.e. ", Cell[BoxData[ FormBox[ RowBox[{"(", GridBox[{ {"2"}, {"3"}, {"4"} }], ")"}], TraditionalForm]]], ". But when I evaluate it, I get {{2},{3},{4}}, enstead of {2,3,4}." }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"(", GridBox[{ {"2"}, {"3"}, {"4"} }], ")"}]], "Input"], Cell[BoxData[ \({{2}, {3}, {4}}\)], "Output"] }, Open ]], Cell["This is bad.", "Text"], Cell["\<\ I've tried Create Table/Matrix/Palette, with the same result.\ \>", "Text"], Cell[TextData[{ "So, is there any way to enter a vector in this format ", Cell[BoxData[ InterpretationBox[ RowBox[{"(", GridBox[{ {"2"}, {"3"}, {"4"} }], ")"}], MatrixForm[ {2, 3, 4}]]]], " and get {2,3,4} as output, without having to use the Flatten[ ] command? \ " }], "Text"] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 1152}, {0, 850}}, WindowSize->{520, 740}, WindowMargins->{{12, Automatic}, {Automatic, 13}}, MacintoshSystemPageSetup->"\<\ 00<0001804P000000]P2:?oQon82n at 960dL5:0?l0080001804P000000]P2:001 0000I00000400`<300000BL?00400 at 0000000000000006P801T1T00000000000 00000000000000000000000000000000\>" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1709, 49, 136, 3, 46, "Text"], Cell[1848, 54, 263, 12, 64, "Text"], Cell[CellGroupData[{ Cell[2136, 70, 54, 1, 27, "Input"], Cell[2193, 73, 186, 7, 66, "Output"] }, Open ]], Cell[2394, 83, 111, 3, 30, "Text"], Cell[CellGroupData[{ Cell[2530, 90, 185, 7, 56, "Input"], Cell[2718, 99, 43, 1, 26, "Output"] }, Open ]], Cell[2776, 103, 36, 0, 30, "Text"], Cell[2815, 105, 426, 12, 80, "Text"], Cell[CellGroupData[{ Cell[3266, 121, 121, 5, 56, "Input"], Cell[3390, 128, 49, 1, 26, "Output"] }, Open ]], Cell[3454, 132, 28, 0, 30, "Text"], Cell[3485, 134, 88, 3, 30, "Text"], Cell[3576, 139, 362, 12, 70, "Text"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************) -- David ->(Signature continues here)