The commands below
T = 100;
n = 5;
m = 5;
vars = Table[Subscript[x, j][t], {i, n}, {j, i}];
eqns = Table[{Subscript[x, j]'[t] ==
Subscript[x, j][
t] (1 - (Sum[
If[j == k,
RandomReal[{$MachineEpsilon, 1 - $MachineEpsilon}],
RandomReal[]] Subscript[x, k][t], {k, i}]) ),
Subscript[x, j][0] == RandomReal[]}, {i, n}, {j, i}];
sol = Table[s = NDSolve[eqns[[l]], vars[[l]], {t, 0, T}], {l, m}];
Interpolates the following results, for example:
{{x1}, {x1,x2}, {x1,x2,x3}, {x1,x2,x3,x4}, {x1,x2,x3,x4,x5}}
In the code above, I have parameters and initial conditions that are random numbers. To do some statistical analysis I need 100 different results.
I thought about doing
Table[sol,{q,100}]
However, it returns 100 equal results for
{{x1}, {x1,x2}, {x1,x2,x3}, {x1,x2,x3,x4}, {x1,x2,x3,x4,x5}}
Can someone help me get 100 different lists?
eqns
to useSetDelayed
(:=
) instead ofSet
(=
). This should force regeneration of your random values each timeeqns
is evaluated. Is that what you are looking for? $\endgroup$SetDelayed
instead ofSet
in eqns and sol. I got the result I wanted. Thanks @MarcoB $\endgroup$