# Large products of a matrix-valued function [closed]

I have a $3\times 3$ matrix valued function $f(x)$ where $x\in\mathbb{R}$.

I want to perform the following:

$$\prod_{k=a}^b f(k),$$

where $a,b$ are known, but I cant seem to get Mathematica to do it. Any ideas?

I know I have to use .. instead of *, but I want something similar to

Product[f[k],{k,a,b}]


Clearly this won't work since Product works on $\mathbb{C}$ only (at least as far as my knowledge goes)

I have tried

Dot[f[k],{k,a,b}]


but that doesn't work.

## closed as off-topic by MarcoB, dr.blochwave, C. E., Bob Hanlon, ÖskåSep 9 '15 at 17:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, dr.blochwave, C. E., Bob Hanlon, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

• If a,b are known, then Fold[Dot, Table[f[x], {x, a, b}]] will work. – Patrick Stevens Sep 8 '15 at 7:07
• Try Dot @@ Table[f[j], {j, a, b}] – Hubble07 Sep 8 '15 at 7:34
• Dot @@ (f /@ Range[a, b]) – Dr. belisarius Sep 8 '15 at 15:20
• SetAttributes[f, Listable]; Dot @@ f@Range[a, b] – Dr. belisarius Sep 8 '15 at 15:22
• "Put on hold". The mind boggles! – Pixel Sep 11 '15 at 11:57

## 1 Answer

There's a bunch of comments with upvotes. So, to sum up:

PatrickStevens says to Fold Dot over the List of f[x]'s

Fold[Dot, Table[f[x], {x, a, b}]]


Hubble07 says to try Applying Dot to the Table of f[x]'s.

Dot @@ Table[f[x], {x, a, b}]


belisarius says to Apply Dot to f Mapped over the Range:

Dot @@ f /@ Range[a, b]


or to make the function f Listable:

SetAttributes[f, Listable];
Dot @@ f@Range[a, b]


One more version:

Fold[Dot, Array[f, b - a + 1, a]]
Dot @@ Array[f, b - a + 1, a]
Array[f, b - a + 1, a, Dot]

• Do all of these methods result in the full list of matrices being put into memory simultaneously? – ComptonScattering Aug 14 '17 at 22:06
• @ComptonScattering. I believe so. You want something that generates the matrices on the fly as they're multiplied together? Maybe something like Fold[#1.f[#2] &, f[a], Range[a + 1, b]]? Or maybe it should be Fold[f[#2].#1 &, f[a], Range[a + 1, b]]; order matters of course, – march Aug 14 '17 at 22:22
• I see what you have done. This has been very useful for me to understand. Thank you. – ComptonScattering Aug 15 '17 at 1:25