Formulas or Code? It’s All Numbers When It Comes to Physics

November 2, 2020

24 0

by

Everyone already uses computers in physics. At the very least, students use handheld calculators (I doubt anyone is still using a slide-rule calculator). Also, it’s becoming more common to have students solve physics problem by creating and coding their own programs— and I think that is a good thing. If you aren’t familiar with these numerical calculations (another name for computational physics), the basic idea is to take a problem and break it into many smaller and simpler problems. These smaller problems are easier to solve, but you get so many calculations that you basically have to write a computer program to complete them (but you technically don’t have to use a computer).

But as numerical methods become more common, we also have to discuss the role of these methods in terms of the nature of science. I often see quotes like this: “Computational methods expand our tool set in physics. We now have three parts of science: experiment, theory, and computations.”

However, this just isn’t true. You can’t break science into three different parts. Computational methods and theory are really just two versions of a calculation—and they really aren’t that different. I’m going to show you how these are the same, but first let me be clear about the nature of science. Science is all about the building and testing of models. We create models about the way the universe works, and then we test these models with experimental evidence. These models could be an actual physical model (like a globe), a conceptual model, an equation—or even a computer program. So, both “theory” and “computation” are both models.

Let’s start with a mass connected to a spring. I’ll be honest, we physicists LOVE this situation. It’s easy enough to solve but complicated enough that we can approximate many other things as just a mass on a spring. For example, when a block sits on a table, the contact force can be modeled as a spring. Even the interaction between atoms in a solid can be approximated as a spring force. Really, this problem is everywhere. But here it is in its most basic form.

I’m going to solve this problem two ways. First, I will solve it numerically by breaking it into small pieces (and using some Python code). After that, I will find an analytical solution—a solution that is a closed form function (like in terms of cosine) so that you can put in whatever numbers and parameters you want to get a bunch of solutions. But in the end, I’ll show you that these two methods aren’t really that different.

Numerical Solution

In order to build a numerical model for a mass connected to a spring, we need an expression for the force a spring exerts. If you take a spring and pull it, it pulls back with some force. The more you stretch it, the harder it pulls. Suppose the position of a mass is given by the variable x such that this is also the stretch of the spring. In that case, the spring force (in one dimension) would be:

subscribe for YouMedia Newsletter

0 comments

Recent Posts

Vilnius, Lithuania built a ‘portal’ to another c...

June 7, 2021

newsletter

subscribe for YouMedia Newsletter