
Re: very basic RecurrenceTable puzzle
Posted:
May 7, 2013 3:53 AM


Hi. Just another idea:
t=UnitStep[Range[1,10]2]
{0,0,0,1,1,1,1,1,1,1,1,1}
If your data started at 1, here's another idea. It only works if your range is fixed: It's probably not very efficient in this case vs UnitStep.
f=FindSequenceFunction[t]
DifferenceRoot[Function[{\[FormalY],\[FormalN]} . . . etc . . .\[FormalY][4]==1}]]
f /@ (Range[1,12]) {0,0,0,1,1,1,1,1,1,1,1,1}
> st[t] == If[t < 2, st[t  1], 1
I don't believe the function works like this. st[t] == st[t1]. This would be the equation throughout the range. It would be hard for the equation to switch to another function at a different point in a range.
= = = = = = = = = = HTH :>) Dana DeLouis Mac & Mathematica 9 = = = = = = = = = =
On Saturday, May 4, 2013 4:23:00 PM UTC4, Alan wrote: > RecurrenceTable[{st[t] == If[t < 2, st[t  1], 1], st[1] == 0}, st, {t, 1, 5}] > > > > produces > > > > {0, st[1], st[0], 1, 1, 1, 1} > > > > I'm not seeing why the output contains st[1] and st[0] instead of 0s. > > > > Note that > > RecurrenceTable[{st[t] == st[t  1], st[1] == 0}, st, {t, 1, 5}] > > produces a list of zeros (i.e., no surprises). > > > > Thanks, > > Alan Isaac

