The output of RecurrenceTable
seems to lose a level when there are more than 250 points and one variable. Easiest to explain with an example:
Good:
RecurrenceTable[{n[t + 1] == 2 (1 - n[t]) n[t], n[0] == 0.1}, {n}, {t, 0, 249}]
(* {{0.1}, {0.18}, {0.2952}, {0.416114}, {0.485926}, {0.499604}, {0.5}, {0.5}, ... {0.5}} *)
Bad:
RecurrenceTable[{n[t + 1] == 2 (1 - n[t]) n[t], n[0] == 0.1}, {n}, {t, 0, 250}]
(* {{0.1}, 0.18, 0.2952, 0.416114, 0.485926, 0.499604, 0.5, 0.5, ... 0.5} *)
Having more than one variable works as expected:
RecurrenceTable[{n[t + 1] == 2 (1 - n[t]) n[t], m[t + 1] == 2 (1 - m[t]) m[t], n[0] == 0.1, m[0] == 0.1}, {n, m}, {t, 0, 250}]
(* {{0.1, 0.1}, {0.18, 0.18}, {0.2952, 0.2952}, {0.416114, 0.416114}, {0.485926, 0.485926}, {0.499604, 0.499604}, {0.5, 0.5}, {0.5, 0.5}, ... {0.5, 0.5}} *)
I've found a couple easy workarounds for this minimal example (e.g. use n
instead of {n}
, use NestList
instead of RecurrenceTable
), but I've got RecurrenceTable
embedded in a general function that requires both a list of dependent variables and doesn't play well with NestList
. I just wanted to see if others have this same issue, which I'll report to WRI. I'm using Mathematica 11.0.1 on MacOS 10.12.
Answer
@ilian's fix in comments above works fine: add Method -> {Compiled -> False}
. I've also reported to WRI.
Comments
Post a Comment