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

**Volume optimization of a cuboid**

This is an extension of the Nrich task which is currently live – where students have to find the maximum volume of a cuboid formed by cutting squares of size x from each corner of a 20 x 20 piece of paper. I’m going to use an n x 10 rectangle and see what the optimum x value is when n tends to infinity.

First we can find the volume of the cuboid:

Next we want to find when the volume is a maximum, so differentiate and set this equal to 0.

Next we use the quadratic formula to find the roots of the quadratic, and then see what happens as n tends to infinity (i.e we want to see what the optimum x values are for our cuboid when n approaches infinity). We only take the negative solution of the + – quadratic solutions because this will be the only one that fits the initial problem.

Next we try and simplify the square root by taking out a factor of 16, and then we complete the square for the term inside the square root (this will be useful next!)

Next we make a u substitution. Note that this means that as n approaches infinity, u approaches 0.

Substituting this into the expression gives us:

We then manipulate the surd further to get it in the following form:

Now, the reason for all that manipulation becomes apparent – we can use the binomial expansion for the square root of 1 + u^{2} to get the following:

Therefore we have shown that as the value of n approaches infinity, the value of x that gives the optimum volume approaches 2.5cm.

So, even though we start with a pretty simple optimization task, it quickly develops into some quite complicated mathematics. We could obviously have plotted the term in n to see what its behavior was as n approaches infinity, but it’s nicer to prove it. So, let’s check our result graphically.

As we can see from the graph, with n plotted on the x axis and x plotted on the y axis we approach x = 2.5 as n approaches infinity – as required.

**An m by n rectangle.**

So, we can then extend this by considering an n by m rectangle, where m is fixed and then n tends to infinity. As before the question is what is the value of x which gives the maximum volume as n tends to infinity?

We do the same method. First we write the equation for the volume and put it into the quadratic formula.

Next we complete the square, and make the u substitution:

Next we simplify the surd, and then use the expansion for the square root of 1 + u^{2}

This then gives the following answer:

So, we can see that for an n by m rectangle, as m is fixed and n tends to infinity, the value of x which gives the optimum volume tends to m/4. For example when we had a 10 by n rectangle (i.e m = 10) we had x = 2.5. When we have a 20 by n rectangle we would have x = 5 etc.

And we’ve finished! See what other things you can explore with this problem.

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

**Modeling hours of daylight**

Desmos has a nice student activity (on teacher.desmos.com) modeling the number of hours of daylight in Florida versus Alaska – which both produce a nice sine curve when plotted on a graph. So let’s see if this relationship also holds between Phuket and Manchester.

First we can find the daylight hours from this site, making sure to convert the times given to decimals of hours.

**Phuket**

Phuket has the following distribution of hours of daylight (taking the reading from the first of each month and setting 1 as January)

**Manchester **

Manchester has much greater variation and is as follows:

Therefore when we plot them together (Phuket in green and Manchester in blue) we get the following 2 curves:

We can see that these very closely fit sine curves, indeed we can see that the following regression lines fit the curves very closely:

**Manchester:**

**Phuket:**

For Manchester I needed to set the value of b (see what happens if you don’t do this!) Because we are working with Sine graphs, the value of d will give the equation of the axis of symmetry of the graph, which will also be the average hours of daylight over the year. We can see therefore that even though there is a huge variation between the hours of daylight in the 2 places, they both get on average the same amount of daylight across the year (12.3 hours versus 12.1 hours).

**Further investigation:**

Does the relationship still hold when looking at hours of sunshine rather than daylight? How many years would we expect our model be accurate for? It’s possible to investigate the use of sine waves to model a large amount of natural phenomena such as tide heights and musical notes – so it’s also possible to investigate in this direction as well.

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

This is a nice example of using some maths to solve a puzzle from the mindyourdecisions youtube channel (screencaptures from the video).

**How to Avoid The Troll: A Puzzle**

In these situations it’s best to look at the extreme case first so you get some idea of the problem. If you are feeling particularly pessimistic you could assume that the troll is always going to be there. Therefore you would head to the top of the barrier each time. This situation is represented below:

**The Pessimistic Solution:**

Another basic strategy would be the optimistic strategy. Basically head in a straight line hoping that the troll is not there. If it’s not, then the journey is only 2km. If it is then you have to make a lengthy detour. This situation is shown below:

**The Optimistic Solution:**

The expected value was worked out here by doing 0.5 x (2) + 0.5 x (2 + root 2) = 2.71.

The question is now, is there a better strategy than either of these? An obvious possibility is heading for the point halfway along where the barrier might be. This would make a triangle of base 1 and height 1/2. This has a hypotenuse of root (5/4). In the best case scenario we would then have a total distance of 2 x root (5/4). In the worst case scenario we would have a total distance of root(5/4) + 1/2 + root 2. We find the expected value by multiply both by 0.5 and adding. This gives 2.63 (2 dp). But can we do any better? Yes – by using some algebra and then optimising to find a minimum.

**The Optimisation Solution:**

To minimise this function, we need to differentiate and find when the gradient is equal to zero, or draw a graph and look for the minimum. Now, hopefully you can remember how to differentiate polynomials, so here I’ve used Wolfram Alpha to solve it for us. Wolfram Alpha is incredibly powerful -and also very easy to use. Here is what I entered:

and here is the output:

So, when we head for a point exactly 1/(2 root 2) up the potential barrier, we minimise the distance travelled to around 2.62 miles.

So, there we go, we have saved 0.21 miles from our most pessimistic model, and 0.01 miles from our best guess model of heading for the midpoint. Not a huge difference – but nevertheless we’ll save ourselves a few seconds!

This is a good example of how an exploration could progress – once you get to the end you could then look at changing the question slightly, perhaps the troll is only 1/3 of the distance across? Maybe the troll appears only 1/3 of the time? Could you even generalise the results for when the troll is y distance away or appears z percent of the time?

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

**The Folium of Descartes**

The folium of Descartes is a famous curve named after the French philosopher and mathematician Rene Descartes (pictured top right). As well as significant contributions to philosophy (“I think therefore I am”) he was also the father of modern geometry through the development of the x,y coordinate system of plotting algebraic curves. As such the Cartesian plane (as we call the x,y coordinate system) is named after him.

**Pascal and Descartes**

Descartes was studying what is now known as the folium of Descartes (folium coming from the Latin for leaf) in the first half of the 1600s. Prior to the invention of calculus, the ability to calculate the gradient at a given point was a real challenge. He placed a wager with Pierre de Fermat, a contemporary French mathematician (of Fermat’s Last Theorem fame) that Fermat would be unable to find the gradient of the curve – a challenge that Fermat took up and succeeded with.

**Calculus – implicit differentiation:**

Today, armed with calculus and the method of implicit differentiation, finding the gradient at a point for the folium of Descartes is more straightforward. The original Cartesian equation is:

which can be differentiated implicitly to give:

Therefore if we take (say) a =1 and the coordinate (1.5, 1.5) then we will have a gradient of -1.

**Parametric equations**

It’s sometimes easier to express a curve in a different way to the usual Cartesian equation. Two alternatives are polar coordinates and parametric coordinates. The parametric equations for the folium are given by:

In order to use parametric equations we simply choose a value of t (say t =1) and put this into both equations in order to arrive at a coordinate pair in the x,y plane. If we choose t = 1 and have set a = 1 as well then this gives:

x(1) = 3/2

y(1) = 3/2

therefore the point (1.5, 1.5) is on the curve.

You can read a lot more about famous curves and explore the maths behind them with the excellent “50 famous curves” from Bloomsburg University.

**IB Revision**

**Spotting Asset Bubbles**

Asset bubbles are formed when a service, product or company becomes massively over-valued only to crash, taking with it most of its investors’ money. There are many examples of asset bubbles in history – the Dutch tulip bulb mania and the South Sea bubble are two of the most famous historical examples. In the tulip mania bubble of 1636-37, the price of tulip bulbs became astronomically high – as people speculated that the rising prices would keep rising yet further. At its peak a single tulip bulb was changing hands for around 10 times the annual wage of a skilled artisan, before crashing to become virtually worthless.

More recent bubble include the Dotcom crash of the early 2000s – where investors piled in trying to spot in what ways the internet would revolutionise businesses. Huge numbers of internet companies tried to ride this wave by going public with share offerings. This led to massive overvaluation and a crash when investors realised that many of these companies were worthless. Pets.com is often given as an example of this exuberance – its stock collapsed from $11 to $0.19 in just 6 months, taking with it $300 million of venture capital.

