0

I'm trying to animate an $N$-Pendulum with solid (massless) rods, though I have tried many different ideas but I can't seem to make the animation work. Here are my last few thought processes:

First, at a certain frame, calculate the net force on each node. For a very small change in time, 3 essentially rotates around 2, and 2 around 1. So, the net force must be entirely perpendicular to the previous bar. As such, I can work backwards: first we know the gravity on three, and I know the angle relative to 2, so I now know both the net force and Tension 2 (which must cancel with a component of gravity), then we repeat up the chain.

Figure 1 My goal is to get the net angular acceleration on each node so I can do a double riemann integral (I have angular position and velocity relative to the last node stored for each node). angv += anga * dt, angx += angv * dt

  1. Then, we have the net force at each node, here's what I've been playing around with. For each rod, calculate the net angular acceleration on both ends and then since the previous node doesn't move (for a small dt), that angular acceleration is equal to the a.a. around the last node and not just the center of mass. I think the error here was that this started swinging with both nodes always in line if you started it perfectly horizontally Figure 2

  2. Because of the error, I decided to elapse time one at a time instead of on both ends of the rod. I moved a node a little bit, then calculated the angular acceleration on each of the rods to calculate their new angular positions. Figure 3

  3. I then realized that let's say the previous nodes had a sudden movement, then the net acceleration on that node would be affected, so I calculated the net acceleration on each node then did vector addition for the previous nodes up to the current node and then did the same rod calculation as 1) Figure 4

I'm not sure what I'm doing wrong: here's my animation so far (for 2 which is my most updated version). It tends to work better with more limited nodes probably meaning that it's the more complicated algorithms messing up, or I'm just bad at coding https://i.stack.imgur.com/pvCoI.jpg

Qmechanic
  • 201,751
User
  • 101
  • This problem is best approached using Lagrangians. For 2 penduli, the equation of motions are given in here: https://scienceworld.wolfram.com/physics/DoublePendulum.html. – ZeroTheHero Jun 05 '22 at 03:08
  • 1
    I don't understand why you are assuming $F_{\text{net}}$ on each mass (and hence the acceleration) is perpendicular to the bar connected to it. This isn't true even for a simple pendulum with only one mass: rotations involve a radial component of acceleration (centripetal acceleration). Not to mention that most of the masses will have two bars connected to them, why would $F_{\text{net}}$ be perpendicular to one but not the other? I recommend starting with the simple pendulum problem: first solve it by hand, then simulate it. – Puk Jun 05 '22 at 03:24
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jun 05 '22 at 05:03
  • @ZeroTheHero Sorry I’m a bit confused about what a Lagrangian is, I did some research and I think I understand it a little better, but does this formulation generalize to an N-Pendulum. Also, what am I supposed to do with the second order differentials? Is there an algorithm to solve them for a computer? Kind of like a Riemann sum? Could you please explain this to me? Thank you! – User Jun 06 '22 at 05:08
  • @ZeroTheHero Also, could you please explain all of this to me in simple terms; I’m not out of high school yet and answers like https://scicomp.stackexchange.com/questions/34304/solving-coupled-differential-equations-in-python-2nd-order, don’t make any sense to me. I don’t know what a geodesic is nor what Schwarzchield geometry is – User Jun 06 '22 at 05:16
  • @User The Lagrangian is a single scalar (as opposed to vector) function given by the difference between the kinetic and potential energy, and from which one can extract the equation of motion for every particle in the system. It is "simpler" because it's a scalar so you don't have to worry about directions of forces and the constraints (such as length of the penduli) are automatically baked in. see also https://diego.assencio.com/?index=1500c66ae7ab27bb0106467c68feebc6 for the solution to the 2-pendulum case. – ZeroTheHero Jun 06 '22 at 12:25
  • @User Doing this for N penduli using Newton is not a very efficient approach, as you are now experiencing. As to why the Lagrangian is the difference $T-V$, the elegant answer requires high-power math. You can always check this answer: https://physics.stackexchange.com/a/86009/36194 or this answer https://physics.stackexchange.com/a/86174/36194 – ZeroTheHero Jun 06 '22 at 12:25

0 Answers0