Uneven tree swing¶
I saw a swing today that was tied to a slanted tree branch. I've seen a lot of these and I always have wondered how unstable they are. My first thought is that each side has its own resonance (that don't agree) and so something funny must happen. But that doesn't take into account the fact that they're tied together by the seat so I thought I'd do a little modeling.
What I've done below is to model the swing as rigid bars for the two ropes and for the swing. I'll put (identical) weights at the corners of the seat and tie the top part at different heights. Here's a run with a left rope of 5 meters and a right rope hung one meter higher.
I used the Lagrange multiplier approach, stipulating the constraints of the lengths of the ropes and seat to be fixed at whatever the initial conditions gave. What I chose for the initial conditions is to have the seat be level but out at a 45 degree angle for the left rope.
topLeft={0,0,0};
topRight={1,0,1};
r[i_][t_]:={x[i][t], y[i][t], z[i][t]};
leftConstraint=(r[1][t]-topLeft).(r[1][t]-topLeft);
rightConstraint=(r[2][t]-topRight).(r[2][t]-topRight);
seatConstraint=(r[2][t]-r[1][t]).(r[2][t]-r[1][t]);
KE=1/2 Total[Table[r[i]'[t].r[i]'[t], {i,2}]];
PE=9.8 Total[Table[z[i][t], {i,2}]];
L=KE-PE;
el[a_]:=D[L,a[t]]-D[L,a'[t],t]+lambdaLeft[t] D[leftConstraint, a[t]]+lambdaRight[t] D[rightConstraint, a[t]]+lambdaSeat[t] D[seatConstraint, a[t]]==0;
sol=First[NDSolve[{el/@Flatten[Table[{x[i],y[i],z[i]},{i,2}]],
Thread[r[1][0]=={0, 5 Sin[Pi/4], -5 Cos[Pi/4]}],
Thread[r[2][0]=={1, 5 Sin[Pi/4], -5 Cos[Pi/4]}],
Thread[r[1]'[0]=={0,0,0}],
Thread[r[2]'[0]=={0,0,0}],
D[leftConstraint,t,t]==0,
D[rightConstraint,t,t]==0,
D[seatConstraint,t,t]==0}, {x[1], y[1], z[1], x[2], y[2], z[2], lambdaLeft, lambdaRight, lambdaSeat}, {t,0,10}]];
NDSolve::pdord: Some of the functions have zero differential order, so the equations will be solved as a system of differential-algebraic equations.
Here's a quick check that the constraints worked (note that I didn't bother with the square root when defining the constraints so the constants are the square of what you might have thought):
Plot[{leftConstraint/.sol, rightConstraint/.sol, seatConstraint/.sol},{t,0,10}]
Here's a trace of the two masses (so the ends of the seat). You can see that some weird stuff goes on:
ParametricPlot3D[{r[1][t]/.sol,r[2][t]/.sol},{t,0,10}]
And here's an animation showing some unstable action:
frame[t_]:=Show[Graphics3D[{PointSize[0.05],
Line[{topLeft, r[1][t], r[2][t], topRight}/.sol]},PlotRange->{ {-.1,1.1},{-5,5},{-6,1.2}}]];
ListAnimate[Table[frame[t],{t,0,10,.1}]]
I think there's a lot more to do with this model, including modeling the ropes as more realistic ropes. But this already is showing some weird behavior!
Your thoughts?¶
I'd love to hear your thoughts. Here are some starters for you:
- I love this. My favorite part is . . .
- This is dumb. What's particularly dumb is . . .
- You have to model the ropes as flexible to understand this better. No one build swings like you've modeled them.
- I've got one of these and it doesn't do any of the things you're worried about.
- I've got one of these and now I know why all my kids hate it.