You are currently browsing the category archive for the ‘Real life maths’ category.

**Modelling more Chaos**

This post was inspired by Rachel Thomas’ Nrich article on the same topic. I’ll carry on the investigation suggested in the article. We’re going to explore chaotic behavior – where small changes to initial conditions lead to widely different outcomes. Chaotic behavior is what makes modelling (say) weather patterns so complex.

**f(x) = sin(x)**

This time let’s do the same with f(x) = sin(x).

**Starting value of x = 0.2**

**Starting value of x = 0.2001**

**Both graphs superimposed **

This time the graphs do not show any chaotic behavior over the first 40 iterations – a small difference in initial condition has made a negligible difference to the output. Even after 200 iterations we get the 2 values x = 0.104488151 and x = 0.104502319.

**f(x) = tan(x)**

Now this time with f(x) = tan(x).

**Starting value of x = 0.2**

**Starting value of x = 0.2001**

**Both graphs superimposed **

This time both graphs remained largely the same up until around the 38th data point – with large divergence after that. Let’s see what would happen over the next 50 iterations:

Therefore we can see that tan(x) is much more susceptible to small initial state changes than sin(x). This makes sense by considering the graphs of tan(x) and sin(x). Sin(x) remains bounded between -1 and 1, whereas tan(x) is unbounded with asymptotic behaviour as we approach pi/2.

**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.

**Modelling Chaos**

This post was inspired by Rachel Thomas’ Nrich article on the same topic. I’ll carry on the investigation suggested in the article. We’re going to explore chaotic behavior – where small changes to initial conditions lead to widely different outcomes. Chaotic behavior is what makes modelling (say) weather patterns so complex.

Let’s start as in the article with the function:

**f(x) = 4x(1-x)**

We can then start an iterative process where we choose an initial value, calculate f(x) and then use this answer to calculate a new f(x) etc. For example when I choose x = 0.2, f(0.2) = 0.64. I then use this value to find a new value f(0.64) = 0.9216. I used a spreadsheet to plot 40 iterations for the starting values of x = 0.2 and x = 0.2001. This generated the following spreadsheet (cut to show the first 10 terms):

I then imported this table into Desmos to map how the change in the starting value from 0.2 to 0.2001 affected the resultant graph.

**Starting value of x = 0.2**

**Starting value of x = 0.2001**

**Both graphs superimposed **

We can see that for the first 10 terms the graphs are virtually the same – but then we get a wild divergence, before the graphs seem to synchronize more closely again. One thing we notice is that the data is bounded between 0 and 1. Can we prove why this is?

If we start with a value of x such that:

0<x<1.

then when we plot f(x) = 4x – 4x^{2} we can see that the graph has a maximum at x = 1/2:

.

Therefore any starting value of x between 0 and 1 will also return a new value bounded between 0 and 1. Starting values of x > 1 and x < -1 will tend to negative infinity because x^{2} grows much more rapidly than x.

**f(x) = ax(1-x)**

Let’s now explore what happens as we change the value of a whilst keeping our initial starting values of x = 0.2 and x = 0.2001

a = 0.8

both graphs are superimposed but are identical at the scale we are using. We can see that both values are attracted to 0 (we can say that 0 is an **attractor** for our system).

a = 1.2

Again both graphs are superimposed but are identical at the scale we are using. We can see that both values are attracted to 1/6 (we can say that 1/6 is an **attractor** for our system).

In general, for f(x) = ax(1-x) with -1≤x≤1, the attractors are given by x = 0 and x = 1 – 1/a, but it depends on the starting conditions as to whether we will end up being attracted to this point.

**f(x) = 0.8x(1-x)**

So, let’s look at f(x) = 0.8x(1-x) for different starting values 1≤x≤1. Our attractors are given by x = 0 and x = 1 – 1/0.8 = -0.25.

When our initial value is x = 0 we remain at the point x = 0.

When our initial value is x = -0.25 we remain at the point x = -0.25.

When our initial value is x < -0.25 we tend to negative infinity.

When our initial value is -0.25 < x ≤ 1 we tend towards x = 0.

**Starting value of x = -0.249999:**

Therefore we can say that x = 0 is a **stable attractor**, initial values close to x = 0 will still tend to 0.

However x = -0.25 is a **fixed point** rather than a stable attractor**, **as

x = -0.250001 will tend to infinity very rapidly,

x = -0.25 stays at x = -0.25.

x = -0.249999 will tend towards 0.

Therefore there is a stable equilibria at x = 0 and an unstable equilibria at x = -0.25.

**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**

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.

**Project Euler: Coding to Solve Maths Problems**

Project Euler, named after one of the greatest mathematicians of all time, has been designed to bring together the twin disciplines of mathematics and coding. Computers are now become ever more integral in the field of mathematics – and now creative coding can be a method of solving mathematics problems just as much as creative mathematics has always been.

The first problem on the Project Euler Page is as follows:

*If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.*

