Mathematical Modelling (Coding)
Mathematical modelling with code transforms abstract concepts into tangible problem-solving tools that students can visualize and test. When a 7th grader writes distance = speed × time and runs it with different values, they're building computational thinking alongside math fluency.
Why it matters
Mathematical modelling with coding prepares students for data science careers where professionals earn $126,000 annually on average. Students learn to translate real scenarios into formulas, then test multiple inputs systematically. A marketing analyst might model revenue = price × units - costs, testing 50 different price points to find the optimal strategy. Environmental scientists use population models with 3% annual decay rates to predict species survival over 20-year periods. Financial planners model compound interest with monthly contributions of $200 growing at 7% annually. These iterative models help students understand that mathematics isn't just calculation—it's prediction, optimization, and decision-making. When students code y = 2x + 15 and test 10 different x-values, they grasp linear relationships more deeply than through worksheets alone.
How to solve mathematical modelling (coding)
Modelling with Code
- Identify the real-world relationship to model.
- Write a formula or rule as code (e.g. y = 2*x + 3).
- Use loops or iteration to test multiple inputs.
- Compare the model's output to real data to check accuracy.
Example: Model: cost = 5 * items + 10. For 3 items: cost = 25.
Worked examples
A savings account starts at $19.00. You add $7.00 each week for 2 weeks. How much do you have?
Answer: 33
- Set up the model → total = 19 + 7 x 2 — Start + deposits.
- Calculate → total = 19 + 14 = 33 — After 2 iterations.
A runner jogs at 9 km/h. What distance is covered in 2 hours?
Answer: d = 9 x 2 = 18 km
- Write formula → d = 9 x t — distance = speed x time.
- Substitute → d = 9 x 2 = 18 — The runner covers 18 km.
A population starts at 500. Each year it decreases by 10%. Model 3 years using a loop.
Answer: 365
- Set up loop → p = 500; repeat 3: p = p - p x 10/100 — Subtract the percentage each year.
- Trace values → 500 -> 450 -> 405 -> 365 — After 3 iterations: 365.
Common mistakes
- Students write accumulation formulas incorrectly, calculating 19 + 7 × 2 = 52 instead of 19 + (7 × 2) = 33 by multiplying the starting value
- Students forget to iterate in loops, showing final population as 500 - (500 × 0.10 × 3) = 350 instead of applying 10% decay three separate times to get 364.5
- Students confuse variable assignment with equations, writing total = total + 5 as an algebraic statement rather than understanding it updates the total value