There is a scene in Harry Potter and the Deathly Hallows: Part 2 that I always find interesting. I suppose I should give a spoiler alert, but it's five year old movie and this doesn't really give away the plot.

In the scene, Harry (and friends) break into a vault to find something. As a layer of security, there is a spell on the treasure that makes it multiply when touched. This is what that looks like.

Warner Bros.

Each item makes four copies of itself (so one item is now five). Each of these new items then also replicates making four more items. You might think this would be an awesome way to get rich, but the amount of items increases rapidly. I assume the goal is for the explosion of treasure to kill any potential robbers by drowning and crushing them.

You probably know what is going to happen next. I'm going to try to model this treasure replication trap. Yes, that's what I will do.

Measurements from the movie

In order to create a model, you need at some data. In this case, I am going to look at the movie and find out how fast this treasure replicates. Even if I only care about measuring time between replications, I still find Tracker Video Analysis quite useful.

From my analysis, here is what I found:

One piece of treasure turns into five pieces every 2.5 seconds (approximately).

This multiplication might not last forever. In the scene, the replication appears to pause after about 48 seconds—but then it starts again after about a five-second pause. Not sure what to make of that.

The clip ends after the treasure has been multiplying for 93 seconds. The volume of this treasure doesn't quite fill the room—but it's significant.

There are lots of different types of treasure, but I am going to assume that a typical piece of treasure is a sphere with a radius of 6 cm with a mass of 200 grams (those are just complete guesses).

But now I can create a treasure multiplication model.

Multiplication Model

I will start with a discrete multiplication model. It's fairly straightforward to make something like this in python but let's start off doing it manually. Here is how it goes.

Start with one piece of treasure.

Wait 2.5 seconds.

Have that one piece of treasure multiply by four so that there are now five pieces.

Wait 2.5 seconds again.

Each one of the pieces of treasure will multiply. There were five, now there will be 25.

After another 2.5 seconds those 25 pieces will each turn into five to create a total of five times 25 or 125.

OK, I think you get pattern. Now let's put this into a python code. Basically, I am just going to use a counter variable (I will call it n) and this will increase in value every time there is a multiplication. So, after some number of multiplications (say n), I would have the following expression for the total number of treasure pieces.

Since the multiplication happens every 2.5 seconds, I can multiply the loop number (n) by 2.5 to get a plot of the number of treasure pieces as a function of time.

Feel free to run the code (the play button) and edit the code (the pencil button). You can try changing things around to see what happens—that's how you learn. Don't worry, you won't break anything (at least not permanently). But you can see that after only 10 seconds, there would be 625 pieces of treasure. Actually, it's more than that. This model has the assumption that only one piece of treasure starts multiplying. In the movie, it's clear that there is more than one treasuresplosion (I just made up that word).

OK, how about a mathematical model? Now that we know what this treasuresplosion should look like I can create a function that matches that data. Let me start with this exponential growth formula.

This says that if you start with some number of items (like one), you can find the number you will have after some time t. The variable τ is the time constant. This is the time that it takes to increase the number by five—so that would be 2.5 seconds.

Here's where you can see the value of a numerical (python) model for multiplying treasure. It's fairly straightforward to model the treasuresplosion by looking at it in each step. Creating a mathematical function might seem a little more complicated. However, what if I use both methods at the same time? Then I can check my mathematical model against the step by step model. Here is a modification to my previous code that shows both methods for determining the amount of treasure.

You can see that the two models pretty much agree—that's good (click the pencil icon above to see the code).

How long until the room fills up?

Now for something useful. If the treasure keeps multiplying at the same rate, how long does Harry Potter have before the room is completely full? OK, I need two assumptions.

How big is the room? I'm just going to make a guess here—and I will try to overestimate. Let's say the room is 4 meters high with a floor that is 15x15 meters. This gives a room volume of 900 m 3 .

. What is the volume of one piece of treasure and how does it pack? I already assumed the item was a sphere with a radius of 6 cm. This gives it an approximate volume of 9 x 10-4 m3. I will also assume a cubical packing scheme so that the volume require for five items will just be five times the volume of one item.

With this, I can write an expression for the total treasure volume as a function of time (assuming we start with just one multiplying treasure item).

In this expression, V 0 is the volume of just one item. Now I want to solve for the time that this volume of treasure is equal to the volume of the room (which I will call V r ).

Putting in the values for my estimations, I get a room-fill time of 21.5 seconds. Yes, that's even before the multiplication pause after 48 seconds. I know what you are thinking—maybe my estimation for the room is just too small. OK, let's just put in a time value of 48 seconds and see how much volume the treasure would take up. With this time, the treasure would require a volume of 2.4 x 1010 m3.

It's difficult to get a feeling for just how much volume this treasure would occupy. How about this? Suppose the room was even bigger—say 100 meters by 100 meters, but there was no ceiling. If the treasure multiplied in this room, how tall would this treasure stack measure? If I take a base area of 104 m2 and divide the treasure volume by this amount, I will get a height of 2.4 x 106. That's 2,400 km or one third the radius of the Earth. Yes, that's a bunch of treasure.

Homework

Here are some extra questions for you to consider.