| Mathematica supports operations on matrices of any size and has a range of input methods appropriate for different needs, from small formatted matrices via keyboard or palettes, to text-based entry or automatic import. | |
This is a selection of examples from the complete
"How to" screencast. »
Lists are very important general structures in
Mathematica. A matrix in
Mathematica is represented as a list of sublists of the same length.
| Out[4]= |  |
Use
MatrixForm to display

as a

matrix:
Out[5]//MatrixForm= |
| |  |
Mathematica also has a user interface to input matrices.
In the window that appears, select
Matrix (List of lists), enter the number of rows and columns for your matrix, and click
OK:
Your matrix is inserted into your notebook:
Click a placeholder to enter input. Once one is highlighted, you can move to the next one using the tab or arrow keys:
Evaluating the matrix gives its underlying structure as a uniform nested list:
| Out[6]= |  |
You can also enter matrices using the palette.
Open the palette from the menu:
On the
Advanced tab, click the
Matrix 
button to insert a 2×2 matrix:
As before, you can move through the empty placeholders using the tab or arrow keys.
To create a new row, use
Ctrl+ Enter. The new row will be inserted immediately below the position of your cursor. Pressing
Ctrl+ Enter with the cursor positioned after any entry in the last row creates a new row at the bottom of the matrix:
Similarly, new columns can be entered using
Ctrl+ ,:
You can import a matrix from a file. In this example, data is imported from a file and displayed in
MatrixForm:
Out[7]//MatrixForm= |
| |  |