3
$\begingroup$

I want to compute $$ \prod_{i=1}^n A_i = A_1 A_2 \cdots A_n $$ where every $A_i$ is a square matrix. When I execute

a[i_] := {{1, i}, {0, 1}};
Product[a[i], {i, 1, 10}]

Mathematica gives the element-wise product, which is not what I need. The desired result can be obtained by

Fold[Dot, IdentityMatrix[2], Table[a[i], {i, 1, 10}]]

but I'm curious if there's a simpler solution.

$\endgroup$
7
$\begingroup$
Dot @@ (a /@ Range@10)

 (* {{1, 55}, {0, 1}} *)

Also

Dot @@ Array[a, 10]
$\endgroup$
  • 1
    $\begingroup$ Didn't know that Dot accepts more than 2 arguments $\endgroup$ – uranix Aug 7 '15 at 17:13

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