You are currently browsing the category archive for the ‘modelling’ category.

**Finding planes with radar**

PlusMaths recently did a nice post about the link between ellipses and radar (here), which inspired me to do my own mini investigation on this topic. We will work in 2D (with planes on the ground) for ease of calculations! A transmitter will send out signals – and if any of these hit an object (such as a plane) they will be reflected and received by a receiver. This locates the object as somewhere on the ellipse formed with the receiver and transmitter as the 2 foci. When we add a second receiver as shown above then if both receivers receive a signal, then we can narrow down the location of the object as the intersection of the 2 ellipses.

So, for this mini exploration I wanted to find the equations of 2 ellipses with a shared focus so that I could plot them on Desmos. I then would be able to find the intersection of the ellipses in simple cases when both ellipses’ major axis lies on the x axis.

**Defining ellipses**

For an ellipse centred at the origin shown above, with foci at c and -c we have:

where c is linked to a and b by the equation:

**Rotating an ellipse**

Next we can imagine a new ellipse in a coordinate system (u,v)

This coordinate system is created by rotating the x and y axis by an angle of theta radians anticlockwise about the origin. The following matrix transformation achieves this rotation:

This therefore gives:

and we can substitute this into our new coordinate system to give:

When we plot this we can therefore rotate our original ellipse by any given theta value:

We can use basic Pythagoras to see that the focus point c will become the point c1 shown above with coordinates:

By the same method we can see that the point c2 will have coordinates:

**Transformation**

Next we want to translate this new ellipse so that it shares a focus point with our original green ellipse. To do this we need to translate the point c2 to the point c. This is given by the translation:

So we can therefore translate our ellipse:

Which becomes:

When we plot this we get:

This then gives the 2nd ellipse in blue which does indeed share a focus point at c:

**Finding points of intersection**

The coordinates of when the 2 ellipses intersect is given by the solution to:

This looks a bit difficult! So let’s solve an easier problem – the points of intersection when the theta value is 0 (i.e when the ellipses both lie on the x axis). This simplifies things to give:

and we can find the y coordinates by substituting this into the original ellipse equation.

So the coordinates of intersection are given by:

So – in the above case we would be able to narrow down the location of the plane to 2 locations. With a 3rd ellipse we could pinpoint the location exactly.

**What is the average distance between 2 points in a rectangle?**

Say we have a rectangle, and choose any 2 random points within it. We then could calculate the distance between the 2 points. If we do this a large number of times, what would the average distance between the 2 points be?

**Monte Carlo method**

The Monte Carlo method is perfect for this – we can run the following code on Python:

This code will find the average distance between 2 points in a 10 by 10 square. It does this by generating 2 random coordinates, finding the distance between them and then repeating this process 999,999 times. It then works out the average value. If we do this it returns:

This means that on average, the distance between 2 random points in a 10 by 10 square is about 5.21.

**Generalising to rectangles**

I can now see what happens when I fix one side of the rectangle and vary the other side. The code below fixes one side of the rectangle at 1 unit, and then varies the other side in integer increments. For each rectangle it then calculates the average distance.

This then returns the first few values as:

This shows that for a 1 by 1 square the average distance between two points is around 0.52 and for a 1 by 10 rectangle the average distance is around 3.36.

**Plotting some Desmos graphs**

Because I have included the comma in the Python code I can now copy and paste this straight into Desmos. The dotted green points show how the average distance of a 1 by x rectangle changes as x increases. I then ran the same code to work out the average distance of a 10 by x rectangle (red), 20 by x rectangle (black), 30 by x rectangle (purple) and 100 by x rectangle (yellow).

We can see if we continue these points further that they all appear to approach the line y = 1/3 x (dotted green). This is a little surprising – i.e when x gets large, then for any n by x rectangle (with n fixed), an increase in x by one will tend towards an increase in the average distance by 1/3.

**Heavy duty maths!**

There is actually an equation that fits these curves – and will give the average distance, a(X) between any 2 points in a rectangle with sides a and b (a≥b). Here it is:

I added this equation into Desmos, by changing the a to x, and then adding a slider for b. So, when I set b=1 this generated the case when the side of a rectangle is fixed as 1 and the other side is increased:

Plotting these equations on Desmos then gives the following:

Pleasingly we can see that the points created by our Monte Carlo method fit pretty much exactly on the lines generated by these equations. By looking at these lines at a larger scale we can see that they do all indeed appear to be approaching the line y = 1/3 x.

**General equation for a square**

We can now consider the special case when a=b (i.e a square). This gives:

Which we can simplify to give:

We can see therefore that a square of side 1 (a=1) will have an average distance of 0.52 (2dp) and a square of side 10 (a=10) will have an average distance of 5.21 – which both agree with our earlier results.

**Life on the Beach with Markov Chains**

Markov chains are exceptionally useful tools for calculating probabilities – and are used in fields such as economics, biology, gambling, computing (such as Google’s search algorithm), marketing and many more. They can be used when we have the probability of a future event dependent on a current event. The image above is of the Russian mathematician Andrey Markov [public domain picture from here] who was the first mathematician to work in this field (in the late 1800s).

**Beach life**

The picture above is an example of a situation which can be modeled using a Markov chain. We have two states: Beach (state 1) and Home (state 2). In our happy life we spend all the hours of the day in either one of these two states. If we are on the beach then the probability we remain on the beach in one hour is 0.6 and the probability we go home in one hour is 0.4. If we are at home the probability we remain at home in one hour is 0.8 and the probability we go to the beach is 0.2. Hopefully you can see how this information is represented above.

**Using matrices**

First we need to represent our information in a matrix form. A general 2×2 matrix is written as:

Where the subscript tells you the row and column (e.g. a_12 tells you it is in the first row and 2nd column).

For our Markov chain we define the following matrix:

Here m_11 is the situation of starting in state 1 and moving to state 1. m_12 is the situation of starting in state 1 and moving to state 2. Therefore p(m_12) is the probability of starting in state 1 and moving to state 2. So for our beach existence we have:

The 0.6 shows that if we are already on the beach we have a 0.6 chance of still being on the beach in one hour.

**Where will we be in the future?**

The benefit of Markov chains is that they allow us to utilise computer power to now calculate where someone will be in the future – simply by taking the power of the matrix. To find the probabilities after 2 hours I can square my matrix:

Using the rules of matrix multiplication this then gives:

Which we can the calculate as:

I’ve used arrow notation here to represent the start and end state so p(m_1 arrow 1) means starting at 1 and ending at 1 after 2 hours. We can see that for someone who started in the beach, the chance of them being on the beach in 2 hours is 0.44. Equally the probability of someone who started in the house being on the beach in 2 hours is 0.28.

I can then carry on with matrix multiplication to work out where someone will likely be for any given number of hours in the future.

p(m_1 arrow 1) means starting at 1 and ending at 1 after n hours. So for example if I want to see where someone will be in 24 hours I simply do:

We can see that now it doesn’t actually matter (to 3sf anyway) where someone started – if they started on the beach there is a 0.333 chance they are on the beach in 24 hours, if they started in the house there is also a 0.333 chance they are on the beach in 24 hours. So I can conclude that as the number of hours increase towards infinity that the person in this scenario would spend 1/3 of their time on the beach and 2/3 of their time at home – not a bad life!

**A more demanding beach life**

We can see that things get much more complicated, even by adding an extra state. Now we have 3 possible states, Beach (state 1), Home (state 2) and SCUBA (state 3). This time we need a 3×3 matrix:

and as before we define our probability matrix as:

So from our diagram we have the following:

For example the 0.8 in row 2 column 2 shows that there is a 0.8 chance of starting in state 2 (Home) and ending in state 2 (Home) in one hour.

Then using our same notation we have:

Which shows that after 2 hours there is (for example) a 0.19 chance that someone who started in state 2 (Home) is now found in state 1 (Beach).

After 24 hours we have the following matrix:

So we notice the same situation as last time – as the number of hours increase it gets less important where we started from – we can see that to 3sf it doesn’t now matter where we started – the probability after 24 hours of being found on the beach is 0.407, the probability of being found at home is 0.333 and the probability of being found diving is 0.260.

Hopefully this is a quick example to demonstrate the power of Markov chains in working with probabilities. There is a lot more to explore (maybe in another post!)

If you are a teacher then please also visit my new site: intermathematics.com for over 2000+ pdf pages of resources for teaching IB maths!

**Anscombe’s Quartet – the importance of graphs!**

Anscombe’s Quartet was devised by the statistician Francis Anscombe to illustrate how important it was to not just rely on statistical measures when analyzing data. To do this he created 4 data sets which would produce nearly identical statistical measures. The scatter graphs above generated by the Python code here.

**Statistical measures**

1) Mean of x values in each data set = 9.00

2) Standard deviation of x values in each data set = 3.32

3) Mean of y values in each data set = 7.50

4) Standard deviation of x values in each data set = 2.03

5) Pearson’s Correlation coefficient for each paired data set = 0.82

6) Linear regression line for each paired data set: y = 0.500x + 3.00

When looking at this data we would be forgiven for concluding that these data sets must be very similar – but really they are quite different.

**Data Set A:**

x = [10,8,13,9,11,14,6,4,12,7,5]

y = [8.04, 6.95,7.58,8.81,8.33, 9.96,7.24,4.26,10.84,4.82,5.68]

Data Set A does indeed fit a linear regression – and so this would be appropriate to use the line of best fit for predictive purposes.

**Data Set B:**

x = [10,8,13,9,11,14,6,4,12,7,5]

y = [9.14,8.14,8.74,8.77,9.26,8.1,6.13,3.1,9.13,7.26,4.74]

You could fit a linear regression to Data Set B – but this is clearly not the most appropriate regression line for this data. Some quadratic or higher power polynomial would be better for predicting data here.

**Data Set C:**

x = [10,8,13,9,11,14,6,4,12,7,5]

y = [7.46,6.77,12.74,7.11,7.81,8.84,6.08,5.39,8.15,6.42,5.73]

In Data set C we can see the effect of a single outlier – we have 11 points in pretty much a perfect linear correlation, and then a single outlier. For predictive purposes we would be best investigating this outlier (checking that it does conform to the mathematical definition of an outlier), and then potentially doing our regression with this removed.

**Data Set D:**

x = [8,8,8,8,8,8,8,19,8,8,8]

y = [6.58,5.76,7.71,8.84,8.47,7.04,5.25,12.50,5.56,7.91,6.89]

In Data set D we can also see the effect of a single outlier – we have 11 points in a vertical line, and then a single outlier. Clearly here again drawing a line of best fit for this data is not appropriate – unless we remove this outlier first.

**The moral of the story**

So – the moral here is always use graphical analysis alongside statistical measures. A very common mistake for IB students is to rely on Pearson’s Product coefficient without really looking at the scatter graph to decide whether a linear fit is appropriate. If you do this then you could end up with a very low mark in the E category as you will not show good understanding of what you are doing. So always plot a graph first!

**Essential Resources for IB Teachers**

If you are a **teacher** then please also visit my new site. This has been designed specifically for teachers of mathematics at international schools. The content now includes over **2000 pages of pdf content** for the entire SL and HL Analysis syllabus and also the SL Applications syllabus. Some of the content includes:

**Original pdf worksheets**(with full worked solutions) designed to cover all the syllabus topics. These make great homework sheets or in class worksheets – and are each designed to last between 40 minutes and 1 hour.**Original Paper 3 investigations**(with full worked solutions) to develop investigative techniques and support both the exploration and the Paper 3 examination.- Over 150 pages of
**Coursework Guides**to introduce students to the essentials behind getting an excellent mark on their exploration coursework. - A large number of
**enrichment activities**such as treasure hunts, quizzes, investigations, Desmos explorations, Python coding and more – to engage IB learners in the course.

There is also a lot more. I think this could save teachers 200+ hours of preparation time in delivering an IB maths course – so it should be well worth exploring!

**Essential Resources for both IB teachers and IB students**

1) Exploration Guides and Paper 3 Resources

I’ve put together a **168 page** Super Exploration Guide to talk students and teachers through all aspects of producing an excellent coursework submission. Students always make the same mistakes when doing their coursework – get the inside track from an IB moderator! I have also made **Paper 3 packs** for HL Analysis and also Applications students to help prepare for their Paper 3 exams. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.

If you are a teacher then please also visit my new site: intermathematics.com for over 2000+ pdf pages of resources for teaching IB maths!

**3D Printing with Desmos: Stewie Griffin**

Using Desmos or Geogebra to design a picture or pattern is quite a nice exploration topic – but here’s an idea to make your investigation stand out from the crowd – how about converting your image to a 3D printed design?

**Step 1**

Create an image on Desmos or Geogebra. Remove the axes and grid pattern. This image is a pre-drawn image already on Desmos available here.

**Step 2**

Take a screen capture image of your picture (jpeg, gif, png). We need to convert this to a SVG file. You can convert these for free at sites like picsvg.

**Step 3**

Lastly we need to use a 3D editing site . You can join up with a site like Tinkercad for free.

**Step 4**

Making our 3D model. We import our SVG file and we get the image above. We can then resize this to whatever dimensions we wish – and also add 3D depth.

Lastly I would then save this file and send it to a 3D printer. You can see the finished file below:

So, if we printed this we’d get something like this:

**3D printing the Eiffel Tower**

Let’s use another Desmos art work. The Eiffel Tower above was a finalist in their annual art competition drawn by Jerry Yang from the USA.

This is then converted to the SVG file above.

And this is the result on Tinkercad when I add some depth and change the colour scheme. Let’s see what that would look like printed:

Pretty good- we’ve created a cheap tourist souvenir in about 5 minutes!

**Mathematical art**

I thought I’d have a go at making my own mathematical art. I started with using some polar coordinates to create this nice pattern:

Which then creates the following 3D shape:

This topic has a lot of scope for exploration and links with art, design technology and engineering. Thanks to our ever resourceful ICT wizz at school Jon for assistance, and also thanks for this excellent method which was posted by Ryan on Thingiverse. You can also explore huge numbers of ready made 3D templates on the site.

**Essential Resources for IB Teachers**

If you are a **teacher** then please also visit my new site. This has been designed specifically for teachers of mathematics at international schools. The content now includes over **2000 pages of pdf content** for the entire SL and HL Analysis syllabus and also the SL Applications syllabus. Some of the content includes:

**Original pdf worksheets**(with full worked solutions) designed to cover all the syllabus topics. These make great homework sheets or in class worksheets – and are each designed to last between 40 minutes and 1 hour.**Original Paper 3 investigations**(with full worked solutions) to develop investigative techniques and support both the exploration and the Paper 3 examination.- Over 150 pages of
**Coursework Guides**to introduce students to the essentials behind getting an excellent mark on their exploration coursework. - A large number of
**enrichment activities**such as treasure hunts, quizzes, investigations, Desmos explorations, Python coding and more – to engage IB learners in the course.

There is also a lot more. I think this could save teachers 200+ hours of preparation time in delivering an IB maths course – so it should be well worth exploring!

**Essential Resources for both IB teachers and IB students**

1) Exploration Guides and Paper 3 Resources

I’ve put together a **168 page** Super Exploration Guide to talk students and teachers through all aspects of producing an excellent coursework submission. Students always make the same mistakes when doing their coursework – get the inside track from an IB moderator! I have also made **Paper 3 packs** for HL Analysis and also Applications students to help prepare for their Paper 3 exams. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.

If you are a teacher then please also visit my new site: intermathematics.com for over 2000+ pdf pages of resources for teaching IB maths!

**Time dependent gravity and cosmology!**

In our universe we have a gravitational constant – i.e gravity is not dependent on time. If gravity changed with respect to time then the gravitational force exerted by the Sun on Earth would lessen (or increase) over time with all other factors remaining the same.

Interestingly time-dependent gravity was first explored by Dirac and some physicists have tried to incorporate time dependent gravity into cosmological models. As yet we have no proof that gravity is not constant, but let’s imagine a university where it is dependent on time.

**Inversely time dependent gravity**

The standard models for cosmology use G, where G is the gravitational constant. This fixes the gravitational force as a constant. However if gravity is inversely proportional to time we could have a relationship such as:

Where a is a constant. Let’s look at a very simple model, where we have a piecewise function as below:

This would create the graph at the top of the page. This is one (very simplistic) way of explaining the Big Bang. In the first few moments after t = 0, gravity would be negative and thus repulsive [and close to infinitely strong], which could explain the initial incredible universal expansion before “regular” attractive gravity kicked in (after t = 1). The Gravitational constant has only been measured to 4 significant figures:

G = 6.674 x 10^{-11}m^{3}kg^{-1}s^{-2}.

Therefore if there is a very small variation over time it is *possible* that we simply haven’t the accuracy to test this yet.

**Universal acceleration with a time dependent gravitational force**

Warning: This section is going to touch on some seriously complicated maths – not for the faint hearted! We’re going to explore whether having a gravitational force which decreases over time still allows us to have an accelerating expansion of the universe.

We can start with the following equation:

To work through an example:

This would show that when t = 1 the universe had an expansion scale factor of 2. Now, based on current data measured by astronomers we have evidence that the universe is both expanding and accelerating in its expansion. If the universal scale factor is accelerating in expansion that requires that we have:

**Modelling our universe**

We’re going to need 4 equations to model what happens when gravity is time dependent rather than just a constant.

**Equation 1**

This equation models a relationship between pressure and density in our model universe. We assume that our universe is homogenous (i.e the same) throughout.

**Equation 2**

This is one of the Friedmann equations for governing the expansion of space. We will take c =1 [i.e we will choose units such that we are in 1 light year etc]

**Equation 3**

This is another one of the Friedmann equations for governing the expansion of space. The original equation has P/(c squared) – but we we simplify again by taking c = 1.

**Equation 4**

This is our time dependent version of gravity.

**Finding alpha**

We can separate variables to solve equation (3).

**Substitution**

We can use this result, along with the equations (1) and (4) to substitute into equation (2).

**Our result**

Now, remember that if the second differential of r is positive then the universal expansion rate is accelerating. If Lamba is negative then we will have the second differential of r positive. However, all our constants G_0, a, B, t, r are greater than 0. Therefore in order for lamda to be negative we need:

What this shows is that even in a universe where gravity is time dependent (and decreasing), we would still be able to have an accelerating universe like we see today. the only factor that determines whether the universal expansion is accelerating is the value of gamma, not our gravity function.

This means that a time dependent gravity function can still gives us a result consistent with our experimental measurements of the universe.

**A specific case**

Solving the equation for the second differential of r is extremely difficult, so let’s look at a very simple case where we choose some constants to make life as easy as possible:

Substituting these into our equation (2) gives us:

We can then solve this to give:

So, finally we have arrived at our final equation. This would give us the universal expansion scale factor at time t, for a universe in which gravity follows the the equation G(t) = 1/t.

For this universe we can then see that when t = 5 for example, we would have a universal expansion scale factor of 28.5.

So, there we go – very complicated maths, way beyond IB level, so don’t worry if you didn’t follow that. And that’s just a simplified introduction to some of the maths in cosmology! You can read more about time dependent gravity here (also not for the faint hearted!)

**Essential Resources for IB Teachers**

If you are a **teacher** then please also visit my new site. This has been designed specifically for teachers of mathematics at international schools. The content now includes over **2000 pages of pdf content** for the entire SL and HL Analysis syllabus and also the SL Applications syllabus. Some of the content includes:

**Original pdf worksheets**(with full worked solutions) designed to cover all the syllabus topics. These make great homework sheets or in class worksheets – and are each designed to last between 40 minutes and 1 hour.**Original Paper 3 investigations**(with full worked solutions) to develop investigative techniques and support both the exploration and the Paper 3 examination.- Over 150 pages of
**Coursework Guides**to introduce students to the essentials behind getting an excellent mark on their exploration coursework. - A large number of
**enrichment activities**such as treasure hunts, quizzes, investigations, Desmos explorations, Python coding and more – to engage IB learners in the course.

There is also a lot more. I think this could save teachers 200+ hours of preparation time in delivering an IB maths course – so it should be well worth exploring!

**Essential Resources for both IB teachers and IB students**

1) Exploration Guides and Paper 3 Resources

I’ve put together a **168 page** Super Exploration Guide to talk students and teachers through all aspects of producing an excellent coursework submission. Students always make the same mistakes when doing their coursework – get the inside track from an IB moderator! I have also made **Paper 3 packs** for HL Analysis and also Applications students to help prepare for their Paper 3 exams. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.

**The Martingale system**

The Martingale system was first used in France in 1700s gambling halls and remains used today in some trading strategies. I’ll look at some of the mathematical ideas behind this and why it has remained popular over several centuries despite having a long term expected return of zero.

**The scenario**

You go to a fair ground and play a simple heads-or-tails game. The probability of heads is 1/2 and tails is also 1/2. You place a stake of counters on heads. If you guess correctly you win that number of counters. If you lose, you double your stake of counters and then the coin is tossed again. Every time you lose you double up your stake of counters and stop when you finally win.

**Infinitely deep pockets model:**

You can see that in the example above we always have a 0.5 chance of getting heads on the first go, which gives a profit of 1 counter. But we also have a 0.5 chance of a profit of 1 counter as long as we keep doubling up our stake, and as long as we do indeed eventually throw heads. In the example here you can see that the string of losing throws don’t matter [when we win is arbitrary, we could win on the 2nd, 3rd, 4th etc throw]. By doubling up, when you do finally win you wipe out your cumulative losses and end up with a 1 counter profit.

This leads to something of a paradoxical situation, despite only having a 1/2 chance of guessing heads we end up with an expected value of 1 counter profit for every 1 counter that we *initially* stake in this system.

So what’s happening? This will always work but it requires that you have access to infinitely deep pockets (to keep your infinite number of counters) and also the assumption that if you keep throwing long enough you will indeed finally get a head (i.e you don’t throw an infinite number of tails!)

**Finite pockets model:**

Real life intrudes on the infinite pockets model – because in reality there will be a limit to how many counters you have which means you will need to bail out after a given number of tosses. Even if the probability of this string of tails is very small, the losses if it does occur will be catastrophic – and so the expected value for this system is still 0.

**Finite pockets model capped at 4 tosses:**

In the example above we only have a 1/16 chance of losing – but when we do we lose 15 counters. This gives an expected value of:

**Finite pockets model capped at n tosses:**

If we start with a 1 counter stake then we can represent the pattern we can see above for E(X) as follows:

Here we use the fact that the losses from n throws are the sum of the first (n-1) powers of 2. We can then notice that both of these are geometric series, and use the relevant formula to give:

Therefore the expected value for the finite pockets model is indeed always still 0.

**So why does this system remain popular?**

So, given that the real world version of this has an expected value of 0, why has it retained popularity over the past few centuries? Well, the system will on average return constant linear growth – up until a catastrophic loss. Let’s say you have 100,000 counters and stake 1 counter initially. You can afford a total of 16 consecutive losses. The probability of this is only:

but when you do lose, you’ll lose a total of:

So, the system creates a model that mimics linear growth, but really the small risk of catastrophic loss means that the system still has E(X) = 0. In the short term you would expect to see the following very simple linear relationship for profit:

With 100,000 counters and a base trading stake of 1 counter, if you made 1000 initial 1 counter trades a day you would expect a return of 1000 counters a day (i.e 1% return on your total counters per day). However the longer you continue this strategy the more likely you are to see a run of 16 tails – and see all your counters wiped out.

**Computer model**

I wrote a short Python code to give an idea as to what is happening. Here I started 9 people off with 1000 counters each. They have a loss limit of 10 consecutive losses. They made starting stakes of 1 counter each time, and then I recorded how long before they made a loss of 10 tosses in a row.

For anyone interested in the code here it is:

The program returned the following results. The first number is the number of starting trades until they tossed 10 tails in a row. The second number was their new account value (given that they had started with 1000 counters, every previous trade had increased their account by 1 counter and that they had then just lost 1023 counters).

1338, 1315

1159, 1136

243, 220

1676, 1653

432, 409

1023, 1000

976, 953

990, 967

60, 37

This was then plotted on Desmos. The red line is the trajectory their accounts were following before their loss. The horizontal dotted line is at y = 1000 which represents the initial account value. As you can see 6 people are now on or below their initial starting account value. You can also see that all these new account values are themselves on a line parallel to the red line but translated vertically down.

From this very simple simulation, we can see that on average a person was left with 884 counters following hitting 10 tails. i.e below initial starting account. Running this again with 99 players gave an average of 869.

