Mathematica can do a RecurrenceTable with a vector, here is a simple example:
RecurrenceTable[{x[n + 1] == 2* x[n], x[0] == {1, 2, 3}}, x, {n, 3}]
with output
{{1, 2, 3}, {2, 4, 6}, {4, 8, 12}, {8, 16, 24}}
I want to do something similar but instead of multiplying by 2 I want to multiple each element in x[n] by a different number. For example, one would think that this would work:
RecurrenceTable[{x[n + 1] == {1,2,3}* x[n], x[0] == {1, 2, 3}}, x, {n, 3}]
since Times is listable but I get an error
RecurrenceTable::excptn: Value {1,2,3,2,4,6,3,6,9} is a numerical exception. >>
I get the same result using MapThread etc. Thoughts?
NestList[{1, 2, 3} # &, {1, 2, 3}, 3]be acceptable ? – b.gatessucks Jan 8 at 19:00MapThread", in MMA 8 this succeeds:RecurrenceTable[{x[n + 1] == MapThread[Times, {{1, 2, 3}, x[n]}], x[0] == {1, 2, 3}}, x, {n, 3}]. (This expression was prompted by @b.gatessucks' answer.) – whuber Jan 8 at 21:00