2
$\begingroup$
Product[f[i], {i, 1, 4}]

gives us

f[1] f[2] f[3] f[4]

Is there any way I can take the product it will give something following

f[4] f[3] f[2] f[1]

I need it for matrix multiplication in reverse order.

$\endgroup$
  • 1
    $\begingroup$ mybe with NonCommutativeMultiply @@ (Reverse[List @@ (f[1] f[2] f[3] f[4])]) /. NonCommutativeMultiply[A_, B___] :> HoldForm[Times[A, B]] ? $\endgroup$ – user49047 Sep 3 at 14:58
  • 5
    $\begingroup$ What about Dot@@Table[f[i],{i,4,1,-1}]? (Note the step size of -1 to go backwards) $\endgroup$ – Lukas Lang Sep 3 at 15:01
  • 1
    $\begingroup$ @user49047 worked Thanks. $\endgroup$ – Muhammad Ali Sep 3 at 16:51
0
$\begingroup$

You can get a list of the values using Map (i.e., shortcut /@)

f[#] & /@ Range[4, 1, -1]

{f[4], f[3], f[2], f[1]}

To get the Dot product of the f's you can Apply (i.e., shortcut @@) the Dot function:

Dot @@ (f[#] & /@ Range[4, 1, -1])
$\endgroup$

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