I want to simulate a a double pendulum in geometry nodes.

I'm using this derivation enter image description here

from this site.

However, the simulation is just a bit off. Either it will eventually just start spinning around in a circle

enter image description here

Or it dampens quickly and slows down

enter image description here

I've tried adjusting the timestep (g) but even with small time steps it runs into this behavior.

Essentially my logic tree is as follows.

  • compute change in angular velocity w1' and w2'
  • add this to the current angular velocity w1 and w2
  • add this to the current angles theta1 and theta2
  • Do this four times for the runge-kutta
  • Weight the results for RK
  • Send those values to the next sim step

I don't know if I missed a single value somewhere that messed it up but I would love to see if some else can crack this for me.

Here is the file if you wanna take a look at the labeled spaghetti

enter image description here

  • $\begingroup$ Have you tested the maths is correct? I would calculate outputs for some inputs outside of geonodes first and then test in geonodes if I get the same values. Considering you ask for double pendulum implementation, that seems to already be done here so it's a duplicate then? $\endgroup$ Jan 15 at 15:54
  • $\begingroup$ @MarkusvonBroady I'll give the maths a check tomorrow. Also that example you posted is not in geometry nodes. $\endgroup$
    – TheJeran
    Jan 15 at 18:01
  • 1
    $\begingroup$ Beware that g is the gravitational constant, not the time step. $\endgroup$ Jan 18 at 20:24

2 Answers 2


Found the issue. At the advice of @Markus von Broady I checked the outputs against raw caluclations of each section and found a divergence. I then kept narrowing it down until I found my error.

I accidentally had m2 plugged into the multiplier rather than the addendum section on my w2 setup.

enter image description here

Please enjoy the double pendulum

enter image description here

  • 2
    $\begingroup$ Cool animation! Thanks for sharing the setup, there's a guy on Youtube shorts that makes some simple simulations, and one of them was like a 1000 or 10000 pendulums, that start at almost the same position, and with time the pendulums desynchronize (bifurcate?) completely, showing chaos. Maybe you could monetize your skill by also making videos... BTW the path you made using geonodes, canvas or something else? $\endgroup$ Jan 18 at 15:38
  • $\begingroup$ The path is geonodes. It uses a simulation zone. I spawn a curve on the on the second pendulum with X points. ( I think in this simulation its 250) and for each frame I set the index[0] point to the position of the second pendulum and every other point to have the position of the index in front of it from last frame. I then use the factor of the curve and the velocity to color and scale the curve. I already do make videos in my spare time ;) but not blender tutorials. However, I do have a second channel I've wanted to start. Maybe I will. $\endgroup$
    – TheJeran
    Jan 18 at 20:19
  • $\begingroup$ Happy you found the error. I did some additional tests and it appears that RK4 is stable in this case for dt=1, while RK1 is not ; it requires a smaller time step. This could explain why adjusting dt is not require in your simulation. $\endgroup$ Jan 18 at 20:21

(Using Blender 3.6.5)

Numerical unstable behaviour seems related to a confusion between $g$, the gravitational constant as defined in the referenced page, and the time step $dt$ of Runge-Kutta schemes. As it is, a parameter in the GeometryNodes graph such as $dt$ controlling stability is missing.
Following is a proposal not as sophisticated as what you try to do, but it could be a starting point to achieve your goal. Instead of RK4, it relies on a much simpler integration scheme in time named Euler method, sometime labelled RK1. Using your notations, advancing the solution from frame/time $t^n$ to frame/time $t^{n+1}$, it reads: $$\omega' = \frac{d\omega}{dt} = \frac{d^2 \theta}{dt^2}$$ $$\omega^{n+1} = \omega^{n} + \omega' \times dt$$ $$\theta^{n+1} = \theta^{n} + \omega^{n+1} \times dt$$ The associated graph, coded in the original NodeGroup K1, is: GN graph for RK1 It is called only one time, instead of four times in the original graph, in the Simulation Zone (not shown). NB: The value of $dt$ is hard-coded in an Input/Constant/Value node; it should come from the Group Input node for flexibility...
This setup is illustrated with the same length and mass for both pendulum masses, put at the same small angle at $t=0$. As expected, it behaves like a single stable pendulum.

Resources: (This file includes the correction published by TheJeran)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .