Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: delay evaluation inside RecurrencTable?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122491] Re: delay evaluation inside RecurrencTable?
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 30 Oct 2011 04:20:59 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110291107.HAA05177@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

rr := RandomReal[{-1, 1}];
RecurrenceTable[{a[n] == 0.8*a[n - 1] + rr, a[0] == 100}, a, {n, 1,
   20}]

Bobby

On Sat, 29 Oct 2011 06:07:35 -0500, Alan <alan.isaac at gmail.com> wrote:

> 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.
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: FindInstance with all positive numbers
  • Next by Date: Re: delay evaluation inside RecurrencTable?
  • Previous by thread: delay evaluation inside RecurrencTable?
  • Next by thread: Re: delay evaluation inside RecurrencTable?