In Wolfram|Alpha it is possible to discover some specific classes to which a matrix belongs.

For instance, typing this in Wolfram|Alpha

{{a, b, c}, {c, a, b}, {b, c, a}}



Is there a built-in Mathematica command which can generate the same kind of output?


As far is I can tell, there is no built-in command to do so. However, typing


Into the front end and evaluating will give a list of the matrix properties you can test for in Mathematica. Based on the resulting list, I came up with the following simple function that you might find useful.

This is just a helper function to make the output look nice:

MatrixQtoTitle[a_] := 
 StringTrim[StringReplace[ ToString[a], {"MatrixQ" -> "", 
    uc : CharacterRange["A", "Z"] :> " " ~~ ToLowerCase[uc]}]]

And here is the suggested function, using the output from the ?*MatrixQ line mentioned above:

MatrixPropertiesReport[mat_?MatrixQ] := 
 Grid[{MatrixQtoTitle[#], #[mat]} & /@ {AntihermitianMatrixQ, 
    AntisymmetricMatrixQ, DiagonalizableMatrixQ, HermitianMatrixQ, 
    IndefiniteMatrixQ, NegativeDefiniteMatrixQ, 
    NegativeSemidefiniteMatrixQ, NormalMatrixQ, OrthogonalMatrixQ, 
    PositiveDefiniteMatrixQ, PositiveSemidefiniteMatrixQ, 
    SquareMatrixQ, SymmetricMatrixQ, UnitaryMatrixQ}]

Using your example

antihermitian          False
antisymmetric          False
diagonalizable         True
hermitian              False
indefinite             False
negative definite      False
negative semidefinite  False
normal                 True
orthogonal             False
positive definite      False
positive semidefinite  False
square                 True
symmetric              False
unitary                False

If you wanted you could adapt this function to, for example, only show the rows that are true, much as Wolfram|Alpha does.

| improve this answer | |
  • $\begingroup$ ...and of course, you can call Alpha from within Mathematica if needed. (For instance, Alpha can check if a matrix is circulant.) $\endgroup$ – J. M.'s discontentment Nov 23 '15 at 0:52
  • 1
    $\begingroup$ @J.M. - true, but I wanted to showcase an all-Wolfram-language solution $\endgroup$ – Verbeia Nov 23 '15 at 1:26
  • 1
    $\begingroup$ Here's the variation that retains only the relevant properties: MatrixPropertiesReport[mat_?MatrixQ] := If[ToExpression[#][mat], ToLowerCase[Fold[StringReplace, #, {"MatrixQ" -> "", x_?LowerCaseQ ~~ y_?UpperCaseQ :> x <> " " <> y}]], Nothing] & /@ DeleteCases[Names["*MatrixQ"], "MatrixQ"] $\endgroup$ – J. M.'s discontentment Dec 13 '15 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.