Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6019

Re: delay evaluation inside RecurrencTable?

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: delay evaluation inside RecurrencTable?
Date 2011-10-30 09:23 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j8j521$f0b$1@smc.vnet.net> (permalink)
References <201110291107.HAA05177@smc.vnet.net>

Show all headers | View raw


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@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@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: delay evaluation inside RecurrencTable? DrMajorBob <btreat1@austin.rr.com> - 2011-10-30 09:23 +0000
  Re: delay evaluation inside RecurrencTable? Alan <alan.isaac@gmail.com> - 2011-10-31 12:12 +0000

csiph-web