Main menu

- Home Page
- Sensors
- Simulation
- Analytics
- Forecasting
- Football Forecasting
- Random Corner
- Projects
- Resources
- Blog
- About/Contact
- Creative Works
- Separator 1
- Privacy & Terms

Simulation > Introduction to Simulation

*July 3, 2017*

Another key characteristic of a simulation model is whether it contains 'random' elements or not. If a model does not have any random component, it will provide the same results each time it is run, assuming the same inputs and initial conditions (in the case of a dynamic model) are used. If the model contains any random components, however, you can expect the model's behavior to vary from run to run, even when presented with the same inputs and initial conditions. A model that does not have any random component is described as 'deterministic', while one with random components is described as 'stochastic'.

Why would you deliberately add random behavior to a simulation model? There are many good reasons for doing so, perhaps the best being that the system being modeled behaves randomly itself. For example, consider a simulation of a casino card game such as blackjack. While the vast majority of rules needed to model the game are very clear-*random* order before beginning play. Casinos make a significant effort to ensuring that the cards are shuffled into random order, typically using automatic shuffling machines to do so – failing to achieve a random ordering opens the doors for exploitation by sophisticated player. In a simulation model, not including the random aspect of the game would result in a simulation that gave the same outcome on every run.

In that other casino, known as Wall Street, stochastic models are often used to help design and price financial instruments such as derivatives. While nobody knows whether an individual stock's price will go up or down over some future period of time, it is often assumed that its prior *statistical behavior* will continue into the future. This means that if the stock has had a given historical daily volatility (changes in price, whether up or down) , that volatility will remain somewhat constant into the future. The stock's price is then modeled as a *random walk*, or similar type of stochastic process using the stock's prior statistical behavior as input. While any given simulation run of the random process model may show the stock's price going up or down, repeated runs can provide an idea of how much it is likely to go up or down over a given future time period, which is critical information to know when trying to assign a value to options and other derivatives. For the case in which a normal (Gaussian) statistical distribution is assumed (and commonly adopted contract terms), analytic methods such as the Black-

Another common situation where random behavior is added to a model is to help understand how the system under study varies with respect to its parameters. Consider the process of designing an electronic audio amplifier, such as might be used in any number of consumer products for driving a speaker or headphones. In a well-*Monte Carlo model*, where you decide to run the simulation a large, but fixed number of times, but assign random values (within relevant limits) to the model's properties. The results of the resulting hundreds or thousands or runs are then typically plotted over each other. If enough runs were performed with respect to the number of parameters that were randomly varied, the resulting plot gives the designer a good idea of how the design will perform when mass-

One interesting question is that of how you get random behavior out of a very deterministic computer. The way through which this is most commonly accomplished is through the use of *pseudo- random*

X[n+1] = (a X[n] + b) mod c

If one chooses appropriate values of a, b and c, and iteratively applies this formula to X, the result will be a sequence of X values which will appear to be 'random'. To get the process going, however, one must provide an initial value for X ( X[0] ) known as the *seed*. For example, using the values of a=123, b=753, c=100 and X[0] = 23, the linear congruential method generates the following sequence.

On casual examination this sequence certainly appears random, and it would be quite difficult to predict the next number (X[12] = 63) in it without knowing first that the sequence was the result of a linear congruential generator and secondly the values of a,b, and c.

As pseudo-

Note that while the sequences generated by the linear congruential method may appear to be random, the method is hardly the last word in pseudo-**References:**

[Veale 2013] Veale, Stuart R. Derivatives: Demystifying Derivatives and their Applications,

Prentice Hall Press, New York, 2013, pp. 167-

[Knuth 1981] Knuth, Donald E., *The Art of Computer Programming, Volume 2: Seminumerical Algorithms*, 2 nd ed. Addison-