Double pendulum plot!

Scroll down fully to view the simulation

You may have to wait a bit for the pendulums to diverge before the lines start appearing

Open DevTools (f12) to view time taken for each frame (miliseconds). Each frame will print one line.

Press S to save

Double click to view the pendulum in a new tab

Please scroll down a bit and enable RK4 then click "update parameters"

Also, switching tabs may cause the simulation to show random stuff with DeltaTime

Source code:

https://github.com/itzmetanjim/double-pendulum

You can find many extra screenshots and images there.

Presets:

You should go with 600 or 300px. Note that reducing the resolution will increase the speed in n^2 rate.
This means 300px is 4x faster than 600px, and 100px is 36x faster than 600px.

Parameters:

Canvas size in pixels:

Reduce to make plot faster. If you enabled deltaTime, reducing this will make it more accurate (for the plotted values)

Damping factor:

0 to 1, example: 0.999. The velocities get multiplied by this every tick

DeltaTime enabled?

If true, the simulation will use deltatime. This may make the viewing experience better, but it also may make it less accurate for laggier PCs.

Time step:

The time step. If deltaTime is enabled it will be multiplied by deltatime.

Use RK4:

If true, this will use a more accurate 4th order Runge Kutta simulation (RK4).

If false, it will use the simpler and faster but less accurate Euler simulation.

RK4 is way slower than Eulerian, but it is more accurate.There are minor differences between the outputs, especially in the top-right and bottom-left corners.

DeltaTime may make RK4 less accurate than Eulerian if enabled.

It's recommended to try RK4 first.

Physical Parameters:

Gravity (g):

Gravitational acceleration. Default: 10

Length 1 (l1):

Length of the top pendulum arm. Default: 100

Length 2 (l2):

Length of the bottom pendulum arm. Default: 100

Mass 1 (m1):

Mass of the top pendulum bob. Default: 10

Mass 2 (m2):

Mass of the bottom pendulum bob. Default: 10

Initial Angular Velocity 1 (a1_v):

Initial angular velocity of the top pendulum. Default: 0

Initial Angular Velocity 2 (a2_v):

Initial angular velocity of the bottom pendulum. Default: 0

Parameter Space:

Space Type:

What parameter to vary across the plot. Options: angle, velocity, momentum, mass, length. Default: angle

Initial Angle 1 (for non-angle spaces):

Initial angle for the top pendulum when not in angle-space. Default: π/2 (1.57)

Initial Angle 2 (for non-angle spaces):

Initial angle for the bottom pendulum when not in angle-space. Default: π/2 (1.57)

Scale Min:

Minimum value for the parameter space. Default: -π for angle, appropriate values for other spaces

Scale Max:

Maximum value for the parameter space. Default: π for angle, appropriate values for other spaces

Color channel types (red, green, blue, alpha):

Use to modify the plot variables

Color channel types can be specified to generate custom plots

 

After (a lot of) some time, the result should approach something like this:

Click here for image

You will see that most stable pendulums are in this big region near the center as well as smaller "islands of stability" near it that are disjoint from the main one

For a video explaining what this is (along with more interesting stuff and more graphs), check this out:

Video link

Color channel string info

The color channel types string should be in the format: [red],[green],[blue],[alpha]

where [red],[green],[blue],[alpha] are in:

You can also specify the first element to be hsv.
In that case the subsequent elements will be interpreted as hue(0-360),saturation(0-100) and value/brightness(0-100). The scaling will happen in the same way.

Parameter Space Info

The Space Type parameter determines what varies across the plot:

Use Scale Min and Scale Max to customize the range for any space type.


Periodic save period, 0 or "disable" to disable. This does not reload the window.



You may have to wait a bit for the pendulums to diverge before the lines start appearing

Press S to save
Double click to view the pendulum in a new tab
Open DevTools (f12) to view time taken for each frame (miliseconds). Each frame will print one line.

Plot

FPS: ..., recording:use the recording widget that popped up, these buttons may also work