0

For example, I produce a list of matrices, likes a=Table[IdentityMatrix[2], {i, 2}],so result is {{{1, 0}, {0, 1}}, {{1, 0}, {0, 1}}}. But I want {{1, 0}, {0, 1}}, {{1, 0}, {0, 1}}, so what should I do?

dnvin
  • 47
  • 4
  • 1
    What do you mean by {{1, 0}, {0, 1}}, {{1, 0}, {0, 1}}? If you paste it to the nb and try to evaluate it will tell you the syntax is not complete. What is the context? maybe you need Apply or Sequence? – Kuba Dec 12 '18 at 08:50
  • I need to use these matrices as variables as a function. For instance, KroneckerProduct. If you type KroneckerProduct[a], where a={m1,m2}. That would be wrong. So you need to type KroneckerProduct[m1,m2], and get desirable result. – dnvin Dec 12 '18 at 08:59
  • 3
    To continue with Kuba's comment, if you want to pass them as two arguments to a function you can use Sequence @@ a, for instance: Plus[Sequence @@ a] – SPPearce Dec 12 '18 at 08:59
  • 1
    Alternatively you can just write {m1,m2} = Table[IdentityMatrix[2], {i, 2}] – SPPearce Dec 12 '18 at 09:00
  • Kuba and KraZug, Thanks you, you have solved my problem. – dnvin Dec 12 '18 at 09:14

0 Answers0