*Find the sum of all the multiples of 3 or 5 below 1000.*

This is a reasonably straight forward maths problem which we can solve using the summation of arithmetic sequences (I’ll solve it below!) but more interestingly is how a computer code can be written to solve this same problem. Given that I am something of a coding novice, I went to the Project Nayuki website which has an archive of solutions. Here is a slightly modified version of the solution given on Project Nayki, designed to run in JAVA:

The original file can be copied from here, I then pasted this into an online JAVA site jdoodle. The only modification necessary was to replace:

*public final class p001 implements EulerSolution* with *public class p001*

Then after hitting execute you get the following result:

i.e the solution is returned as 233,168. Amazing!

But before we get carried away, let’s check the answer using some more old fashioned maths. We can break down the question into simply trying to find the sum of multiples of 3 under 1000, the sum of the multiples of 5 under 1000 and then subtracting the multiples of 15 under 1000 (as these will have been double counted). i.e:

(3 + 6 + 9 + … 999) + (5 + 10 + 15 + … 995) – (15 + 30 + 45 + …990)

This gives:

S_333 = 333/2 (2(3)+ 332(3)) = 166,833

+

S_199 = 199/2 (2(5) + 198(5)) = 99, 500

–

S_66 = 66/2 (2(15) +65(15) = 33, 165.

166,833 + 99, 500 – 33, 165 = 233, 168 as required.

Now that we have seen that this works we can modify the original code. For example if we replace:

if (i % 3 == 0 || i % 3 == 0)

with

if (i % 5 == 0 || i % 7 == 0)

This will find the sum of all the multiples of 5 or 7 below 1000. Which returns the answer 156,361.

Replacing the same line with:

if (i % 5 == 0 || i % 7 == 0 || i % 3 == 0)

will find the sum of all the multiples of 3 or 5 or 7 below 1000, which returns the answer 271,066. To find this using the previous method we would have to do:

Sum of 3s + Sum of 5s – Sum of 15s + Sum of 7s – Sum of 21s – Sum 35s – Sum of 105s. Which starts to show why using a computer makes life easier.

This would be a nice addition to any investigation on Number Theory – or indeed a good project for anyone interested in Computer Science as a possible future career.

**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**

**The Remarkable Dirac Delta Function**

This is a brief introduction to the Dirac Delta function – named after the legendary Nobel prize winning physicist Paul Dirac. Dirac was one of the founding fathers of the mathematics of quantum mechanics, and is widely regarded as one of the most influential physicists of the 20th Century. This topic is only recommended for students confident with the idea of limits and was inspired by a Quora post by Arsh Khan.

Dirac defined the delta function as having the following 2 properties:

The first property as defined above is that the delta function is 0 for all values of t, except for t = 0, when it is infinite.

The second property defined above is that the integral of the delta function – and the area of the graph between 2 points (either side of 0) is 1. We can take the bottom integral where we integrate from negative to positive infinity as this will be more useful later.

The delta function (technically not a function in a normal sense!) can be represented as the following limit:

Whilst this looks a little intimidating, it just means that we take the limit of the function as epsilon (ε) approaches 0. Given this definition of the delta function we can check that the 2 properties outlined above hold.

For the first limit above we set t not equal to 0. Then, because it is a continuous function when t is not equal to 0, we can effectively replace epsilon with 0 in the first limit above to get a limit of 0. In the second limit when t = 0 we get a limit of infinity. Therefore the first property holds.

To show that the second property holds, we start with the following integral identity from HL Calculus:

Hopefully this will look similar to the function we are interested in. Let’s play a little fast and loose with the mathematics and ignore the limit of the function and just consider the following integral:

Therefore (using the fact that the graph of arctanx has horizontal asymptotes at positive and negative pi/2 for the final part) :

So we have shown above that the integral of every function of this form will have an integral of 1, regardless of the value of epsilon, thus satisfying our second property.

**The use of the Dirac Function**

So far so good. But what is so remarkable about the Dirac function? Well, it allows objects to be described in terms of a single zero width (and infinitely high) spike, but despite having zero width, this spike still has an area of 1. This then allows the representation of elementary particles which have zero size but finite mass (and other finite properties such as charge) to be represented mathematically. With the area under the curve = 1 it can also be thought of in terms of a probability density function – i.e representing the quantum world in terms of probability wave functions.

**A graphical representation:**

This is easier to understand graphically. Say for example we choose a value epsilon (ε) and gradually make it smaller (i.e we find the limit as ε approaches 0). When ε = 5 we have the following:

When ε = 1 we have the following:

When ε = 0.1 we have the following:

When ε = 0.01 we have the following:

You can see that as ε approaches 0 we get a function which is close to 0 everywhere except for a spike at zero. The total area under the function remains at 1 for all ε.

Therefore we can represent the Dirac Delta function with the above graph. In it we have a point with zero width but with infinite height – and still with an area under the curve of 1!

**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!

**Cracking ISBN and Credit Card Codes**

ISBN codes are used on all books published worldwide. It’s a very powerful and useful code, because it has been designed so that if you enter the wrong ISBN code the computer will immediately know – so that you don’t end up with the wrong book. There is lots of information stored in this number. The first numbers tell you which country published it, the next the identity of the publisher, then the book reference.

**Here is how it works:**

Look at the 10 digit ISBN number. The first digit is 1 so do 1×1. The second digit is 9 so do 2×9. The third digit is 3 so do 3×3. We do this all the way until 10×3. We then add all the totals together. If we have a proper ISBN number then we can divide this final number by 11. If we have made a mistake we can’t. This is a very important branch of coding called error detection and error correction. We can use it to still interpret codes even if there have been errors made.

If we do this for the barcode above we should get 286. 286/11 = 26 so we have a genuine barcode.

**Check whether the following are ISBNs**

1) 0-13165332-6