**999 players**

I ran this again with 999 players – counting what their account value would be after their first loss. All players started with 1000 counters. The results were:

31 players bankrupt: 3%

385 players left with less than half their account value (less than 500): 39%

600 players with less than their original account value (less than 1000): 60%

51 players at least tripled their account (more than 3000): 5%

The top player ended up with 6903 counters after their first loss.

The average account this time was above starting value (1044.68). You can see clearly that the median is below 1000 – but that a small number of very lucky players at the top end skewed the mean above 1000.

**Second iteration**

I then ran the simulation again – with players continuing with their current stake. This would have been slightly off because my model allowed players who were bankrupt from the first round to carry on [in effect being loaned 1 counter to start again]. Nevertheless it now gave:

264 players bankrupt: 26%

453 players left with less than half their account value (less than 500): 45%

573 players with less than their original account value (less than 1000): 57%

95 players at least tripled their account (more than 3000): 10%

The top player ended up with 9583 counters after their second loss.

We can see a dramatic rise in bankruptcies – now over a quarter of all players. This would suggest the long term trend is towards a majority of players being bankrupted, though the lucky few at the top end may be able to escape this fate.

**Essential Resources for IB Teachers**

**teacher** then please also visit my new site. This has been designed specifically for teachers of mathematics at international schools. The content now includes over **2000 pages of pdf content** for the entire SL and HL Analysis syllabus and also the SL Applications syllabus. Some of the content includes:

**Original pdf worksheets**(with full worked solutions) designed to cover all the syllabus topics. These make great homework sheets or in class worksheets – and are each designed to last between 40 minutes and 1 hour.**Original Paper 3 investigations**(with full worked solutions) to develop investigative techniques and support both the exploration and the Paper 3 examination.- Over 150 pages of
**Coursework Guides**to introduce students to the essentials behind getting an excellent mark on their exploration coursework. - A large number of
**enrichment activities**such as treasure hunts, quizzes, investigations, Desmos explorations, Python coding and more – to engage IB learners in the course.

**Essential Resources for both IB teachers and IB students**

1) Exploration Guides and Paper 3 Resources

**168 page** Super Exploration Guide to talk students and teachers through all aspects of producing an excellent coursework submission. Students always make the same mistakes when doing their coursework – get the inside track from an IB moderator! I have also made **Paper 3 packs** for HL Analysis and also Applications students to help prepare for their Paper 3 exams. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.

**Projectiles IV: Time dependent gravity!**

This carries on our exploration of projectile motion – this time we will explore what happens if gravity is not fixed, but is instead a function of time. (This idea was suggested by and worked through by fellow IB teachers Daniel Hwang and Ferenc Beleznay). In our universe we have a gravitational constant – i.e gravity is not dependent on time. If gravity changed with respect to time then the gravitational force exerted by the Sun on Earth would lessen (or increase) over time with all other factors remaining the same.

Interestingly time-dependent gravity was first explored by Dirac and some physicists have tried to incorporate time dependent gravity into cosmological models. As yet we have no proof that gravity is not constant, but let’s imagine a university where it is dependent on time.

**Projectile motion when gravity is time dependent**

We can start off with the standard parametric equations for projectile motion. Here v is the initial velocity, theta is the angle of launch, t can be a time parameter and g is the gravitational constant (9.81 on Earth). We can see that the value for the vertical acceleration is the negative of the gravitational constant. So the question to explore is, what if the gravitational constant was time dependent? Another way to think about this is that gravity varies with respect to time.

**Linear relationship**

If we have the simplest time dependent relationship we can say that:

where **a is a constant**. If a is greater than 0 then gravity linearly increases as time increases, if a is less than 0 than gravity linearly decreases as time increases. For matters of slight convenience I’ll define gravity (or the vertical acceleration) as -3at. The following can then be arrived at by integration:

This will produce the following graph when we fix v = 10, a = 2 and vary theta:

Now we can use the same method as in our Projectile Motion Investigation II to explore whether these maximum points lie in a curve. (You might wish to read that post first for a step by step approach to the method).

therefore we can substitute back into our original parametric equations for x and y to get:

We can plot this with theta as a parameter. If we fix v = 4 and a =2 we get the following graph:

Compare this to the graph from Projectile Motion Investigation II, where we did this with gravity constant (and with v fixed as 10):

The Projectile Motion Investigation II formed a perfect ellipse, but this time it’s more of a kind of egg shaped elliptical curve – with a flat base. But it’s interesting to see that even with time dependent gravity we still have a similar relationship to before!

**Inverse relationship**

Let’s also look at what would happen if gravity was inversely related to time. (This is what has been explored by some physicists).

In this case we get the following results when we launch projectiles (Notice here we had to use the integration by parts trick to integrate ln(t)). As the velocity function doesn’t exist when t = 0, we can define v and theta in this case as the velocity and theta value when t = 1.

Now we use the same trick as earlier to find when the gradient is 0:

Substituting this back into the parametric equations gives:

The ratio v/a will therefore have the greatest effect on the maximum points.

