Message Boards Message Boards

0
|
4894 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

NestList question

Posted 10 years ago

Hello, I have the followiing functions

dR[a_,b_,r_]=r+a*b;
rSim[a_,b_,r_]=r+dR[a,b,r];
S=NestList[0.1,0.05,#]&,0.03,m]

where m is the number of steps.

What I would like to do is to introduce a noise in dR[]. This noise consists on a matrix w of dimension [n,m] supplied externally. such that dR will become

dR[a_,b_,r_,w_]:=r+a*b*w

and at the end I would have a matrix of S of dimension [n,m]. How can I adapt the NestList[] function? Is this function the right one to use or do I need to change it with another?

Thanks a lot for help. Best regards, P

POSTED BY: Tarpanelli Paolo
2 Replies

A one-dimensional version where the random additions are generated inside NestList

dR[a_, b_, r_, w_] := r + a*b*w;
rSim[a_, b_, w_, r_] = r + dR[a, b, r, w];
NestList[rSim[a, b, RandomReal[], #] &, r0, 3]

With FoldList you can provide a list of externally generated random additions:

randomWList = RandomReal[{0, 1}, 3];
FoldList[rSim[a, b, #2, #1] &, r0, randomWList]
POSTED BY: Gianluca Gorni

What kind of noise matrix?

You can make a matrix of random values fairly easily using RandomVariate:

RandomVariate[NormalDistribution[], {m, n}]

Remember in Mathematica that Matrix multiplication is done with a "." and not "*". Star will do a piecewise multiplication.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract