# Bad Tomatoes

Extracts from this essay...

Introduction

Maths Coursework Investigation Bad Tomatoes My aim is to investigate the mathematical propagation of 'bad tomatoes' This is essentially an investigation of patterns derived from a simple set of rules for this propagation, in the manner of a simplified life genesis program. The rules are as followed: 1. The first hour, any one of the tomatoes (depending on the investigation) turns 'bad' 2. From that hour on, any tomato touched by a bad tomato will turn bad itself, on an hourly basis. 3. Tomatoes are constrained within an n*n grid, which restricts propagation of bad tomatoes. As visible from the rules, this allows for creation of simple models to show the propagation of bad tomatoes. From these, I hope to derive formulae, or sets of rules if formulae are not possible, to make logical predictions. We shall define the variables as will be used in the description of this investigation as follows: n The hour in which a tomato turns g The grid size (g2) x The number of turned tomatoes in each n h The number of hours taken for all tomatoes to go bad t Total number of turned tomatoes (equal to g2) Contents Item Page number Introduction 1 Contents 2 Mapping of tomatoes in the middle of a side 3 Tomatoes in the corner 7 Conclusion 9 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Middle

x is yellow, and if g<n-((g-1)/2) then x is green If g is even: if g>= n-(g/2) x is yellow, and if g<n-(g/2) x is green We then move to region specific instructions: Yellow x =2n-1 Green x =g Purple (Calculating purple numbers is substantially more complex) (Also note the existence of bln, a new variable we introduce here whose meaning will be explained later) Do n mod 3: N mod 3 = 0 then Bln = 2(n/3) N mod 3 = 1 then Bln = (2((n+2)/3))-1 N mod 3 = 2 then Bln = 2((n+1)/3) Do g - bln Again, look at n mod 3: If 0, multiply last number by 3 and add 1 If 1, multiply last number by 3 and add 2 If 2, multiply last number by 3 and add 3 Therefore, by this process we can calculate any number from the grid size and the hour. For our example, g = 24 and n = 25, we would do the following: 1. n > g, therefore x is purple 2. 25 mod 3 is 1, therefore bln = 2(27/3))-1 = 17 3. 24 - 17 is 7 4. 25 mod 3 is 1, therefore we: 5. Multiply 7 by 3 = 21 6. And add 2, giving 23 I have checked this with both an extended table of results (created using the patterns found earlier), and with a small excel macro designed to count the numbers of tomatoes turned each hour. Both yield the same result. 22 23 24 25 26 21 23 24 25 26 19 22 24 25 26 17 20 23 25 26 15 18 21 24 26 13 16 19 22 25 11 14 17 20 23 22,24 23,24 24,24 25,23 26,21 27,19 28,17 29,15 The left is the segment from my expanded table showing the result. The '23' in the middle of the table represents grid size 24 and hour 25 - what my formula predicted.

Conclusion

Later I managed to use features in excel to semi-automate the counting and drawing of grids, which helped me to create my final solution, but it would have been helpful for me to have achieved this earlier. Had I been able, earlier in the project, to create a program to model the spread of bad tomatoes, this would have allowed me to analyse all the data on a much larger and more general scale. While I like to be as general as possible, the sheer amount of data that would have been needed to analyse patterns on a multi-encompassing scale (i.e. to have formulae including starting position and varying side lengths (I.e. rectangular shapes)) made it prohibitive and near impossible to do without an automatic data modelling system. Certainly, were I to have to improve on this project, that would be the first step. Another drawback of the project was the lack of computer equipment while doing the project in lessons. As I have mentioned, without my automations for the drawing and counting of numbers in a grid, it would have been unlikely that I would have found a pattern. Had I had access to these facilities while doing the bulk of the project, I believe that I would have found the formulae much quicker, and would have gone on to further extend my project, doing such things as look at rectangular grids. As it was, a large amount of time was wasted due to the vast amount of time it would have taken to calculate things manually. I feel, generally, that the project was a success. Despite a number of setbacks, I was able to find a formula encompassing everything I wished it to, and also did an extension upon the project. Both my main formulae have coped with any numbers I have fed through them, and I have thus far seen no faults in them that were not corrected upon re-examination of the data. 1

## Found what you're looking for?

- Start learning 29% faster today
- Over 150,000 essays available
- Just £6.99 a month