MatrixForm

MatrixForm[list]

prints with the elements of list arranged in a regular array.

Details and Options

  • In StandardForm the array is shown enclosed in parentheses.
  • MatrixForm prints a singlelevel list in a column. It prints a twolevel list in standard matrix form. More deeply nested lists are by default printed with successive dimensions alternating between rows and columns.
  • Elements in each column are by default centered.
  • MatrixForm prints SparseArray objects like the corresponding ordinary lists. »
  • MatrixForm has the same options as TableForm.
  • The typeset form of MatrixForm[expr] is interpreted the same as expr when used in input. »
  • When an input evaluates to MatrixForm[expr], MatrixForm does not appear in the output. »
  • List of all options

Examples

open allclose all

Basic Examples  (3)

Show the matrix form of a matrix:

Show the matrix form of a SparseArray:

Show vector, matrix, and general arrays in matrix form:

Scope  (3)

Matrices of numbers and formulas:

A matrix of lists:

Use options to control the layout directions:

Generalizations & Extensions  (2)

Format a SparseArray object in matrix form:

Format a SymmetrizedArray object in matrix form:

Options  (6)

TableAlignments  (2)

Specify the alignment of columns:

Set alignments for successive dimensions:

TableDepth  (1)

By default, all dimensions are formatted:

Only use matrix formatting for the outermost dimension:

TableDirections  (1)

By default, the outermost dimension is a column:

Format the first dimension as a row instead:

TableHeadings  (1)

Specify headings for rows:

Specify headings for columns:

Specify headings for rows and columns:

TableSpacing  (1)

The default automatic spacing:

Explicitly specify the spacing between rows and between columns:

Applications  (4)

Display special matrices with matrix formatting:

Matrices from a matrix decomposition:

Formula for a matrix multiplication:

Display a block matrix as a matrix of matrices:

The array flattened to a matrix:

Properties & Relations  (7)

MatrixForm formats arrays using standard matrix formatting:

TableForm formats arrays in a tabular form:

Grid formats two-dimensional arrays as a grid:

Use MatrixPlot to visualize the structure of large matrices:

Use ArrayPlot to visualize the structure of large discrete matrices:

Use Style to affect the display of MatrixForm:

Use any number form such as ScientificForm or BaseForm to affect the display of numbers:

The typeset form of MatrixForm[expr] is interpreted the same as expr when used in input:

Copy the output and paste it into an input cell. The (

12
34
) is interpreted as {{1,2},{3,4}}:

When an input evaluates to MatrixForm[expr], MatrixForm does not appear in the output:

Out is assigned the value {{1,2},{3,4}}, not MatrixForm[{{1,2},{3,4}}]:

Possible Issues  (1)

Even when an output omits MatrixForm from the top level, it is not stripped from subexpressions:

The output does not have MatrixForm in it:

However, the variable e does have MatrixForm in it, which may affect subsequent evaluations:

The determinant is not evaluated due to the intervening MatrixForm:

Assign variables first and then apply MatrixForm to the result to maintain computability:

Wolfram Research (1988), MatrixForm, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixForm.html (updated 2003).

Text

Wolfram Research (1988), MatrixForm, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixForm.html (updated 2003).

CMS

Wolfram Language. 1988. "MatrixForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/MatrixForm.html.

APA

Wolfram Language. (1988). MatrixForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixForm.html

BibTeX

@misc{reference.wolfram_2024_matrixform, author="Wolfram Research", title="{MatrixForm}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixForm.html}", note=[Accessed: 08-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_matrixform, organization={Wolfram Research}, title={MatrixForm}, year={2003}, url={https://reference.wolfram.com/language/ref/MatrixForm.html}, note=[Accessed: 08-October-2024 ]}