Therefore spotting the next bubble is something which economists take very seriously. You want to spot the next bubble, but equally not to miss out on the next big thing – a difficult balancing act! The graph at the top of the page is given as a classic bubble. It contains all the key phases – an initial slow take-off, a steady increase as institutional investors like banks and hedge funds get involved, an exponential growth phase as the public get involved, followed by a crash and a return to its long term mean value.

**Comparing the Bitcoin graph to an asset bubble**

The above graph is charting the last year of Bitcoin growth. We can see several similarities – so let’s try and plot this on the same axis as the model. The orange dots represent data points for the initial model – and then I’ve fitted the Bitcoin graph over the top:

It’s not a bad fit – if this was going to follow the asset bubble model then it would be about to crash rapidly before returning to the long term mean of around $4000. Whether that happens or it continues to rise, you can guarantee that there will be thousands of economists and stock market analysts around the world doing this sort of analysis (albeit somewhat more sophisticated!) to decide whether Bitcoin really will become the future of money – or yet another example of an asset bubble to be studied in economics textbooks of the future.

**IB Revision**

**Measuring the Distance to the Stars**

This is a very nice example of some very simple mathematics achieving something which for centuries appeared impossible – measuring the distance to the stars. Before we start we need a few definitions:

- 1 Astronomical Unit (AU) is the average distance from the Sun to the Earth. This is around 150,000,000km.
- 1 Light Year is the distance that light travels in one year. This is around 9,500,000,000,000km. We have around 63000AU = 1 Light Year.
- 1 arc second is measurement for very small angles and is 1/3600 of one degree.
- Parallax is the angular difference in measurement when viewing an object from different locations. In astronomy parallax is used to mean the half the angle formed when a star is viewed from opposite sides of the Earth’s solar orbit (marked on the diagram below).

With those definitions it is easy to then find the distance to stars. The parallax method requires that you take a measurement of the angle to a given star, and then wait until 6 months later and take the same measurement. The two angles will be slightly different – divide this difference by 2 and you have the parallax.

Let’s take 61 Cyngi – which Friedrick Bessel first used this method on in the early 1800s. This has a parallax of 287/1000 arc seconds. This is equivalent to 287/1000 x 1/3600 degree or approximately 0.000080 degrees. So now we can simply use trigonometry – we have a right angled triangle with opposite side = 1 AU and angle = 0.0000080. Therefore the distance is given by:

tanΦ = opp/adj

tan(0.000080) = 1/d

d = 1/tan(0.000080)

d = 720000 AU

which is approximately 720000/63000 = 11 light years away.

That’s pretty incredible! Using this method and armed with nothing more than a telescope and knowledge of the Earth’s orbital diameter, astronomers were able to judge the distance of stars in faraway parts of the universe – indeed they used this method to prove that other galaxies apart from our own also existed.

**Orion’s Belt**

The constellation of Orion is one of the most striking in the Northern Hemisphere. It contains the “belt” of 3 stars in a line, along with the brightly shining Rigel and the red super giant Betelgeuse. The following 2 graphics are taken from the great student resource from the Royal Observatory Greenwich:

The angles marked in the picture are in arc seconds – so to convert them into degrees we need to multiply by 1/3600. For example, Betelgeuse the red giant has a parallax of 0.0051 x 1/3600 = 0.0000014 (2sf) degrees. Therefore the distance to Betelgeuse is:

tanΦ = opp/adj

tan(0.0000014) = 1/d

d = 1/tan(0.0000014)

d = 41,000,000 AU

which is approximately 41,000,000/63000 = 651 light years away. If we were more accurate with our rounding we would get 643 light years. That means that when we look into the sky we are seeing Betelgeuse as it was 643 years ago.

**IB Revision**

**The Rise of Bitcoin**

Bitcoin is in the news again as it hits $10,000 a coin – the online crypto-currency has seen huge growth over the past 1 1/2 years, and there are now reports that hedge funds are now investing part of their portfolios in the currency. So let’s have a look at some regression techniques to predict the future price of the currency.

Here the graph has been inserted into Desmos and the scales aligned. 1 on the y axis corresponds to $1000 and 1 on the x axis corresponds to 6 months. 2013 is aligned with (0,0).

Next, I plot some points to fit the curve through.

Next, we use Desmos’ regression for y = ae^{bx}+d. This gives the line above with equation:

y = 5.10 x 10^{-7 }e^{1.67x }+ 0.432.

I included the vertical translation (d) because without it the graph didn’t fit the early data points well.

So, If I want to predict what the price will be in December 2019, I use x = 12

