Let's Use Physics to Model a Curving Soccer Ball
It's that World Cup time of the year—so that means it's also time to talk about soccer physics. What about the impossible kick? The "impossible" kick has a ball leave the ground and then take a curved path while in the air. Of course it's not actually impossible, but it is difficult to pull off.
I'm not going to actually kick a soccer ball, but instead I want to use basic physics to model the motion of a ball. Let's start with the simplest possible case—a soccer ball kicked without the influence of air. Yes, that is unrealistic, but it's helpful to start with an idealized situation and then make it more complex after that.
Here is a ball at some point after it was kicked.
In this case, there is only one force acting on the ball after it was kicked—the gravitational force. I have also included a vector to represent the momentum of the ball at this instant where the momentum is the product of the mass and velocity. The momentum is important because the nature of a net force is to change the object's momentum.
Since the force is constant in both magnitude and direction, the motion of an object with only the gravitational force isn't so difficult to model. The trajectory of the ball can be determined using basic kinematic equations that you would find in your introductory physics textbook. But let's do this a better way—using a numerical calculation.
A numerical calculation takes a problem (like the motion of the soccer ball over the whole trajectory) and breaks it into many smaller problems. During each of these smaller problems, we can make some approximations to make the calculation simpler. These smaller problems are easier to solve than the whole trajectory, but simplicity comes with a cost. Instead of one difficult problem, you end up with a whole bunch of simple problems. The nice thing is that although there many problems to solve, they are so easy that even a computer can do it.
Here is the numerical recipe that we will use to model the motion of this ball.
- Start with some initial values for the position and momentum of the ball.
- Break the motion into small time steps (something like 0.01 seconds).
- During each time step, calculate the following:
- Calculate the total force on the object (in this case it's constant and doesn't change).
- Use this total force and the momentum from the previous step (or the initial momentum) to calculate the momentum at the end of the step.
- Use the momentum to find the new position of the ball.
- Keeping doing the above steps until you get bored or the computer revolts and decides to not work for you anymore.
That's the basic process. You can do this in Python—it's not too hard. If you want a more detailed tutorial on a calculation like this, you can start with this online workshop that I created.
OK, here is the actual code for a soccer ball without any interactions with the air. Click Play to run the code, then click the pencil icon to go back to the code. Feel free to change stuff in the code—I promise that you can't permanently break anything.
Notice that in this case, the soccer ball is kicked directly away from the viewer and over a while line on the "field." You can rotate the scene if you like by using right-click-drag in the view or ctrl-click-drag. But just for fun, here's a side view of the trajectory so you can see it's a parabola—as it should be.
Now let's add some air. When a soccer ball moves through the air, we can model this by adding an extra force—air resistance. You already have some experience with this air resistance force. When you put your hand out the window of a moving car, you can feel it. The air resistance force increases with the speed that the car moves. It also increases if you change your hand from a fist (small area) to an open hand (large area). Finally, the air resistance force depends also on the density of the air and the shape of the object.
Because air resistance depends on the speed of the object, it is very difficult to directly calculate the trajectory of an object in the air—the total force keeps changing the velocity, but the force also depends on the velocity! It's a tough problem. Well, it's tough to do on paper, but it's not so difficult to make a numerical calculation—and that's what we will do.
Really, there is only one major change to the previous numerical calculation. Instead of letting the force just be the gravitational force, it will be the sum of the gravitational force and the air resistance force (which must be calculated). Other than that, it's all the same.
OK, I just lied. It's the same program except that this calculation below has two soccer balls. The two balls are kicked with the same speed and angle, but one of them has an air resistance force and the other one does not (the yellow one). This way you can see the difference between the two trajectories.
With a side view, you can easily see the difference between these two balls.
That's pretty cool, right? But what about the impossible kick that curves in the air? For this, we are going to have to add a third force: the Magnus force. If you have a spinning ball moving through the air, one side of the ball moves faster relative to the air than the other side. This causes the ball to essentially "throw air" off to the side, which then pushes the ball back the other way. The direction of this Magnus force is perpendicular to the velocity and depends on both the velocity and the angular velocity (how fast the ball spins).
The Magnus force can be modeled as the following equation:
Note: this article at Physics World by Takeshi Asal gives some more details. And a couple more notes: The ω is the angular velocity vector. It has a direction that is along the axis of rotation. The s is a parameter that depends on the roughness of the ball's surface. Finally, the x is for the cross product—an operation between vectors (you can't multiply two vectors). Oh, one final note: The Magnus force is actually super complicated. The above expression is just an approximation—don't use it for important events like a free kick in the World Cup finals.
You can probably guess that there is only a small change to our numerical calculation to get the impossible shot. I just need to calculate this Magnus force and then add it to the total force. The rest of the code is pretty much the same. Again, I am going to include a second ball with no air interactions for comparison.
I decided to "kick" the ball slightly to the right so that it would be more like a real corner kick in soccer. Still, it looks pretty cool. I'm pretty pleased with the result. Of course the main point here isn't about soccer: It's to show you the power of a numerical calculation!