16
$\begingroup$

Compound matrices are matrices whose entries are all the minors of a given size of another matrix.

https://en.wikipedia.org/wiki/Compound_matrix

https://www.researchgate.net/profile/James-Muldowney-2/publication/38372479_Compound_matrices_and_ordinary_differential_equations/links/58b1b9a8aca2725b5416ed5f/Compound-matrices-and-ordinary-differential-equations.pdf

They are probably not too hard to write by the user, but maybe I am lucky and they are already implemented in mathematica ? Thanks :)

$\endgroup$
7
  • 12
    $\begingroup$ Minors does this for square matrices. It was recently noticed that we did not extend to rectangular, so we added support for that to a future release. $\endgroup$ Commented Jan 8, 2022 at 16:44
  • 2
    $\begingroup$ @DanielLichtblau Please correct me, but at least in versions 12.0.0 and 13.0.0, Minors seems to give sensible results for rectangular matrices as well? $\endgroup$
    – Hausdorff
    Commented Jan 14, 2022 at 14:15
  • 1
    $\begingroup$ @Hausdorff Not that I can see: In[209]:= Minors[Array[a, {2, 3}]] During evaluation of In[209]:= Minors::matsq: Argument {{a[1,1],a[1,2],a[1,3]},{a[2,1],a[2,2],a[2,3]}} at position 1 is not a non-empty square matrix. Out[209]= Minors[{{a[1, 1], a[1, 2], a[1, 3]}, {a[2, 1], a[2, 2], a[2, 3]}}] $\endgroup$ Commented Jan 17, 2022 at 21:04
  • 1
    $\begingroup$ @DanielLichtblau It does do it if you specify the order of the minor matrix, e.g. Minors[Array[a, {2, 3}], 2] $\endgroup$
    – Hausdorff
    Commented Jan 17, 2022 at 23:17
  • 1
    $\begingroup$ @DanielLichtblau And it seems you would need to specify the order to make the minor matrix well-defined in the rectangular case. In your example you could image dropping either a column and row each time (leading to 1×1 "determinants"), or only a column (leading to 2×2 determinants). I don't see which would be the natural extension of the square case. Plus, for the compound matrix, you have to to specify the minor order anyways. $\endgroup$
    – Hausdorff
    Commented Jan 18, 2022 at 0:06

2 Answers 2

17
$\begingroup$

I don't think that they are built-in, but they are easy enough to implement:

CompoundMatrix[A_?MatrixQ, k_Integer] := Module[{m, n, p, q, i, j},
   {m, n} = Dimensions[A];
   p = Subsets[Range[1, m], {k}];
   q = Subsets[Range[1, n], {k}];
   Table[Det[A[[i, j]]], {i, p}, {j, q}]
   ];

Using the elementary example from the linked Wikipedia article:

A = Partition[Range[1, 12], 4];
CompoundMatrix[A, 2]

{{-4, -8, -12, -4, -8, -4}, {-8, -16, -24, -8, -16, -8}, {-4, -8, -12, -4, -8, -4}}

$\endgroup$
8
  • 1
    $\begingroup$ The variables i, j used for Table should also be made local in Module to avoid bugs, such as for example here $\endgroup$
    – Hausdorff
    Commented Jan 14, 2022 at 14:39
  • 1
    $\begingroup$ @Hausdorff The variables i and j are scoped by Table itself. This should not be the reason for any bugs. $\endgroup$ Commented Jan 14, 2022 at 17:22
  • 1
    $\begingroup$ @Hausdorff The documentation of Table says: "Table effectively uses Block to localize values or variables." $\endgroup$ Commented Jan 14, 2022 at 17:26
  • 3
    $\begingroup$ Oh wow, you're right. This never occured to me. Thanks for the lesson! =) $\endgroup$ Commented Jan 14, 2022 at 21:01
  • 2
    $\begingroup$ No worries, this is also the first time I have stumbled over this :) $\endgroup$
    – Hausdorff
    Commented Jan 14, 2022 at 21:06
3
$\begingroup$

Sorry for answering a year-old question with a self-plug, I've moved out of the applied mathematics field and no longer keep an eye on this site.

I have a package that implements the method of compound matrices for solving eigenvalue boundary value problems by calculating the Evans function, an analytic function whose roots correspond to the eigenvalues. Some details are available at these two questions, or this PDF. Or search for CompoundMatrixMethod on this site to see my other answers here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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