MathGroup Archive 1999

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

Search the Archive

Re: response to Simulation

  • To: mathgroup at
  • Subject: [mg19409] Re: response to Simulation
  • From: rfinley at (Richard Finley)
  • Date: Mon, 23 Aug 1999 13:57:19 -0400
  • Organization: Internet Doorway, Inc. --
  • References: <7pl679$>
  • Sender: owner-wri-mathgroup at

Last night I responded to your message with the answer

data = Table[NestList[#+0.01*Sign[Random[Integer,{-1,4}]]&,5,1000]];

but I noticed a couple of things this morning.  The answer I gave will give
{-1,0,1} respectively with probabilities {1/6,1/6,4/6} rather than
{1/6,4/6,1/6} as you requested.  This is easy to fix and you can simply use:

data = NestList[#+0.01*(RotateLeft[{-1,0,1},Sign[Random[Integer,{-1,4}]]]
[[1]] )&,5,1000];

which will then give {-1,0,1} with the correct probabilities.  Note that I
also dropped the Table function as it is not contributing anything.
regards,  RF

Roberto Diego wrote in message <7pl679$cdc at>...
>Hi there,
>I need help on how the expression:
>could be modified in order to get -1 with probability 1/6, 0 with p 4/6 and
>1 with p 1/6 instead of 1/3,1/3,1/3
>Thanks a lot
>Roberto Diego
>Sociedad de Bolsas

  • Prev by Date: Re: circumference of an ellipse
  • Next by Date: Re: QUESTION (EigenVectors)
  • Previous by thread: Re: Any examples of FEA in Mathematica?
  • Next by thread: cell question