The catenary is the shape of a hanging chain supported at both ends in a constant gravitational field (ie normal life). Recently Rhett Allain has been doing some great work using both python and analytical results to show how you can calculate and simulate a catenary.
His work reminded me that I had never finished an approach to this problem that I hatched several years ago. I wanted to see if I could use Lagrange multipliers to ensure that the spacing between the beads (I’m modeling a beaded string much like Rhett) stays constant. I wanted to start the string in some initial configuration with the two ends fixed and let it then evolve over time, with a fair amount of friction added, so that it would settle into the final shape, ie the catenary. The problem was that I was stuck on how best (or at all!) to set up the initial configuration such that all the spacers between the beads was fixed and it stretched from one fixed point to the other.
With Rhett’s inspiration, however, I figured out a way to do it. I think I was stuck on some sort of evenly distributed setup where the beads zigzagged up and down with just the right angle so that the string would make it to the other end without having to stretch any of the spacers. But I found an easier way.
I pick one of the beads towards the middle (actually almost any bead will work with the possible exception of the beads closest to the fixed points) and find where I can put it so that the string bends only at that bead. In other words, the beads form a straight line from the first fixed point to that chosen bead and then a different straight line to the second fixed point.
At first I thought this would be lucky if I could get it to work but after drawing a bunch of circles I convinced myself that you can (nearly) always find a location for that chosen bead that works.
With that, the initial conditions match all the constraints and I can get to the calculation!
As I note at the bottom of this post, I can model this as a bunch of seemingly free particles (so model x(t) and y(t) for every bead) that are exposed to gravity along with an unknown Lagrange multiplier for every spacer constraint. So that’s what I did. Here’s the Mathematica code:
Ok, here’s what I have so far:
It works pretty well! One cool thing about doing Lagrange Multipliers is that they tend to tell you about the forces required to maintain the constraint, namely making sure that all successive beads are held a fixed distance apart. Here’s a plot of those forces for the second animation above:
So, thanks to Rhett’s great work I finally got back around to this. I really like his simulation approach, which basically puts really strong springs in as the spacers. But I’ve always wanted to see if you could use Lagrange Multpliers to enforce the contraints without resorting to those springs.
What do you think? Here are some starters for you:
- I like this, but I like Rhett’s way better. Maybe you could …
- I think this is dumb, I never fire up Mathematica when I hang things.
- I’m in class with you tomorrow and I don’t see how this has anything to do with Computational Data Science.
- Let me know when you’ve done this in vpython.
- I don’t understand why you take two time derivatives of the constraint equations. I thought you said you don’t have to do this anymore
- Why can’t you just reduce the dimensionality of this problem and just do a bunch of angles? Then you could figure out the constraint forces by finding the accelerations of all the beads that isn’t provided by gravity.
- Can you model it with one of the ends moving? (Answer: oddly no! I tried that and the last spacing wasn’t constrained. Not sure what’s going on there)