Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: very basic RecurrenceTable puzzle
Replies: 3   Last Post: May 7, 2013 3:53 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Dana DeLouis

Posts: 24
Registered: 11/18/12
Re: very basic RecurrenceTable puzzle
Posted: May 7, 2013 3:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.