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


The Van Eck Sequence

This is a nice sequence as discussed in the Numberphile video above.  There are only 2 rules:

  1. If you have not seen the number in the sequence before, add a 0 to the sequence.
  2. If you have seen the number in the sequence before, count how long since you last saw it.

You start with a 0.


You have never seen a 0 before, so the next number is 0.


You have seen a 0 before, and it was 1 step ago, so the next number is 1.


You have never seen a 1 before, so the next number is 0.


You have seen a 0 before, it was 2 steps ago, so the next number is 2.



I can run a quick Python program (adapted from the entry in the Online Encyclopedia of Integer Sequences here) to find the first 100 terms.

A181391 = [0, 0]
for n in range(1, 10**2):
 for m in range(n-1, -1, -1):
  if A181391[m] == A181391[n]:

This returns:

[0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3, 0, 3, 2, 9, 0, 4, 9, 3, 6, 14, 0, 6, 3, 5, 15, 0, 5, 3, 5, 2, 17, 0, 6, 11, 0, 3, 8, 0, 3, 3, 1, 42, 0, 5, 15, 20, 0, 4, 32, 0, 3, 11, 18, 0, 4, 7, 0, 3, 7, 3, 2, 31, 0, 6, 31, 3, 6, 3, 2, 8, 33, 0, 9, 56, 0, 3, 8, 7, 19, 0, 5, 37, 0, 3, 8, 8, 1, 46, 0, 6, 23]

I then assigned each term an x coordinate value, i.e.:

0 , 0
1 , 0
2 , 1
3 , 0
4 , 2
5 , 0
6 , 2
7 , 2
8 , 1
9 , 6
10 , 0
11 , 5
12 , 0
13 , 2
14 , 6
15 , 5
16 , 4
17 , 0
18 , 5
19 , 3
20 , 0


This means that you can then plot the sequence as a line graph, with the y values corresponding to the sequence terms.  As you can see, every time we hit a new peak the following value is 0, leading to the peaks and troughs seen below:

Let’s extend the sequence to the first 1000 terms:


We can see that the line y = x provides a reasonably good upper bound for this data:



But it is not known if every number would actually appear in the sequence somewhere – so this bound may not hold for larger values.

Length of steps before new numbers appear.

We can also investigate how long we have to wait to see each number for the first time by running the following Python code:

A181391 = [0, 0]
for n in range(1, 10**3):
 for m in range(n-1, -1, -1):
  if A181391[m] == A181391[n]:

  for m in range(1,50):
   if A181391[n]==m:
    print(m, ",", n+1)

This returns the following data:

1 , 3
2 , 5
6 , 10
5 , 12
4 , 17
3 , 20
9 , 24
14 , 30
15 , 35
17 , 41
11 , 44
8 , 47
42 , 52
20 , 56
32 , 59
18 , 63
7 , 66
31 , 72
33 , 81
19 , 89


The first coordinate tells us the number we are interested in, and the second number tells us how long we have to wait in the sequence until it appears.  So (1 , 3) means that we have to wait until 3 terms in the sequence to see the number 1 for the first time.

Plotting this for numbers 1-50 on a graph returns the following:

So, we can see (for example that we wait 66 terms to first see a 7, and 173 terms to first see a 12.  There seems to be a general trend that as the numbers get larger we have to wait longer to see them.  Testing this with a linear regression we can see a weak to moderate correlation:


Checking for the numbers up to 300 we get the following:

For example this shows that we have to wait 9700 terms until we see the number 254 for the first time.  Testing this with a linear correlation we have a weaker positive correlation than previously.

So, a nice and quick investigation using a combination of sequences, coding, graphing and regression, with lots of areas this could be developed further.


Screen Shot 2019-05-27 at 9.06.57 AM

Computers can brute force a lot of simple mathematical problems, so I thought I’d try and write some code to solve some of them.  In nearly all these cases there’s probably a more elegant way of coding the problem – but these all do the job!  You can run all of these with a Python editor such as  Just copy and paste the below code and see what happens.

1) Happy Numbers.

