MathGroup Archive 1999

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

Search the Archive

Re: Re: Simulation

  • To: mathgroup at
  • Subject: [mg19443] Re: [mg19400] Re: [mg19353] Simulation
  • From: "Tomas Garza" <tgarza at>
  • Date: Wed, 25 Aug 1999 01:25:14 -0400
  • Sender: owner-wri-mathgroup at

Oops! A misprint occurred in my message [mg19400]:

data1 = Table[NestList[# + 0.01*g[Random[Integer]] &, 5, 1000]]; // Timing

should read

data1 = Table[NestList[# + 0.01*g[Random[]] &, 5, 1000]]; // Timing

One comment. Most other answers to this problema have suggested the obvious
approach, like (r = Random[]; Which[r <= 1/6, -1, r > 5/6, 1, True, 0]).
However, this might be more difficult to implement if instead of only three
values (-1, 0, 1) there were, say, 50 or 100, e.g. if one were simulating
the operation of a mortality table. The one I gave can be applied to these
more general situations with practically no additional effort, and it
involves no noticeable increase in time.

Tomas Garza
Mexico City

  • Prev by Date: Double click on word selects whole cell
  • Next by Date: Simple question about packages
  • Previous by thread: Re: Simulation
  • Next by thread: Characteristic Polynomials and Eigenvalues