Re: very basic RecurrenceTable puzzle
- To: mathgroup at smc.vnet.net
- Subject: [mg130733] Re: very basic RecurrenceTable puzzle
- From: Dana DeLouis <dana01 at icloud.com>
- Date: Tue, 7 May 2013 03:55:28 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
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[t-1]. 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 UTC-4, 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