2) 0-1392-4191-4

3) 07-028761-4

**Challenge (harder!) :**The following ISBN code has a number missing, what is it?

1) 0-13-1?9139-9

Answers in white text at the bottom, highlight to reveal!

Credit cards use a different algorithm – but one based on the same principle – that if someone enters a digit incorrectly the computer can immediately know that this credit card does not exist. This is obviously very important to prevent bank errors. The method is a little more complicated than for the ISBN code and is given below from computing site Hacktrix:

You can download a worksheet for this method here. Try and use this algorithm to validate which of the following 3 numbers are genuine credit cards:

1) 5184 8204 5526 6425

2) 5184 8204 5526 6427

3) 5184 8204 5526 6424

Answers in white text at the bottom, highlight to reveal!

ISBN:

1) Yes

2) Yes

3) No

1) 3 – using x as the missing number we end up with 5x + 7 = 0 mod 11. So 5x = 4 mod 11. When x = 3 this is solved.

Credit Card: The second one is genuine

If you liked this post you may also like:

NASA, Aliens and Binary Codes from the Stars – a discussion about how pictures can be transmitted across millions of miles using binary strings.

Cracking Codes Lesson – an example of 2 double period lessons on code breaking.

**IB Revision**

**NASA, Aliens and Binary Codes from the Star**

The Drake Equation was intended by astronomer Frank Drake to spark a dialogue about the odds of intelligent life on other planets. He was one of the founding members of SETI – the Search for Extra Terrestrial Intelligence – which has spent the past 50 years scanning the stars looking for signals that could be messages from other civilisations.

In the following video, Carl Sagan explains about the Drake Equation:

where:

*N = the number of civilizations in our galaxy with which communication might be possible (i.e. which are on our current past light cone);
R* = the average number of star formation per year in our galaxy
fp = the fraction of those stars that have planets
ne = the average number of planets that can potentially support life per star that has planets
fl = the fraction of planets that could support life that actually develop life at some point
fi = the fraction of planets with life that actually go on to develop intelligent life (civilizations)
fc = the fraction of civilizations that develop a technology that releases detectable signs of their existence into space
L = the length of time for which such civilizations release detectable signals into space*

The desire to encode and decode messages is a very important branch of mathematics – with direct application to all digital communications – from mobile phones to TVs and the internet.

All data content can be encoded using binary strings. A very simple code could be to have 1 signify “black” and 0 to signify “white” – and then this could then be used to send a picture. Data strings can be sent which are the product of 2 primes – so that the recipient can know the dimensions of the rectangle in which to fill in the colours.

If this sounds complicated, an example from the excellent Maths Illuminated handout on codes:

If this mystery message was received from space, how could we interpret it? Well, we would start by noticing that it is 77 digits long – which is the product of 2 prime numbers, 7 and 11. Prime numbers are universal and so we would expect any advanced civilisation to know about their properties. This gives us either a 7×11 or 11×7 rectangular grid to fill in. By trying both possibilities we see that an 11×7 grid gives the message below.

More examples can be downloaded from the Maths Illuminated section on Primes (go to the facilitator pdf).

A puzzle to try:

“If the following message was received from outer space, what would we conjecture that the aliens sending it looked like?”

0011000 0011000 1111111 1011001 0011001 0111100 0100100 0100100 0100100 1100110

Hint: also 77 digits long.

This is an excellent example of the universality of mathematics in communicating across all languages and indeed species. Prime strings and binary represent an excellent means of communicating data that all advanced civilisations would easily understand.

Answer in white text below (highlight to read)

Arrange the code into a rectangular array – ie a 11 rows by 7 columns rectangle. The first 7 numbers represent the 7 boxes in the first row etc. A 0 represents white and 1 represents black. Filling in the boxes and we end up with an alien with 2 arms and 2 legs – though with one arm longer than the other!

If you enjoyed this post you may also like:

Cracking Codes Lesson – a double period lesson on using and breaking codes

Cracking ISBN and Credit Card Codes– the mathematics behind ISBN codes and credit card codes.

**IB Revision**