Part 5: The low-amplitude limit, quantitatively

Now, let’s study the string’s vibrations precisely, and determine how well and under what conditions they align with the analytic predictions.

The quantitative thing that we can measure is the string’s period. To measure the period of any given normal mode n, select a mass near an antinode of that mode, and watch it move up and down. If your initial conditions displace the string in the +y direction, then the string has completed one full period when the string moves “down, then back up, then starts to go down again”. To have our program tell us when that is, we want to watch for the time when the velocity changes from positive to negative.

In order to detect this, you’ll need to introduce a variable that keeps track of the previous value of vy at that position, so you can monitor it for sign changes.