Happy numbers are defined by the rule that you start with any positive integer, square each of the digits then add them together. Now do the same with the new number. Happy numbers will eventually spiral down to a number of 1. Numbers that don’t eventually reach 1 are called unhappy numbers.

As an example, say we start with the number 23. Next we do 2²+3² = 13. Now, 1²+3² = 10. Now 1²+0² = 1. 23 is therefore a happy number.

k= int(input("type a 2 digit number "))
a = int(k%10)
c = int(k//100)
b = int(k//10 -10*c)
print (a**2+b**2+c**2)

for k in range (1,20):

  k = a**2+b**2 + c**2
  a = int(k%10)
  c = int(k//100)
  b = int(k//10 -10*c)
  print (a**2+b**2+c**2)

2) Sum of 3 cubes

Most (though not all) numbers can be written as the sum of 3 cubes. For example:
13 + 23 + 23 = 17. Therefore 17 can be written as the sum of 3 cubes.

This program allows you to see all the combinations possible when using the integers -10 to 10 and trying to make all the numbers up to 29.

for k in range(1,30):

  for a in range(-10, 10):
    for b in range(-10,10):
      for c in range (-10, 10):
        if a**3+b**3+c**3 == k :

3) Narcissistic Numbers

A 3 digit narcissistic number is defined as one which the sum of the cubes of its digits equal the original number. This program allows you to see all 3 digit narcissistic numbers.

for a in range (0,10):
 for b in range(0, 10):
  for c in range(0,10):
   if a**3 + b**3 + c**3 ==100*a + 10*b + c:
    print(int(100*a + 10*b + c))

4) Pythagorean triples

Pythagorean triples are integer solutions to Pythagoras’ Theorem. For example:
32 + 42 = 52 is an integer solution to Pythagoras’ Theorem.
This code allows you to find all integer solutions to Pythagoras’ Theorem for the numbers in the range you specify.

k = 100

for a in range(1, k):
 for b in range(1,k):
  for c in range (1, 2*k):
   if a**2+b**2==c**2:

5) Perfect Numbers

Perfect numbers are numbers whose proper factors (factors excluding the number itself) add to the number. This is easier to see with an example.

6 is a perfect number because its proper factors are 1,2,3 and 1+2+3 = 6

8 is not a perfect number because its proper factors are 1,2,4 and 1+2+4 = 7

Perfect numbers have been known about for about 2000 years – however they are exceptionally rare. The first 4 perfect numbers are 6, 28, 496, 8128. These were all known to the Greeks. The next perfect number wasn’t discovered until around 1500 years later – and not surprisingly as it’s 33,550,336.

The code below will find all the perfect numbers less than 10,000.

for n in range(1,10000):
 list = []

 for i in range (1,n):

  if n%i ==0:
 if sum(list)==n:

Friendly Numbers

Friendly numbers are numbers which share a relationship with other numbers. They require the use of σ(a) which is called the divisor function and means the addition of all the factors of a. For example σ(7) = 1 + 7 = 8 and σ(10) = 1 +2 +5 + 10 = 18.

Friendly numbers therefore satisfy:

σ(a)/a = σ(b)/b

As an example:

σ(6) / 6 = (1+2+3+6) / 6 = 2,

σ(28) / 28 = (1+2+4+7+14+28) / 28 = 2

σ(496)/496 = (1+2+4+8+16+31+62+124+248+496)/496 = 2

Therefore 28 and 6 are friendly numbers because they share a common relationship.

This code will help find some Friendly numbers (though these are very difficult to find, as we need to check against every other integer until we find a relationship).

The code below will find some Friendly numbers less than 200, and their friendly pair less than 5000:

for n in range(1,5000):
 list = []

 for i in range (1,n+1):
  if n%i ==0:
 Result1 = sum(list)
 for m in range(1,200):
  list2 = []
  for j in range (1,m+1):
   if m%j ==0:
  Result2 = sum(list2)

  if Result2/m ==Result1/n:
   if n != m:

Hailstone numbers

