“Are you impressed?” – Simon asks, laughingly, and I can see it must be a pun. We are in bed, reading up on Newton’s laws of motion that talk of forces being “impressed” upon bodies.
Simon continues: “Newton’s mechanics says that the speed limit is infinite, which says that matter doesn’t exist, which says that Physics doesn’t exist, which says that Newton’s mechanics doesn’t exist. Newton’s mechanics contradicts itself!”
The book we are reading (17 Equations that Changed the World by Ian Stewart) goes on to describe how in Newton’s laws, calculus peeps out from behind the curtains and how the second law of motion specifies the relation between a body’s position, and the forces that act on it, in the form of a differential equation: second derivative of position = force/mass. To find the position, the book says, we have to solve this equation, defusing the position from its second derivative. “Do you get it?” – I ask, “Because I don’t think I do”. — “I’ll need a piece of paper for this”, – Simon quickly comes back dragging his oversized sketchbook. Then he quickly writes down the differential equation (where the x is the position) to explain to me what the second derivative is. And then he solves it:
Simon loved the Science Museum, even though he did not get to see the Klein Bottles from the museum’s permanent collection (none of them was on display). He particularly enjoyed the math and information age spaces. The Original Tour was a success, too – giggling at all the jokes on the English audio guide, he was bubbling with joy that he could follow everything and was actively studying the map, together with Dad. The only thing Simon really hated to tears was The Tower.
Simon has decided to correct Newton’s second law:
Today Simon was watching Daniel Shiffman’s tutorials to learn about drag force and how to apply it when building a spring simulation in p5.js. Simon wrote the formula for drag force in Microfost Word and looked up all the variables:
While building a spring in p5.js, Simon talks about the 3 laws of Isaac Newton:
The project is based upon Daniel Shiffman’s book The Nature of Code, specifically Chapter 3 (Oscillation). Simon spent the rest of the evening studying “simple harmonic motion”, periods and amplitudes. Here is an excerpt from Daniel Shiffman’s book:
y = sine(x)
You’ll notice that the output of the sine function is a smooth curve alternating between –1 and 1. This type of a behavior is known as oscillation, a periodic movement between two points. Plucking a guitar string, swinging a pendulum, bouncing on a pogo stick—these are all examples of oscillating motion.
This is what is known as simple harmonic motion (or, to be fancier, “the periodic sinusoidal oscillation of an object”). It’s going to be a simple program to write, but before we get into the code, let’s familiarize ourselves with some of the terminology of oscillation (and waves).
Simple harmonic motion can be expressed as any location (in our case, the x location) as a function of time, with the following two elements:
Amplitude: The distance from the center of motion to either extreme
Period: The amount of time it takes for one complete cycle of motion
Looking at the graph of sine, we can see that the amplitude is 1 and the period is TWO_PI; the output of sine never rises above 1 or below -1; and every TWO_PI radians (or 360 degrees) the wave pattern repeats.
Simon has come up with a new code of his own! It’s about gravitational attraction (particles attracted to targets or moons attracted to planets) and partially based upon the Box2D library but he wrote most of the code himself. Simon used the gravitational constant and Newton’s law of universal gravitation to build this project. The law states that every point mass (m1) attracts every single other point mass (m2) by a force (F) pointing along the line intersecting both points. The force is proportional to the product of the two masses and inversely proportional to the square of the distance between them (r):
Simon had come across this formula before in Daniel Shiffman’s tutorials and just like Daniel he changed r to d (for distance):
float strength = (G * 1 * p.mass) / (distance * distance);
Simon pushed his full code to GitHub at:
Here Simon added some new features, like pressing keys for adding new targets and particles:
Here the force is becoming stronger with more targets, Simon explains:
We’ve also got a video of Simon talking about this project in Dutch (showing it to his math teacher):