Is there a way in maple to compute sums of arbitrary number of products minors of matrices?

59 Views Asked by At

I would like to use maple to compute \begin{align} P_i & = \sum_{1\leq j_1 < \cdots <j_{i-1} \leq i} \Delta_{(2,\ldots, n), (j_1,\ldots,j_{i-1}, i+1, \ldots, n)}(A) \Delta_{(j_1, \ldots, j_{i-1}, i+1, \ldots, n), (1, \ldots, n-1)}(B), \quad i=1,2,\ldots,n, \end{align} where $A, B$ are $n$ by $n$ matrices and $\Delta_{(i_1,\ldots,i_n),(j_1,\ldots,j_n)}(A)$ is the minor of $A$ with rows $i_1,\ldots,i_n$ and columns $j_1,\ldots,j_n$.

Here the difficulty is the number of loops is arbitrary. In maple, I can compute $P_i$ one by one for each $i$. But I have to write codes for each $i$. How can I compute $P_i$ in maple efficiently (codes which work for each $i$)? Thank you very much.

1

There are 1 best solutions below

2
On BEST ANSWER

You do this by using combinat:-choose to choose the summation indices.

P:= proc(A::Matrix, B::Matrix, i::posint)
local j;
     add(A[2..-1, [j[], i+1..-1]].B[[j[], i+1..-1], 1..-2], j= combinat:-choose(i,i-1))
end proc;