14.2 Simulation and Modeling

Key Takeaways

  • A model is an abstraction of a real system that keeps the features relevant to a question; a simulation is a program that runs the model to see how the system behaves.
  • A simulation needs initial conditions, rules that update the state at each step, parameter values, often random events, and the outputs to record.
  • A model is validated by comparing its results with real-world observations or experiments, not by running it on different computers or rewriting its code.
  • Adding variables or detail can make a simulation more realistic but also slower, more complex, and harder to validate; running more random trials makes estimates more reliable.
  • Simulations are used when real experiments would be too dangerous, slow, expensive, or impossible, as in weather forecasting, epidemics, traffic, flight training, and ecology.
Last updated: September 2026

What this competency asks

ETS asks you to be familiar with the use of computing in simulation and modeling:

  1. Describe questions that can be answered with a given simulation, or explain what data and process are required to answer a given question.
  2. Trace code in a simulation context.
  3. Identify missing code in a simulation context.
  4. Identify the impact of changes to simulations (for example, more or fewer variables, more or less data).
  5. Identify applications of simulation and modeling.

ETS's sample question asks how to validate a plant-growth simulation. The answer is to run real-world experiments and compare their results with the simulation's.

Models and simulations

A model is a simplified representation of a system. It keeps what matters for the question and leaves out the rest, which is abstraction (Section 4.1). A simulation is a program that runs the model: it starts from initial conditions and repeatedly applies rules to update the state, over time steps or across many random trials.

ComponentExample: disease-spread model
State variablesNumber of susceptible, infected, and recovered people
Initial conditions990 susceptible, 10 infected, 0 recovered
ParametersInfection probability per contact; days until recovery
Rules / processEach day, some susceptible people become infected, and some infected people recover
Random events (if stochastic)Whether a particular contact results in infection
OutputsPeak number infected; day of the peak; total ever infected

What questions can a simulation answer?

A simulation can answer only questions about quantities it models. A traffic simulation that includes signal timing and car arrivals can estimate average waiting time under different signal plans. It cannot tell you about air pollution unless emissions are part of the model. When a question asks what data and process a simulation needs, list the state variables, parameters, rules, and outputs connected to the question.

Tracing simulation code

Deterministic growth (the same result every run):

// population is an int; / performs integer division
int population ← 50
int hours ← 0
while ( population < 200 )
    population ← population + population / 2
    hours ← hours + 1
end while
print hours
hours (after update)population
050
150 + 25 = 75
275 + 37 = 112
3112 + 56 = 168
4168 + 84 = 252

The loop stops once population reaches 200 or more, so the program prints 4. Integer division truncated 75 / 2 to 37, a small modeling approximation.

Stochastic simulation (results vary from run to run): estimate the probability of rolling a sum of 7 with two dice.

int sevens ← 0
int trials ← 10000
for ( int i ← 0; i < trials; i ← i + 1 )
    int roll ← randomInt ( 1, 6 ) + randomInt ( 1, 6 )
    if ( roll == 7 )
        sevens ← sevens + 1
    end if
end for
print sevens / trials      // assume floating-point division

The estimate will be close to the exact value, 6/36 ≈ 0.167, and closer with more trials. This is a Monte Carlo simulation (Section 5.3).

The impact of changes

ChangeLikely effect
More variables or finer detail (weather, driver behavior)More realistic, but slower, more complex, needing more data, and harder to validate
Fewer variables (simplifying assumptions)Faster and easier to understand, but may miss important effects and bias results
More data for setting parametersMore accurate parameters and more trustworthy results
Less data, or unrepresentative dataLess reliable parameters; results may not generalize
More trials (random simulation)Estimates vary less between runs and are more reliable
Smaller time stepsMore accurate tracking of change, but more computation
Changing one parameter at a timeShows how sensitive the outcome is to that factor

Validating a simulation

Validation asks: does the model match reality? The standard method is to compare simulation output with real-world data or experiments under the same conditions. If a traffic model predicts 45-second average waits at an intersection where cameras measured 47 seconds, it is behaving plausibly.

Actions that do not validate a model:

  • Running it on different computers. You get the same answers but learn nothing about reality.
  • Rewriting it recursively instead of iteratively. That checks the code, not the model.
  • Making it faster. Efficiency is not accuracy.

Checking that the code correctly implements the intended model is verification, which is also necessary but different.

Why simulate?

AdvantageExample
SafetyPilot training in flight simulators; crash testing virtual cars
CostTesting a bridge design before building it
SpeedSimulating a century of climate in days
Impossible experimentsGalaxy formation; nuclear reactions
What-if explorationEvacuation plans; school bell schedules; vaccination strategies
RepeatabilityIdentical conditions, or a fixed random seed, for fair comparisons

Limitations: results depend on assumptions; important factors may be left out; random simulations give estimates, not exact answers; and complex models can demand large computing resources.

Applications

Weather and climate forecasting, epidemic modeling, traffic and transit planning, ecology (predator–prey populations), economics and finance, engineering (stress, airflow, crash tests), medicine and drug design, sports and games, and education. Agent-based tools such as NetLogo let students simulate many individual agents, such as birds, cars, or people, and watch group behavior emerge from simple rules.

Test Your Knowledge

A city builds a computer simulation to predict traffic delays under a new signal timing plan. Which action would best validate the simulation's model?

A
B
C
D
Test Your Knowledge

Assume population is an int and / performs integer division. What is printed?

int population ← 50
int hours ← 0
while ( population < 200 )
    population ← population + population / 2
    hours ← hours + 1
end while
print hours

A
B
C
D
Test Your Knowledge

A student's dice simulation estimates the probability of rolling a 7. Run with 100 trials, the estimate varies a lot from run to run. What change will most improve the reliability of the estimate?

A
B
C
D
Test Your Knowledge

The simulation below should estimate the probability that a fair coin lands heads. random ( ) returns a value r with 0.0 ≤ r < 1.0. Which condition should replace /* missing condition */?

int heads ← 0
for ( int i ← 0; i < 1000; i ← i + 1 )
    if ( /* missing condition */ )
        heads ← heads + 1
    end if
end for

A
B
C
D