String resonance

My friend Will posted a cool animation today:

It got me thinking about the lab we do with vibrating strings and I learned a couple of cool things.

First of all, his animation didn’t seem like what the lab looks like if you slowly increase the frequency of the driving speaker (which is tied to one end of the string). Will’s animation looked more like that end was a free end, so he and I had a nice twitter conversation about it. I finally got what he was doing when he posted

So I sent him a link to some stuff I’ve done in the past, but thought I’d try to make an animation where the speaker slowly increases its frequency. First I had to think about the mathematical function for the speaker that would represent a sinusoidal motion that speeds up. Here’s where my work in grad school with all kinds of temperal/fourier transform functions came in handy. It turns out that the instantaneous frequency for any function that can be written Sin/Cos/Exp[i … is given by the time derivative of the argument of the trig function. So, if I wanted a function that linearly increased the frequency, I just need to integrate my goal and I’d have the argument to feed into the code. So, here’s the code with some annotation

The Mathematica code for solving the wave equation with a stretched string. The boundary conditions are highlighted in yellow and the initial conditions in blue.

The Mathematica code for solving the wave equation with a stretched string. The boundary conditions are highlighted in yellow and the initial conditions in blue.

You can see that for the moment the code has no friction (because the effective \beta is zero. That was my first thought to make this animation, but here’s the somewhat disappointing results

animation of the string with no friction. n is the mode number, so cool things should happen at the integers

animation of the string with no friction. n is the mode number, so cool things should happen at the integers

That’s when I realized that I needed to add some friction so that the energy stored in the earlier modes would be dissipated by the time the next mode comes around. That’s how I got this animation:

now a little friction is added

now a little friction is added

Of course, both suffer from a sampling problem, but you get the gist. I think it looks a lot like the lab, so that’s cool.

Thoughts? Here’s some starters for you:

  • This is cool! What is the Mathematica command to make the animation?
  • This is dumb. The strings in my lab don’t look like that at all. Instead . . .
  • This is cool! Can you do the same boundary conditions as Will?
  • This is dumb. The jerkyness of the animated gifs really bothers me. Couldn’t you just upload, I don’t know, the 3MB file with better temporal resolution? (ok fine, see below)
This one has 10 times as many frames

This one has 10 times as many frames

About Andy Rundquist

Professor of physics at Hamline University in St. Paul, MN
This entry was posted in mathematica, physics, twitter. Bookmark the permalink.

6 Responses to String resonance

  1. bretbenesh says:

    That was cool! I have no follow-up—I am not a physicist.

    I could watch that last animation for quite a long time before I got bored.

  2. ambarr512 says:

    I like it. For one thing, I think it’s interesting to see that without damping (the situation usually discussed in intro courses) you get something unphysical as you continually increase up energy in the system. Is this something you might have students do or is this just for fun for you?

    It looks like the amplitude of your driver is changing in the animation. Is the amplitude really changing or is this an illusion due to the sampling rate? YouTube has some nice videos of transverse standing waves appearing to move longitudinally or water coming out of an oscillating hose appearing to travel backwards due to video frame rate effects. I’ve been thinking of trying to have students replicate one of those videos and maybe write some coded animations to help them explore how the effect arises.

    • Andy "SuperFly" Rundquist says:

      yeah, the amplitude is fixed but looks wrong due to the frame rate. In the bottom gif I posted (the long one) you can see that the amplitude stays the same.

      As for having students play with this, I normally wouldn’t. The friction part is hard to get across (along with the partial derivatives) for intro students, and in my advanced class we don’t actually get to continuous systems. But now you’ve got me thinking . . .

      On Sun, Oct 5, 2014 at 6:36 PM, SuperFly Physics wrote:


  3. I wonder what the animation would look like if the frequency was not changed until after a certain number of oscillations has occurred. True, it would take a long time at the start, but also at the start you don’t even get through 1 oscillation until the drive frequency has changed significantly.

    • Andy "SuperFly" Rundquist says:

      I thought about doing that. Maybe I’ll do it tonight

      On Mon, Oct 6, 2014 at 3:00 PM, SuperFly Physics wrote:


      • Andy "SuperFly" Rundquist says:

        ok, so I’m working on this. I’ve determined that a phase function that’s exponential does this. In other words, the instantaneous frequency changes be a set amount every n periods of the current frequency. Got that worked out. But when I run the simulation, I get basically no resonance! I’ll keep playing.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s