Hailstone numbers are created by the following rules:

if n is even: divide by 2

if n is odd: times by 3 and add 1

We can then generate a sequence from any starting number. For example, starting with 10:

10, 5, 16, 8, 4, 2, 1, 4, 2, 1…

we can see that this sequence loops into an infinitely repeating 4,2,1 sequence. Trying another number, say 58:

58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1…

and we see the same loop of 4,2,1.

The question is, does every number end in this loop? Well, we don’t know. Every number mathematicians have checked do indeed lead to this loop, but that is not a proof. Perhaps there is a counter-example, we just haven’t found it yet.

Run the code below, and by changing the value of n you can see how quickly the number enters the 4,2,1 loop.

n = 300
for k in range(1,40):

 if n%2 ==0:
  n =n/2
 elif n%2 !=0:
  n =3*n+1

Generating the Golden ratio

The Golden ratio can be approximated by dividing any 2 successive terms of the Fibonacci sequence. As we divide ever larger successive terms we get a better approximation for the Golden ratio. This code returns successive terms of the Fibonacci sequence and the corresponding approximation for the Golden ratio.

a = 0
b = 1
for k in range(1,30):

 a = a+b
 b = a+b

 print(a,b, b/a)

Partial sums

We can use programs to see if sums to infinity converge. For example with the sequence 1/n, if I add the terms together I get: 1/1 + 1/2 + 1/3 + 1/4…In this case the series (surprisingly) diverges. The code below shows that the sum of the sequence 1/n2 converges to a number (pi2/6).

list = []
for n in range(1,100):
 n = 1/(n**2)

Returning to 6174

This is a nice number trick. You take any 4 digit number, then rearrange the digits so that you make the largest number possible and also the smallest number possible. You then take away the smallest number from the largest number, and then start again. For example with the number 6785, the largest number we can make is 8765 and the smallest is 5678. So we do 8765 – 5678 = 3087. We then carry on with the same method. Eventually we will arrive at the number 6174!

