# Bad Tomatoes

Extracts from this document...

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:

- The first hour, any one of the tomatoes (depending on the investigation) turns ‘bad’
- From that hour on, any tomato touched by a bad tomato will turn bad itself, on an hourly basis.
- 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 |

Middle

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

This grid represents the propagation of bad tomatoes in an nxn square, covering grids up to size 24x24. Some of the results for this data are plotted on the table below:

n | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | ||

1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |

| 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | |

3 | 4 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | |

4 | 4 | 5 | 6 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | |

5 | 3 | 5 | 6 | 7 | 8 | 9 | 9 | 9 | 9 | 9 | |

6 | 1 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 11 | 11 | |

7 | 2 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ||

8 | 3 | 6 | 8 | 11 | 12 | 13 | 14 | ||||

9 | 1 | 4 | 7 | 9 | 10 | 11 | 12 | ||||

10 | 2 | 5 | 8 | 10 | 11 | 12 | |||||

11 | 3 | 6 | 9 | 11 | |||||||

12 | 1 | 4 | 7 | ||||||||

13 | 2 | 5 | |||||||||

14 | 2 | ||||||||||

15 | 1 |

While at first it seems the patterns in this table should be obvious, this is deceptive. Only by splitting the table into three regions do we see the separate patterns defining the table. These regions, as shown in the following table, allow patterns to emerge. These patterns do not, as you would expect, work down with different numbers in the same grids, but instead work across with the same number in different grids.

In the first region (yellow), we see that, in every case, x is equal to n+n-1. The latter two regions (green and purple) are substantially harder, and require a sequential approach. Naturally, the first step in devising a formula, to take n and g and return x, is determining which region the number lies in. This is a simple matter of comparing g with n. Once we know the region, we can use a set op steps to calculate the number x. The method for carrying out this operation will be described shortly.

n | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |

1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |

2 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |

3 | 4 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 |

4 | 4 | 5 | 6 | 7 | 7 | 7 | 7 | 7 | 7 | 7 |

5 | 3 | 5 | 6 | 7 | 8 | 9 | 9 | 9 | 9 | 9 |

6 | 1 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 11 | 11 |

7 | 2 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | |

8 | 3 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | ||

9 | 1 | 4 | 7 | 9 | 10 | 11 | 12 | 13 | ||

10 | 2 | 5 | 8 | 10 | 11 | 12 | 13 | |||

11 | 3 | 6 | 9 | 11 | 12 | 13 | ||||

12 | 1 | 4 | 7 | 10 | 12 | 13 | ||||

13 | 2 | 5 | 8 | 11 | 13 | |||||

14 | 3 | 6 | 9 | 12 | ||||||

15 | 1 | 4 | 7 | 10 | ||||||

16 | 2 | 5 | 8 | |||||||

17 | 3 | 6 | ||||||||

18 | 1 | 4 | ||||||||

19 | 2 |

The left grid shows an updated version of my results demonstrating the three regions yellow, green and purple, as well as some extra data formulated from the patterns observed. This is the first step in trying to formulate equations to work on all situations. Before moving on to the main essence of the project, finding a formula to derive x from n and g, we shall examine a few other formulae not directly related to this but still relevant to the investigation.

- To find the total number of hours taken for all tomatoes to go bad within a grid, you use a formula depending on g. This formula also depends on whether g is odd or even:
- If g is odd, then h=((g+1)/2)-1
- If g is even then h=(g/2)+1
- In all square grid situations, t is always g2.
- The number of tomatoes to turn each hour in an infinite grid, starting on the side in the centre is equal to 2n-1
- The total number of tomatoes that are bad after each hour is equal to n2.

We shall briefly describe the patterns used to expand this table and in the following formulae:

Yellow numbers always go up by 0 each grid size

Green numbers go up by 1

Purple numbers go up by 3

Green/yellow boundaries go up by 1

Purple/green boundaries go up by 2

We now move on to analyse the main problem: the individual number of tomatoes to turn in each hour. This, as mentioned earlier, is a much more complicated program, and requires division of the grid into three regions. The following steps attempt to demonstrate how, and why, this is done.

- The first step is to compare n with g, to work out which region the answer is likely to lie in. For this example we shall use two numbers, grid size 24 and tomato number 25.

Compare n with g:

If n>g, x lies in the purple region

If n=g, x lies in the green region

If g>n, x lies in green or yellow and further calculation is needed:

If g is odd: if g>= n-((g-1)/2) 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:

- n > g, therefore x is purple
- 25 mod 3 is 1, therefore bln = 2(27/3))-1 = 17
- 24 – 17 is 7
- 25 mod 3 is 1, therefore we:
- Multiply 7 by 3 = 21
- 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 |

Conclusion

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.

This student written piece of work is one of many that can be found in our GCSE Bad Tomatoes section.

## Found what you're looking for?

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