y = 5.10 x 10^{-7 }e^{1.67(12) }+ 0.432 = 258

and as my scale has 1 unit on the y axis equal to $1000, this is equal to $258,000.

So what does this show? Well it shows that Bitcoin is currently in a very steep exponential growth curve – which if sustained even over the next 12 months would result in astronomical returns. However we also know that exponential growth models are very poor at predicting long term trends – as they become unfeasibly large very quickly. The two most likely scenarios are:

- continued growth following a polynomial rather than exponential model
- a price crash

Predicting which of these 2 outcomes are most likely is probably best left to the experts! If you do choose to buy bitcoins you should be prepared for significant price fluctuations – which could be down as well as up. I’ll revisit this post in a few months and see what has happened.

If you are interested in some more of the maths behind Bitcoin, you can read about the method that is used to encrypt these currencies (a method called elliptical curve cryptography).

**IB Revision**

This is a quick example of how using Tracker software can generate a nice physics-related exploration. I took a spring, and attached it to a stand with a weight hanging from the end. I then took a video of the movement of the spring, and then uploaded this to Tracker.

**Height against time**

The first graph I generated was for the height of the spring against time. I started the graph when the spring was released from the low point. To be more accurate here you can calibrate the y axis scale with the actual distance. I left it with the default settings.

You can see we have a very good fit for a sine/cosine curve. This gives the approximate equation:

y = -65cos10.5(t-3.4) – 195

(remembering that the y axis scale is x 100).

This oscillating behavior is what we would expect from a spring system – in this case we have a period of around 0.6 seconds.

**Momentum against velocity**

For this graph I first set the mass as 0.3kg – which was the weight used – and plotted the y direction momentum against the y direction velocity. It then produces the above linear relationship, which has a gradient of around 0.3. Therefore we have the equation:

p = 0.3v

If we look at the theoretical equation linking momentum:

p = mv

(Where m = mass). We can see that we have almost perfectly replicated this theoretical equation.

**Height against velocity**

I generated this graph with the mass set to the default 1kg. It plots the y direction against the y component velocity. You can see from the this graph that the velocity is 0 when the spring is at the top and bottom of its cycle. We can then also see that it reaches its maximum velocity when halfway through its cycle. If we were to model this we could use an ellipse (remembering that both scales are x100 and using x for vy):

If we then wanted to develop this as an investigation, we could look at how changing the weight or the spring extension affected the results and look for some general conclusions for this. So there we go – a nice example of how tracker can quickly generate some nice personalised investigations!

**Predicting the UK election using linear regression**

The above data is the latest opinion poll data from the Guardian. The UK will have (another) general election on June 8th. So can we use the current opinion poll data to predict the outcome?

**Longer term data trends**

Let’s start by looking at the longer term trend following the aftermath of the Brexit vote on June 23rd 2016. I’ll plot some points for Labour and the Conservatives and see what kind of linear regression we get. To keep things simple I’ve looked at randomly chosen poll data approximately every 2 weeks – assigning 0 to July 1st 2016, 1 to mid July, 2 to August 1st etc. This has then been plotted using the fantastic Desmos.

**Labour**

You can see that this is not a very good fit – it’s a very weak correlation. Nevertheless let’s see what we would get if we used this regression line to predict the outcome in June. With the x axis scale I’ve chosen, mid June 2017 equates to 23 on the x axis. Therefore we predict the percentage as

y = -0.130(23) + 30.2

y = 27%

Clearly this would be a disaster for Labour – but our model is not especially accurate so perhaps nothing to worry about just yet.

**Conservatives**

As with Labour we have a weak correlation – though this time we have a positive rather than negative correlation. If we use our regression model we get a prediction of:

y = 0.242(23) + 38.7

y = 44%

So, we are predicting a crushing victory for the Conservatives – but could we get some more accurate models to base this prediction on?

**Using moving averages**

The Guardian’s poll tracker at the top of the page uses moving averages to smooth out poll fluctuations between different polls and to arrive at an averaged poll figure. Using this provides a stronger correlation:

**Labour**

This model doesn’t take into account a (possible) late surge in support for Labour but does fir better than our last graph. Using the equation we get:

y = -0.0764(23) + 28.8

y = 27%

**Conservatives**

We can have more confidence in using this regression line to predict the election. Putting in the numbers we get:

y = 0.411(23) + 36.48

y = 46%

**Conclusion**

Our more accurate models merely confirm what we found earlier – and indeed what all the pollsters are predicting – a massive win for the Conservatives. Even allowing for a late narrowing of the polls the Conservatives could be on target for winning by over 10% points – which would result in a very large majority. Let’s see what happens!

**IB Revision**

**Modelling a Nuclear War **

With the current saber rattling from Donald Trump in the Korean peninsula and the instability of North Korea under Kim Jong Un (incidentally a former IB student!) the threat of nuclear war is once again in the headlines. Post Cold War we’ve got somewhat used to the peace afforded by the idea of mutually assured destruction – but this peace only holds with rational actors in charge of pushing the buttons. The closest we have got to a nuclear war between 2 nuclear powers was in the 1962 Cuban missile crisis – and given the enormous nuclear arsenals of the US and the then USSR this could have pretty much ended civilization as we know it. In that period, modelling of the effects of nuclear war was a real priority. So let’s have a look at some current modelling predictions for the effects of a nuclear war. Those of a nervous disposition may wish to look away!

**Nuclear blast radius**

The picture at the top of the post is the nuclear blast radius calculated from this site. It shows the effects of a 100 megaton airburst (equivalent to 100 million tonnes of TNT explosive). This is the biggest nuclear bomb that the USSR ever tested. If dropped on London it would have a fireball radius of 6km, an air blast radius of 33 km (destroying most buildings) and a thermal radiation radius of 74km. The site estimates that this single bomb would cause 6 million deaths and another 6 million injuries. And remember this is a single bomb – there are collectively around 15,000 nuclear weapons in the world (the majority shared between the US and Russia).

**Nuclear Winter**

Whilst the effects of a single bomb would be absolutely catastrophic for both a country and also for the global economy, it would not be an extinction event for humanity – however scientists have modelled the consequences of a *nuclear war *which would effect the climate to such an extent that it could lead to global mass extinctions.

Let’s have a look at one of those papers – the pessimistically titled:

Nuclear winter revisited with a modern climate model and current nuclear arsenals: Still catastrophic consequences.

In this paper the authors look at 2 scenarios – the long term climate effect of (a) the detonation of 1/3 of the world’s arsenal of nuclear weapons and (b) the detonation of the full arsenal of the world’s nuclear weapons. Let’s leave to the side that this would almost certainly end civilisation as we know it – but what would be in store for those lucky (?) enough to survive such an event?

**Changes to global temperature and rainfall**

This above graphic is a double line graph – with the red lines relating to changes in temperature and the black line corresponding to the changes in precipitation. The middle 2 lines relate to case (a) and the bottom 2 lines relate to case (b). The y axis relates to years. You can see from this graph that a large nuclear war where 1/3 of the nuclear arsenal was released would have a significant effect on both global temperatures and rainfall. 5 years after the detonations you would have a global temperature 3-4 degrees lower than normal, and even a decade later it would still be a degree lower than normal. For the full nuclear arsenal case the effects would be catastrophic – a average global drop in temperature of close to 9 degrees 2-3 years after the event. To put this in context – the last ice age had global temperatures around 5 degrees lower than present. Meanwhile the average rainfall would drop by around 1.6mm/day equivalent to a 45% global drop in rainfall.

**Localised effects of changes in precipitation **

This above graphic shows the distribution of the effects of precipitation following the detonation of the full nuclear arsenal one year on. You can see that not all parts of the globe are equally effected. The countries near the equator see a massive drop in rainfall (more than 3.5mm/day) along with large parts of North America and Western Europe

**Localised effects in the change in temperatures:**

This above graphic shows the distribution of the effects of temperature following the detonation of the full nuclear arsenal one year on. As with the rainfall, you can see startling changes – parts of North America would be 20-30 degrees colder than average, parts of Russia 30-35 degrees colder. You can see the misleading nature of global temperature averages here. The global average temperature drop after 1 year was “only” 5 degree – but the parts where the majority of people live see temperature drops many times this. The global average is brought up by the relatively small change in global ocean temperatures.

**Results of a nuclear winter**

These changes to the climate alone would be sufficient to destroy agricultural production for the global food chain for a number of years. One gloomy assessment in 1986 referenced in the paper is that the majority of people who had somehow survived the nuclear bombs and radiation would in any case die in the following years of starvation as crops failed across the globe. So in short given have the ability to cause our own extinction event, let’s hope those with their fingers on the nuclear buttons are rational enough never to press them.