Source code



This project was created by a Home Education group (consisting of four under 16s) currently participating in a John Muir Conserver Award for conservation. It was also submitted for the Mathematics of Planet Earth Schools competition run by the MPE centre at the CDT of Imperial College London in 2017 where it won first prize.


Programming, Research, Design, CoordinationReuben Allison
Research, Design, CoordinationSam O'Connor, Research, Design, CoordinationThaddeus Allison, Research, Design, CoordinationDylan O'Connor
Team LeaderLouise Kerbiriou, Team LeaderAlison Allison

This module aims to educate young people (14-19) about the importance of trees, the significance of tree diseases worldwide, and their rates of infection. It introduces the concept of mathematical modelling, and attempts to demonstrate how an increasingly accurate mathematical model can be created through the addition and modification of algorithms. The activity sheets allow students to access source code and through making alterations create a more realistic model.

Trees around the world are being threatened by an increasing number of pests and diseases, a truly terrible thing for our planet. Trees provide oxygen to breath, shelter entire ecosystems and make our planet beautiful amongst many things, and must be fiercely protected. We have evolved in partnership with plants, but our current movement of people and vegetation around the globe has resulted in the dissemination of devastating infections and infestations at a rate that does not allow natural resistance to develop. Dutch Elm Disease has almost totally destroyed mature Elm trees in the UK, and there are a growing number of new epidemics, such a Chalara fraxinea, that now threaten other major tree varieties. Every continent, despite the diversity of trees to be found, is being affected, and this is a huge global threat. We need to understand more about how to monitor spread and predict those trees at risk so that we can maximize our chance of protecting trees for the future. The more people are aware of, and and can identify diseases, the better our global monitoring will be, given the ubiquity of trees on the planet.

We are a group of two home educating families and we have been investigating the identification of trees and their diseases. This resulted in the building of a mathematical model in the form of a board game to look at how disease might spread from an index case and the probability of further trees becoming infected. Data was used from the British Forestry Commission to ensure that the model is as accurate as possible and linked to real tree disease. The first computer model used in this project was submitted to the Mathematics of Planet Earth schools competition at Imperial College London (under 16s) and to our great delight was chosen as the winner to be presented in their Exhibition in October 2017. If we are successful in this competition, the CDT (MPE) department of Imperial College have kindly agreed to fund the visualization of our model by a professional developer.

After our initial study, we developed four versions of a computer program which attempt to model the spread of tree diseases. The first model demonstrates the spread of a disease such as Dutch Elm Disease which spreads rapidly in a tree population with virtually no immunity. The second models the spread of a disease among a tree population with 10% immunity (such as Chalara). The third model adds the factor of human footfall and shows how a disease can spread more rapidly through a population when spores are spread via clothing and footwear. The last model combines the effects of immunity and human footfall.

 The program charts the spread of the disease from one selected tree (coloured red on the map). A random number is generated (from 1-6 to emulate the roll of a die). Depending on the outcome, a radius of infection is chosen, for instance, if a ‘1’ is generated, then the radius of infection is 1.9m, a ‘2’ creates a radius of 2.4m and a ‘3’ creates a 1.5m radius.

The program iterates through the list of infected trees and tests whether a healthy tree is in the infection radius using the Pythagorean circle theorem, where ‘d’ is diameter of the circle, x and y (p) are the coordinates of the healthy tree and x and y (c) are the coordinates of the infected tree.

 ‘r’ is now taken to be the radius of the circle. If d <= (smaller than or equal to) r, then d is within the radius of the circle, or on the edge of the circle, and therefore the healthy tree can be infected and changes from green to red.

If a ‘4’, ‘5’ or ‘6’ are rolled then another random number (from 1 to 6) is generated. If this second number is equal to 2 then a random healthy tree, anywhere on the map, is infected. This is to model the arrival of additional insects from elsewhere.

The second model has been altered to make 10% of healthy trees immune. Or rather, upon start-up, each healthy tree has a 10% chance of becoming immune. We achieved this by iterating through the list of healthy trees, and generating a random number between 1 and 10 for each tree. If this number is a 3, then that healthy tree then becomes immune and is ignored by the disease. Immune trees are shown as blue on the map.

The third program utilises a file, which plots the line of the path through the map. To infect healthy trees, the program iterates through the list of the path’s points and checks whether a healthy tree can be infected by one of these points, using the same equation as used before with the infected trees, but within a set circle radius of 2m. If a path point can infect healthy trees, it does so, infecting all healthy trees within its circle of infection. Then the infection can spread from these infected trees, in the usual way.

 The fouth program is an amalgamation of the two previous programs and shows the effects of natural immunity and human footfall working in combination.

 The activity sheets provided lead students to explore:

  • the importance of trees
  • the global significance of the spread of tree diseases
  • how mathematical models can be created
  • how to draw a simple model forest and look at the probability of infection spread using a dice
  • how computer code can be used to create a model of the spread of infection
  • how the source code can be changed to work towards an increasingly accurate model
  • how individuals with a simple understanding of computer code can create useful models which have real world significance and impact


We hope that these programs can be further developed by beginner programmers to examine the spread of tree diseases in many other ways.  The use of citizen science has already begun to increase our knowledge about the rates of tree infection through sites such as Opal. We hope that with increasingly accurate data our mathematical models can be improved and may enable prediction of the trees most at risk, and therefore most in need of protection. This could allow targeted responses to maximize protection and minimise the cost.


주 파일