One of my functions automatically generates systems for RecurrenceTable
. Usually works fine, but today I encountered a problem. If the right-hand side is a constant, it doesn't evaluate:
RecurrenceTable[{n[t + 1] == 2, n[0] == 1}, n, {t, 0, 10}]
(* RecurrenceTable[{n[t + 1] == 2, n[0] == 1}, n, {t, 0, 10}] *)
One workaround I discovered:
RecurrenceTable[{n[t + 1] == 2 + Unevaluated[0 n[t]],
n[0] == 1}, n, {t, 0, 10}]
(* {1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} *)
Are there others? Should this be considered a bug?
RecurrenceTable[{n[t + 1] == 2 + a*n[t], n[0] == 1}, n[t], {t, 0, 10}] /. a -> 0
$\endgroup$a*n[t]
term buta
happened to equal zero. I'd like to avoid those intermediate algebraic results and just have it run numerically. Anyhow, I've uncovered some other unexpected issues withRecurrenceTable
that will require a rethink on my part to solve... $\endgroup$