Simulation CS Thinking Example 3
Follow the full solution, then compare it with the other examples linked below.
Example 3
mediumYou are designing a simulation to model the spread of a disease through a school. What variables would you include, and what would you simplify?
Solution
- 1 Step 1: Include: number of students, infection rate (probability of spreading on contact), recovery time, number of contacts per day. These directly affect disease spread.
- 2 Step 2: Simplify: assume all students are identical (same susceptibility), contacts are random, and ignore factors like age, vaccination status, and room ventilation. Add complexity only if these simplifications produce unrealistic results.
Answer
Include: population size, infection rate, recovery time, contact rate. Simplify: uniform susceptibility, random contacts, ignore environmental details.
Designing a simulation requires balancing detail with tractability. Start simple, validate against real data, and add complexity only where the simple model fails.
About Simulation
Using a computer program to model and experiment with a real-world system or process. Simulations represent key variables and their relationships mathematically, allowing you to test scenarios, make predictions, and explore outcomes without real-world cost or risk.
Learn more about Simulation โMore Simulation Examples
Example 1 easy
A weather app uses a computer simulation to predict tomorrow's weather. What is a simulation and why
Example 2 mediumA traffic simulation models cars on a road. Each car has a speed and position. Every second, each ca
Example 4 hardA dice-rolling simulation generates random numbers 1-6 to simulate rolling a die 1000 times. Why mig