☰ Year plan · Communication Technology

Models and simulations

Week 10 · Chapter 11 Simulations: models and modelling, simulating with a spreadsheet, random numbers and Monte Carlo, queues · 3 lessons
2

Simulating with a spreadsheet and with chance

ICT Secondary 1 Term 1, Chapter 11: pp. 142–154
GoalBuild a simulation in a spreadsheet table with a fixed rate, and use random trials to estimate a chance.
New words
relative / absolute reference · a cell address that moves when copied / one that stays fixedcompound interest · interest that is added to the base, so next year’s interest is biggersimulation · running a model many times to see what happensMonte Carlo method · estimating a quantity from many random trials
Explanation

A spreadsheet is a good place for simulations: each row is one year or one trial. Take savings of 1,000 pounds with an invented yearly interest rate of 10%. The rate is typed once, in a fixed cell. When a formula is copied down, a relative reference such as B4 moves to B5, B6 and so on, but an absolute reference such as $B$1 stays on the rate cell. So the interest in each row is the start of the year times the rate. With compound interest, each year’s interest is added to the base, so the next year’s interest is larger: after t years the amount is P × (1 + r)ᵗ, which for 1,000 pounds, 10% and 3 years is 1,000 × 1.1 × 1.1 × 1.1 = 1,331 pounds. A simulation with chance uses random numbers. A die has six equal chances. If we throw two dice, the chance that the sum is 7 is 6 out of 36, because 6 of the 36 pairs make 7: 1 + 6, 2 + 5, 3 + 4 and their reversals. That is 1/6. The Monte Carlo method estimates such a chance by repeating the experiment many times and counting. With few trials the estimate can be far off; with many it gets close.

C4fx=B4*$B$1
ABCD
1Rate0.1
2
3YearStart (£)Interest (£)End (£)
4110001001100
5211001101210
6312101211331
Worked examples
YearStartInterest = start × 0.1End
110001001100
211001101210
312101211331
The table shows the simulation. Year 1: interest 1,000 × 0.1 = 100, end 1,100. Year 2 starts at 1,100: interest 110, end 1,210. Year 3: interest 121, end 1,331. The formula in the picture uses $B$1 for the rate, so copying it down does not move the rate.
Trial123456789101112
Sum73127886721077
Twelve trials of throwing two dice have been recorded in the table (the pairs are given, not random now). The sum was 7 in 5 trials out of 12, which is 0.42, far from 1/6 = 0.17. Few trials are not a safe estimate. With 600 trials the share would usually be close to 1/6.
0510159111081210123456times in 60 throws
A die was thrown 60 times; the counts of each face are in the chart: 9, 11, 10, 8, 12, 10. A fair die would give 10 of each, and the counts are close to 10, but not exactly, because chance varies.
Class activity

Continue the table to year 5 by hand (1,000 pounds, 10%, interest added each year). Then say what changes if the rate is 20%. Why would a spreadsheet keep the rate in one fixed cell?

Practice
1
500 pounds at 10% a year with compound interest: how much after 2 years?
2
In the formula =B4*$B$1, which reference moves when the formula is copied down?
3
How many of the 36 pairs of two dice give the sum 4?
4
A simulation of two dice gives the sum 7 in 4 of 30 trials. Is that a safe estimate of the chance?