4
$\begingroup$

For a given matrix M[n] of size $ n\times n $ I want to define the following list of matrix-expressions:

n=1
{Tr[M[1]]}

n=2
{Tr[M[2]]^2,Tr[M[2].M[2]]}

n=3
{Tr[M[3]]^3,Tr[M[3]]Tr[M[3].M[3]],Tr[M[3].M[3].M[3]]}

How could I generalize this relation for arbitrary $ n $? I tried Nest and NestList. Thanks!

$\endgroup$
4
  • $\begingroup$ How about n=4? $\endgroup$ May 18, 2018 at 10:43
  • $\begingroup$ n=4: {{Tr[M[4]]^4,Tr[M[4]]^2Tr[M[4].M[4]],Tr[M[4]] Tr[M[4].M[4].M[4]],Tr[M[4].M[4].M[4].M[4]]}} $\endgroup$ May 18, 2018 at 10:48
  • $\begingroup$ Are you sure that you don't want Tr[M[4].M[4]]^2 or Tr[M[4]]^3 Tr[M[4]]? What is the building scheme behind this? $\endgroup$ May 18, 2018 at 11:08
  • $\begingroup$ I consider a sheme which contains basically a list of dotproducts Map[Tr[#]&,{M,M.M,M.M.M,...}]. The resulting list elements are scaled by Tr[M]^n. $\endgroup$ May 18, 2018 at 11:24

2 Answers 2

6
$\begingroup$
f[k_] := Table[Tr[M @ k]^(k - i) Array[M @ k &, i, 1, Tr @ Dot @ ## &], {i, k}]

f /@ Range[5] // Column // TeXForm

$\tiny\begin{array}{l} \{\text{Tr}[M(1)]\} \\ \left\{\text{Tr}[M(2)]^2,\text{Tr}[M(2).M(2)]\right\} \\ \left\{\text{Tr}[M(3)]^3,\text{Tr}[M(3).M(3)] \text{Tr}[M(3)],\text{Tr}[M(3).M(3).M(3)]\right\} \\ \left\{\text{Tr}[M(4)]^4,\text{Tr}[M(4).M(4)] \text{Tr}[M(4)]^2,\text{Tr}[M(4).M(4).M(4)] \text{Tr}[M(4)],\text{Tr}[M(4).M(4).M(4).M(4)]\right\} \\ \left\{\text{Tr}[M(5)]^5,\text{Tr}[M(5).M(5)] \text{Tr}[M(5)]^3,\text{Tr}[M(5).M(5).M(5)] \text{Tr}[M(5)]^2,\text{Tr}[M(5).M(5).M(5).M(5)] \text{Tr}[M(5)],\text{Tr}[M(5).M(5).M(5).M(5).M(5)]\right\} \\ \end{array}$

$\endgroup$
3
  • $\begingroup$ That's it, thank you! $\endgroup$ May 18, 2018 at 11:47
  • $\begingroup$ @UlrichNeumann, my pleasure. $\endgroup$
    – kglr
    May 18, 2018 at 11:52
  • $\begingroup$ @UlrichNeumann kglr's solution seems to fit your requirements, and sufficient time has elapsed without any better implementations. You might consider formally accepting his answer then! You can do so by clicking on the grey check mark next to the answer. $\endgroup$
    – MarcoB
    May 22, 2018 at 16:38
2
$\begingroup$

How about this:

listVonMat[M_] := Module[{n = Length[M], inter1, inter2},
         inter1 = TakeDrop[Table[M, n], #] & /@ Range[n - 1, 0, -1];
         inter2 = {Times @@ Tr /@ #1, Tr @ (Dot @@ #2)} & @@@ inter1;
         Times @@@ inter2
        ]

Maybe numerical results are easier to be checked with:

listVonMat[Partition[Range[#^2], #]] & /@ Range[4]

returns

{
 {1}, 
 {25, 29}, 
 {3375, 3915, 4185}, 
 {1336336, 1521296, 1613776, 1719056}
}

Update

To show that the scheme is indeed implemented, run, e.g., codes below

TakeDrop[{a, a, a, a}, #] & /@ Range[3, 0, -1]
Times @@@ ({Times @@ Tr /@ #1, Tr @ (Dot @@ #2)} & @@@ %)

and one gets

{{{a, a, a}, {a}}, {{a, a}, {a, a}}, {{a}, {a, a, a}}, {{}, {a, a, a, a}}}
{Tr[a]^4, Tr[a]^2 Tr[a.a], Tr[a] Tr[a.a.a], Tr[a.a.a.a]}
$\endgroup$
2
  • $\begingroup$ Thank you for your solution $\endgroup$ May 18, 2018 at 12:08
  • $\begingroup$ @Ulrich Neumann You're welcome. But it seems that I made things harder :( $\endgroup$ May 18, 2018 at 12:31

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.