**v/a ratio negative and close to zero:**

v = 40, a = -2000, v/a = -0.02

This gives us close to a circle, radius v, centred at (0,a).

v = 1, a = -10, v/a = -0.1

Here we can also see that the boundary condition for the maximum horizontal distance thrown is given by x = v(e).

**v/a ratio negative and large:**

v = 40, a = -2, v/a = -20.

We can see that we get an egg shape back – but this time with a flatter bulge at the top and the point at the bottom. Also notice how quickly the scale of the shape has increased.

**v/a ratio n/a (i.e a = 0)**

Here there is no gravitational force, and so projectiles travel in linear motion – with no maximum.

**Envelope of projectiles for the inverse relationship**

This is just included for completeness, don’t worry if you don’t follow the maths behind this bit!

Therefore when we plot the parametric equations for x and y in terms of theta we get the envelope of projectile motion when we are in a universe where gravity varies inversely to time. The following graph is generated when we take v = 300 and a = -10. The red line is the envelope of projectiles.

**A generalized power relationship**

Lastly, let’s look at what happens when we have a general power relationship i.e gravity is related to (a)t^{n}. Again for matters of slight convenience I’ll look at the similar relationship -0.5(n+1)(n+2)at^{n}.

This gives (following the same method as above:

As we vary n we will find the plot of the maximum points. Let’s take the velocity as 4 and a as 2. Then we get the following:

When n = 0:

When n = 1:

When n =2:

When n = 10:

We can see the general elliptical shape remains at the top, but we have a flattening at the bottom of the curve.

**When n approaches infinity:**

We get this beautiful result when we let n tend towards infinity – now we will have all the maximum points bounded on a circle (with the radius the same as the value chosen as the initial velocity. In the graph above we have a radius of 4 as the initial velocity is 4. Notice too we have projectiles traveling in straight lines – and then seemingly “bouncing” off the boundary!

If we want to understand this, there is only going to be a very short window (t less than 1) when the particle can upwards – when t is between 0 and 1 the effect of gravity is effectively 0 and so the particle would travel in a straight line (i.e if the initial velocity is 5 m/s it will travel 5 meters. Then as soon as t = 1, the gravity becomes crushingly heavy and the particle falls effectively vertically down.

**Essential Resources for IB Teachers**

**teacher** then please also visit my new site. This has been designed specifically for teachers of mathematics at international schools. The content now includes over **2000 pages of pdf content** for the entire SL and HL Analysis syllabus and also the SL Applications syllabus. Some of the content includes:

**Original pdf worksheets**(with full worked solutions) designed to cover all the syllabus topics. These make great homework sheets or in class worksheets – and are each designed to last between 40 minutes and 1 hour.**Original Paper 3 investigations**(with full worked solutions) to develop investigative techniques and support both the exploration and the Paper 3 examination.- Over 150 pages of
**Coursework Guides**to introduce students to the essentials behind getting an excellent mark on their exploration coursework. - A large number of
**enrichment activities**such as treasure hunts, quizzes, investigations, Desmos explorations, Python coding and more – to engage IB learners in the course.

**Essential Resources for both IB teachers and IB students**

1) Exploration Guides and Paper 3 Resources

**168 page** Super Exploration Guide to talk students and teachers through all aspects of producing an excellent coursework submission. Students always make the same mistakes when doing their coursework – get the inside track from an IB moderator! I have also made **Paper 3 packs** for HL Analysis and also Applications students to help prepare for their Paper 3 exams. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.

**Using Maths to model the spread of Coronavirus (COVID-19)**

This coronavirus is the latest virus to warrant global fears over a disease pandemic. Throughout history we have seen pandemic diseases such as the Black Death in Middle Ages Europe and the Spanish Flu at the beginning of the 20th century. More recently we have seen HIV responsible for millions of deaths. In the last few years there have been scares over bird flu and SARS – yet neither fully developed into a major global health problem. So, how contagious is COVID-19, and how can we use mathematics to predict its spread?

Modelling disease outbreaks with real accuracy is an incredibly important job for mathematicians and all countries employ medical statisticians for this job . Understanding how diseases spread and how fast they can spread through populations is essential to developing effective medical strategies to minimise deaths. If you want to save lives maybe you should become a mathematician rather than a doctor!

Currently scientists know relatively little about the new virus – but they do know that it’s the same coronavirus family as SARS and MERS which can both cause serious respiratory problems. Scientists are particularly interested in trying to discover how infectious the virus is, how long a person remains contagious, and whether people can be contagious before they show any symptoms.

**In the case of COVID-19 we have the following early estimated values: **[From a paper published by medical statisticians in the UK on January 24]

**R _{0}. between 3.6 and 4.** This is defined as how many people an infectious person will pass on their infection to in a totally susceptible population. The higher the R

_{0}. value the more quickly an infection will spread. By comparison seasonal flu has a R

_{0}. value around 2.8.

**Total number infected** by January 21: prediction interval 9,217–14,245. Of these an estimated 3,050–4,017 currently with the virus and the others recovered (or died). This is based on an estimation that only around 5% of cases have been diagnosed. By February 4th they predict 132,751–273,649 will be infected.

**Transmission rate β** estimated at 1.07. β represents the transmission rate per day – so on average an infected person will infect another 1.07 people a day.

**Infectious period** estimated at 3.6 days. We can therefore calculate μ (the per capita recovery rate) by μ = 1/(3.6). This tells us how quickly people will be removed from the population (either recovered and become immune or died)

**SIR Model**

The basic model is based on the SIR model. The SIR model looks at how much of the population is susceptible to infection (S), how many of these go on to become infectious (I), and how many of these are removed (R) from the population being considered (i.e they either recover and thus won’t catch the virus again, or die).

The Guardian datablog have an excellent graphic to show the contagiousness relative to deadliness of different diseases [click to enlarge, or follow the link]. We can see that seasonal flu has an R_{0}. value of around 2.8 and a fatality rate of around 0.1%, whereas measles has an R_{0}. value of around 15 and a fatality rate of around 0.3%. This means that measles is much more contagious than seasonal flu.

You can notice that we have nothing in the top right hand corner (very deadly and very contagious). This is just as well as that could be enough to seriously dent the human population. Most diseases we worry about fall into 2 categories – contagious and not very deadly or not very contagious and deadly.

The equations above represent a SIR (susceptible, infectious, removed) model which can be used to model the spread of diseases like flu.

dS/dt represents the rate of change of those who are susceptible to the illness with respect to time. dI/dt represents the rate of change of those who are infected with respect to time. dR/dt represents the rate of change of those who have been removed with respect to time (either recovered or died).

For example, if dI/dt is high then the number of people becoming infected is rapidly increasing. When dI/dt is zero then there is no change in the numbers of people becoming infected (number of infections remain steady). When dI/dt is negative then the numbers of people becoming infected is decreasing.

**Modelling for COVID-19**

N is the total population. Let’s take as the population of Wuhan as 11 million.

μ is the per capita recovery (Calculated by μ = 1/(duration of illness) ). We have μ = 1/3.6 = 5/18.

β the transmission rate as approximately 1.07

Therefore our 3 equations for rates of change become:

dS/dt = -1.07 S I /11,000,000

dI/dt = 1.07 S I /11,000,000 – 5/18 I

dR/dt = 5/18 I

Unfortunately these equations are very difficult to solve – but luckily we can use a computer program or spreadsheet to plot what happens. We need to assign starting values for S, I and R – the numbers of people susceptible, infectious and removed. With the following values for January 21: S = 11,000,000, I = 3500, R = 8200, β = 1.07, μ = 5/18, I designed the following Excel spreadsheet (instructions on what formula to use here):

This gives a prediction that around 3.9 million people infected within 2 weeks! We can see that the SIR model that we have used is quite simplistic (and significantly different to the expert prediction of around 200,000 infected).

So, we can try and make things more realistic by adding some real life considerations. The current value of β (the transmission rate) is 1.07, i.e an infected person will infect another 1.07 people each day. We can significantly reduce this if we expect that infected people are quarantined effectively so that they do not interact with other members of the public, and indeed if people who are not sick avoid going outside. So, if we take β as (say) 0.6 instead we get the following table:

Here we can see that this change to β has had a dramatic effect to our model. Now we are predicting around 129,000 infected after 14 days – which is much more in line with the estimate in the paper above.

As we are seeing exponential growth in the spread, small changes to the parameters will have very large effects. There are more sophisticated SIR models which can then be used to better understand the spread of a disease. Nevertheless we can see clearly from the spreadsheet the interplay between susceptible, infected and recovered which is the foundation for understanding the spread of viruses like COVID-19.

[Edited in March to use the newly designated name COVID-19]

**Essential Resources for IB Teachers**

**teacher** then please also visit my new site. This has been designed specifically for teachers of mathematics at international schools. The content now includes over **2000 pages of pdf content** for the entire SL and HL Analysis syllabus and also the SL Applications syllabus. Some of the content includes:

**Original pdf worksheets**(with full worked solutions) designed to cover all the syllabus topics. These make great homework sheets or in class worksheets – and are each designed to last between 40 minutes and 1 hour.**Original Paper 3 investigations**(with full worked solutions) to develop investigative techniques and support both the exploration and the Paper 3 examination.- Over 150 pages of
**Coursework Guides**to introduce students to the essentials behind getting an excellent mark on their exploration coursework. - A large number of
**enrichment activities**such as treasure hunts, quizzes, investigations, Desmos explorations, Python coding and more – to engage IB learners in the course.

**Essential Resources for both IB teachers and IB students**

1) Exploration Guides and Paper 3 Resources

**168 page** Super Exploration Guide to talk students and teachers through all aspects of producing an excellent coursework submission. Students always make the same mistakes when doing their coursework – get the inside track from an IB moderator! I have also made **Paper 3 packs** for HL Analysis and also Applications students to help prepare for their Paper 3 exams. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.