Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur Sites
Mathematica Technical FAQs Services & Resources / Mathematica / Kernels & Programming
-----
 /
Symbols
*Mathematica
*Network Mathematica
*webMathematica
*gridMathematica
*Personal Grid Edition
*Wolfram Workbench
*Wolfram Education Group
*Application Packages
*Mathematica for Students
*Mathematica CalcCenter
*Publicon
*A New Kind of Science Explorer
*Mathematical Explorer
*Mathematica Teacher's Edition
*Calculus WIZ
*Mathematica Player
*Ask about this page
*Print this page
*Email this page
*Give us feedback
*
Sign up for our newsletter:

MatrixQ


Usage Message:

MatrixQ[expr] gives True if expr is a list of lists that can represent a matrix, and gives False otherwise. MatrixQ[expr, test] gives True only if test yields True when applied to each of the matrix elements in expr.

Attributes[MatrixQ] = {Protected}

Related Symbols

List , TensorRank , VectorQ

Notes:

MatrixQ[expr] returns True if
  • expr has a head of List
  • expr has at least one element (row)
  • each row has a head of List
  • all rows have the same length
  • none of the row elements have a head of List
Otherwise, MatrixQ[expr] returns False .

MatrixQ[expr, test] returns True only if test[eij] evaluates to True for each element eij in each row of expr.

Here are some simple examples.

In[1]:= MatrixQ[{{1}, {2}}]

Out[1]= True

In[2]:= MatrixQ[{{1}, {2, 3}}]

Out[2]= False
The special case MatrixQ[expr, NumberQ] is optimized by calling NumberQ internally, rather than through ordinary evaluation. If you want this test to go through the evaluator, such as if you have modified the definition of NumberQ , then you can use MatrixQ[expr, NumberQ[#] &] instead.


Additional Online Documentation:

Mathematica 3.0
http://documents.wolfram.com/v3/RefGuide/MatrixQ.html

Mathematica 4.0
http://documents.wolfram.com/v4/RefGuide/MatrixQ.html




 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy