Standing Waves on a String

Instructions: For given values of L, T, and µ, try to find the correct Driving Frequency f to match the resonant standing wave frequencies of the string.
You'll know you hit the correct frequency when the amplitude of the wave becomes large.

How This Was Made:

Used OpenAI-O1-Preview: Research Preview
Prompt:
"Generate javascript code and HTML for an interactive, graphical web app for depicting standing waves on strings. there will be four sliders, labeled L, f, T, and mu (the Greek letter). When the value of f is within 2% of the value of 1/(2*L)*sqrt(T/mu), then draw a large-amplitude sine wave with a wavelength of 2L. It is up to you to decide how to scale the display on the screen. It is up to you to decide whether to import any libraries or not, and/or which drawing method (e.g. canvas or something else) to use. When L changes, I want the width of the graph to change appropriately. Go."

That prompt DID NOT produce the full app shown above, but the first draft had the sliders (labeled and with units!) and basic responsive "static" graph amplitude (on-off) behavior near the fundamental frequency. (It got the frequency wrong by a factor of 2, by the way.)

From there, it was easy enough to edit it a bit, then prompt again to add the animation feature, and to manually write a smoother transition for the amplitude and to have it work for multiple harmonics. Finally, I added the instructions text manually.


Scott H. Hawley