k= int(input("type a 4 digit number "))
a = int(k%10)
d = int(k//1000)
c = int(k//100 - 10*d)
b = int(k//10 -10*c-100*d)

for n in range(1,10):

 list = []
 list = [a,b,c,d]

 a = list[0]
 d = list[3]
 c = list[2]
 b = list[1]
 print(1000*d+100*c+10*b+a -1000*a-100*b-10*c-d)
 k = int(1000*d+100*c+10*b+a -1000*a-100*b-10*c-d)
 a = int(k%10)
 d = int(k//1000)
 c = int(k//100 - 10*d)
 b = int(k//10 -10*c-100*d)
 list = []
 list = [a,b,c,d]

 a = list[0]
 d = list[3]
 c = list[2]
 b = list[1]

 print(1000*d+100*c+10*b+a -1000*a-100*b-10*c-d)

Maximising the volume of a cuboid

If we take a cuboid of length n, and cut squares of size x from the corner, what value of x will give the maximum volume? This code will look at initial squares of size 10×10 up to 90×90 and find the value of x for each which give the maximum volume.

def compute():

 z = int(0.5*a*10**k)

 for x in range(1,z):
 print("length of original side is, ", 10*a)
 y= max(list1)
 print("maximum volume is, ", max(list1))

 q = list1.index(y)
 print("length of square removed from corner is, ", (q+1)/10**(k-1))

for a in range(1,10):

Stacking cannonballs – solving maths with code

Numberphile have recently done a video looking at the maths behind stacking cannonballs – so in this post I’ll look at the code needed to solve this problem.

Triangular based pyramid.

Screen Shot 2019-05-19 at 3.36.23 PM

A triangular based pyramid would have:

1 ball on the top layer

1 + 3 balls on the second layer

1 + 3 + 6 balls on the third layer

1 + 3 + 6 + 10 balls on the fourth layer.

Therefore a triangular based pyramid is based on the sum of the first n triangular numbers.

The formula for the triangular numbers is:

Screen Shot 2019-05-19 at 3.40.12 PM

and the formula for the sum of the first n triangular numbers is:

Screen Shot 2019-05-19 at 3.40.16 PM

Screen Shot 2019-05-19 at 3.54.28 PM

We can simplify this by using the identity for the sum of the first n square numbers and also the identity for the sum of the first n natural numbers:

Screen Shot 2019-05-19 at 3.54.39 PM

Screen Shot 2019-05-19 at 3.54.35 PM


Screen Shot 2019-05-19 at 3.54.44 PM

and the question we want to find out is whether there is triangular based pyramid with a certain number of cannonballs which can be rearranged into a triangular number i.e.:

Screen Shot 2019-05-19 at 3.54.49 PM

here n and m can be any natural number. For example if we choose n = 3 and m = 4 we see that we have the following:

Screen Shot 2019-05-19 at 3.54.52 PM

Therefore we can have a triangular pyramid of height 3, which has 10 cannonballs. There 10 cannonballs can then be rearranged into a triangular number.

Square based pyramids and above.

Screen Shot 2019-05-19 at 3.36.06 PM

For a square based pyramid we would have:

1 ball on the top layer

1 + 4 balls on the second layer

1 + 4 + 9 balls on the third layer

1 + 4 + 9 + 16 balls on the fourth layer.

This is the sum of the first n square numbers.  So the formula for the square numbers is:

Screen Shot 2019-05-19 at 4.07.43 PM

and the sum of the first n square numbers is:

Screen Shot 2019-05-19 at 4.07.45 PM

For a pentagonal based pyramid we have:

1 ball on the top layer

1 + 5 balls on the second layer

1 + 5 + 12 balls on the third layer

1 + 5 + 12 + 22 balls on the fourth layer.

This is the sum of the first n pentagonal numbers. So the formula for the pentagonal numbers is:

Screen Shot 2019-05-19 at 4.07.48 PM

and the formula for the first n pentagonal numbers is:

Screen Shot 2019-05-19 at 4.07.51 PM

For a hexagonal based pyramid we have:

The formula for the first n hexagonal numbers:

Screen Shot 2019-05-19 at 4.07.55 PM

and the formula for the sum of the first n hexagonal numbers:

Screen Shot 2019-05-19 at 4.07.58 PM

For a k-agon based pyramid we have

Screen Shot 2019-05-19 at 4.08.01 PM

and the formula for the sum of the first n k-agon numbers:

Screen Shot 2019-05-19 at 4.20.16 PM

Screen Shot 2019-05-19 at 4.20.22 PM

Screen Shot 2019-05-19 at 4.20.25 PM

Therefore the general case is to ask if a k-agonal pyramid can be rearranged into a k-agon number i.e:

Screen Shot 2019-05-19 at 4.20.29 PM

Computers to the rescue

We can then use some coding to brute force some solutions by running through large numbers of integers and seeing if any values give a solution.  Here is the Python code.  Type it (taking care with the spacing) into a Python editor and you can run it yourself.

Screen Shot 2019-05-19 at 4.28.45 PM

You can then change the k range to check larger k-agons and also change the range for a and b.  Running this we can find the following.  (The first number is the value of k, the second the height of a k-agonal pyramid, the third number the k-agon number and the last number the number of cannonballs used).


3 , 3 , 4 , 10
3 , 8 , 15 , 120
3 , 20 , 55 , 1540
3 , 34 , 119 , 7140
4 , 24 , 70 , 4900
6 , 11 , 22 , 946
8 , 10 , 19 , 1045
8 , 18 , 45 , 5985
10 , 5 , 7 , 175
11 , 25 , 73 , 23725
14 , 6 , 9 , 441
14 , 46 , 181 , 195661
17 , 73 , 361 , 975061
20 , 106 , 631 , 3578401
23 , 145 , 1009 , 10680265
26 , 190 , 1513 , 27453385
29 , 241 , 2161 , 63016921
30 , 17 , 41 , 23001
32 , 298 , 2971 , 132361021
35 , 361 , 3961 , 258815701
38 , 430 , 5149 , 477132085
41 , 204 , 1683 , 55202400
41 , 505 , 6553 , 837244045
43 , 33 , 110 , 245905
44 , 586 , 8191 , 1408778281
50 , 34 , 115 , 314755
88 , 15 , 34 , 48280
145, 162, 1191, 101337426
276,  26,  77, 801801)
322, 28, 86, 1169686
823, 113, 694, 197427385
2378, 103, 604, 432684460
31265, 259, 2407,  90525801730

Screen Shot 2019-05-19 at 8.58.44 PM

For example we can see a graphical representation of this.  When k is 6, we have a hexagonal pyramid with height 11 or the 22nd hexagonal number – both of which give a solution of 946.  These are all the solutions I can find – can you find any others?  Leave a comment below if you do find any others and I’ll add them to the list!

Screen Shot 2019-03-08 at 8.03.56 PM.png

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:

Screen Shot 2019-03-08 at 8.08.09 PM

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

Screen Shot 2019-03-08 at 8.08.14 PM

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.

Screen Shot 2019-03-08 at 8.08.22 PM

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

Screen Shot 2019-03-08 at 8.08.32 PM

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

Screen Shot 2019-03-08 at 8.08.39 PM

Substituting this into the expression gives us:

Screen Shot 2019-03-08 at 8.08.48 PM

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

Screen Shot 2019-03-08 at 8.08.55 PM

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

Screen Shot 2019-03-08 at 8.09.09 PM

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.

Screen Shot 2019-03-08 at 8.27.58 PM

Screen Shot 2019-03-08 at 8.26.35 PM

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.

Screen Shot 2019-03-08 at 9.15.00 PM

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

Screen Shot 2019-03-08 at 9.15.07 PM

Next we simplify the surd, and then use the expansion for the square root of 1 + u2

Screen Shot 2019-03-08 at 9.15.14 PM

This then gives the following answer:

Screen Shot 2019-03-08 at 9.15.19 PM

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.


Screen Shot 2019-02-20 at 2.24.37 PM

Modeling hours of daylight

Desmos has a nice student activity (on 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 has the following distribution of hours of daylight (taking the reading from the first of each month and setting 1 as January)

Screen Shot 2019-02-20 at 2.08.34 PM


Manchester has much greater variation and is as follows:

Screen Shot 2019-02-20 at 2.08.40 PM

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

Screen Shot 2019-02-20 at 2.09.00 PM

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


Screen Shot 2019-02-20 at 2.08.54 PM


Screen Shot 2019-02-20 at 2.08.46 PM

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.

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.

Screen Shot 2018-02-25 at 6.59.40 PM

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:

Screen Shot 2018-02-25 at 6.59.46 PM

which can be differentiated implicitly to give:

Screen Shot 2018-02-25 at 7.25.54 PM

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:

Screen Shot 2018-02-25 at 6.59.50 PM

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.

Screen Shot 2018-01-11 at 8.55.53 PM

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

Screen Shot 2018-01-11 at 9.00.58 PM

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:

Screen Shot 2018-01-11 at 9.22.07 PM

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.


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).Screen Shot 2017-12-09 at 8.28.33 PM

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.

Screen Shot 2017-11-28 at 1.16.32 PM

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.

Screen Shot 2017-11-28 at 1.29.36 PM

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

Screen Shot 2017-11-28 at 1.57.47 PM

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

Screen Shot 2017-11-28 at 2.00.09 PM

Next, we use Desmos’ regression for y = aebx+d. This gives the line above with equation:

y = 5.10 x 10-7 e1.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 e1.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:

  1. continued growth following a polynomial rather than exponential model
  2. 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).


Screen Shot 2017-06-15 at 10.54.40 AM

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.

Screen Shot 2017-06-15 at 9.06.25 AM

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

Screen Shot 2017-06-15 at 10.31.20 AM

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

Screen Shot 2017-06-15 at 10.35.43 AM

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):

Screen Shot 2017-06-15 at 11.45.41 AM

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!

Website Stats


Recent Posts

Follow IB Maths Resources from British International School Phuket on