You are currently browsing the tag archive for the ‘cannonballs’ tag.
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.
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:
and the formula for the sum of the first n triangular numbers is:
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:
Therefore:
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.:
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:
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.
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:
and the sum of the first n square numbers is:
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:
and the formula for the first n pentagonal numbers is:
For a hexagonal based pyramid we have:
The formula for the first n hexagonal numbers:
and the formula for the sum of the first n hexagonal numbers:
For a k-agon based pyramid we have
and the formula for the sum of the first n k-agon numbers:
Therefore the general case is to ask if a k-agonal pyramid can be rearranged into a k-agon number i.e:
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.
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).
Solutions:
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
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!
Galileo: Throwing cannonballs off The Leaning Tower of Pisa
This post is inspired by the excellent book by Robert Banks – Towing Icebergs. This book would make a great investment if you want some novel ideas for a maths investigation.
Galileo Galilei was an Italian mathematician and astronomer who (reputedly) conducted experiments from the top of the Tower of Pisa. He dropped various objects from in order to measure how long it took for them to reach the bottom, coming to the remarkable conclusion that the objects’ weight did not affect the speed at which it fell. But does that really mean that a feather and a cannonball would fall at the same speed? Well, yes – as long as they were dropped in a vacuum. Let’s have a look at how we can prove that.
Newton’s Laws:
For an object falling through the air we have:
psgV – pagV – FD = psVa
ps = The density of the falling object
pa = The density of the air it’s falling in
FD = The drag force
g = The gravitational force
V = The volume of the falling object
a = The acceleration of the falling object
To understand where this equation comes from we note that Newton second law (Force = mass x acceleration) is
F = ma
The LHS of our equation (psgV – pagV – FD) represents the forces acting on the object and the RHS (psVa) represents mass x acceleration.
Time to simplify things
Things look a little complicated at the moment – luckily we can make our lives easier through a little simplification. pa will be many magnitudes smaller than than ps – as the density of air is much smaller than the density of objects like cannonballs. Therefore we ignore this part of the equation, giving an approximate equation:
psgV – FD ≈ psVa
Next, we can note that in a vacuum FD (the drag force) will be 0 – as there is no air resistance. Therefore this can also be ignored to get:
psgV ≈ psVa
g ≈ a
But we have a = dU/dt where U = velocity, therefore,
g ≈ a
g ≈ dU/dt
g dt ≈ dU
and integrating both sides will give:
gt ≈ U
Therefore the velocity (U) of the falling object in a vacuum is only dependent on time and the gravitational force. In other words it is independent of the object’s mass. Amazing!
This might be difficult to believe – as it is quite unintuitive. So if you’re not convinced you can watch the video below in which Brian Cox tests this out in the world’s largest vacuum chamber.
If you liked this post you might also like:
War maths – how modeling projectiles plays an essential part in waging wars.