Everyone loves puzzles, right? This math puzzle from the YouTuber Numberphile poses a simple question: How can a mouse escape from a cat. But wait! It's not just a mouse running on the ground. Instead, the mouse is swimming in a circular pool, and the cat is on the outside of the pool. The cat can move 4 times faster on the ground than the mouse can swim. So, how does the mouse escape?
Although it might be possible to find a solution to this puzzle with just a paper and pencil, it's much more fun to build a numerical model. With a numerical model, a problem is solved by using small steps. In this case, it will be small steps of time (let's say 0.01 seconds). During this short time interval, we can make some approximations about the motion of both the cat and the mouse that will be very simple to solve. Of course you can't see if the mouse escapes in just 0.01 seconds. That means you will need to repeat these simple calculations many times. If you want to run the model for just 1 second, that would cover 100 steps in this case.
For many problems, like a ball falling with air resistance, we can use real physics concepts in each of these tiny steps. For this cat and mouse, we are going to have to make up some "rules." Let's start with the following behaviors for both animals.
- The cat will move along the circle with a constant speed and travel to the point that is closest to the mouse.
- The mouse will travel with a constant speed and always move in a direction away from the cat.
Those are the rules, but we still need to break this into pieces. I'm going to build the model in Python—well, actually it's VPython. This is Python with a visual module that allows me to easily visualize what's happening with a 3D animation.
I will go ahead and share this program below. You can run it (press the Play button) and look at the code (with the pencil icon). After that, I will go over some of the important details.
Let me start with the cat details. There is one tricky thing to figure out—should the cat move clockwise or counterclockwise? There might be a better way to determine the cat's direction, but I used the cross product. The cross product is a vector operation that returns another vector. This resultant vector is perpendicular to both of the starting vectors. If I take the cross product of the vector position of the cat and the position of the mouse, I will get a result in the z-direction (the pool is in the x-y plane). If the mouse is to the left of the cat, this cross product will be in the positive z-direction. Otherwise, it will be in the negative z-direction. I can use this to set the sign on the cat's angular velocity to move it.
What about the mouse? Again, I am going to use a vector. I can find the vector from the cat to the mouse and then use that to find a unit vector. A unit vector is just a vector with a magnitude of one and no units (I know that seems weird). But with that unit vector, I can multiply it by the mouse's speed to get a vector velocity.
If you are curious, the solution (SPOILER ALERT) is a combination of a "dash tactic" and a "circling tactic." The dash tactic says that there are certain cases where the mouse is close enough to the edge of the pool that it will get there before the cat. The dash is just a straight line to the edge of the pool in the shortest distance.
Click Here: fjallraven kanken backpack
The circling tactic is a way for the slower mouse to get ahead of the cat. If the mouse moves in a circle with a radius that is much smaller than the radius of the pool, it will be able to have a greater angular velocity than the cat. This will let the mouse "get ahead." So, to escape, the mouse will circle until it is far enough ahead to make the dash—that's it.
I'll admit that it can be a little bit more complicated to code the mouse with these "decisions." If you want to try it, I will leave that as a homework assignment for you (along with some other questions).
Homework
- Fix the code so that the mouse can use the dash-circling tactics to escape.
- What happens if you change the speed of the mouse and/or cat?
- What happens if you place the mouse and cat at different starting positions?
- Try giving the cat and the mouse an acceleration of 1 meter per second squared (up to their maximum speeds).
- Can you make your own mouse behavior model?
- Modify the mouse behavior so that it always aims for a point on the edge of the pool that is the complete opposite of the cat (just like in the video).
- Is it possible to make some other mouse motion such that it eventually gets into a dash position to escape?