MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: delay evaluation inside RecurrencTable?


Very good, Wolfgang; of what use is RecurrenceTable in the first place?

Bobby

On Sun, 30 Oct 2011 04:23:31 -0500, Dr. Wolfgang Hintze <weh at snafu.de>  
wrote:

>
> "Alan" <alan.isaac at gmail.com> schrieb im Newsbeitrag
> news:j8gms1$53k$1 at smc.vnet.net...
>> My first attempt to simulate an AR(1) process was
>> RecurrenceTable[{a[n] == 0.8*a[n - 1] + RandomReal[{-1, 1}],
>>  a[0] == 100}, a, {n, 1, 20}]
>> which of course failed because RandomReal was only evaluated once.
>>
>> Is there some way to get a new evaluation of RandomReal for each n
>> (*inside* RecurrenceTable)?
>>
>> Thanks,
>> Alan Isaac
>>
>> PS Sorry if this repeats. I posted this question days ago and it has
>> not yet appeared.
>>
>
> What about this?
>
> a[0] = 100; Table[a[k] = 0.8*a[k - 1] + RandomReal[{-1, 1}] , {k, 1,
> 20}]
>
> Each time you call the Table new random numbers are taken taken.
>
> --- Wolfgang
>
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: efficiently testing a list
  • Next by Date: Re: Simple question about inverse of a function
  • Previous by thread: Re: delay evaluation inside RecurrencTable?
  • Next by thread: Re: delay evaluation inside RecurrencTable?