I need to simulate a series of nonlinear (and linear) with thousands of state variables. Here is a simple linear example
{1.00336 x1 + 0.0049723 x2 + 0.00167211 x3, x1, x2}
If I define the following function and then use NestList I get the solution.
model1[{x1_, x2_, x3_}] := {1.003355593149926` x1 +
0.004972295926111435` x2 + 0.0016721109239624015` x3, x1, x2}
NestList[model1, {1, 1, 1}, 2]
The right hand side of model1 is automatically generated by another function. Is there way to do the same with the left hand side? That is, model1 will have the number of arguments depending on the number of x's on the right hand side.
The speed problem arises when the model has thousands of x's. Mathematica does not seem to handle it (abort is the common outcome). Is there a way to handle such models on Mathematica?
Many thanks
model1
asmodel1[x_] := {... x[[1]] + ... x[[2]] + ... x[[3]], ...}
, or evenmodel1 = Function[{... Slot[1] + ... Slot[2] + ... Slot[3], ...}]
$\endgroup$Compile
may help you considerably. $\endgroup$