SPD - Stochastic Phase Dynamics

Visualizations

Node Angles

Angular Velocity

ω₁
ω₂

ω₁: 0.00 rad/s

ω₂: 0.00 rad/s

System Energy (J)

KE 0.00

PE 0.00

Etotal 0.00

Avg E 0.00

ΔE 0.00 %

Coefficient of variation (last ~1s)

Energy Detail (J)

KE₁ 0.00

KE₂ 0.00

PE₁ 0.00

PE₂ 0.00

Forces on Bob 1 (N)

Fg,x 0.00

Fg,y 0.00

Fd,x 0.00

Fd,y 0.00

FB,x 0.00

FB,y 0.00

FW,x 0.00

FW,y 0.00

Forces on Bob 2 (N)

Fg,x 0.00

Fg,y 0.00

Fd,x 0.00

Fd,y 0.00

FB,x 0.00

FB,y 0.00

FW,x 0.00

FW,y 0.00

Angular Velocity History

Energy History

Energy Stability

Simulation Canvas

Controls & Parameters

Simulation Control
Updates per second for physics calculations. Higher is more accurate but slower. (e.g., 120)
Frames per second for updating the canvas visuals. (e.g., 60)
Initial State (Defaults on Reset)
Default initial angle for Bob 1. Vertical down is 0. (e.g., 120)
Default initial angle for Bob 2. Vertical down is 0. (e.g., -30)
Calculated default X position of Bob 1
Calculated default Y position of Bob 1 (relative to pivot)
Calculated default X position of Bob 2
Calculated default Y position of Bob 2 (relative to pivot)
Current angle of Bob 1. Can be set by dragging when paused.
Current angle of Bob 2. Can be set by dragging when paused.
Pendulum Parameters
Length of the first rod. (e.g., 1.0)
Length of the second rod. (e.g., 1.0)
Mass of the first bob (at end of L1). (e.g., 1.0)
Mass of the second bob (at end of L2). (e.g., 1.0)
Acceleration due to gravity. (e.g., 9.81)
Frictional drag coefficient for Bob 1 (proportional to velocity). 0 = no damping. (e.g., 0.01)
Frictional drag coefficient for Bob 2. (e.g., 0.01)
Visualization Settings
Number of points in the trail of Bob 1. (e.g., 500)
Number of points in the trail of Bob 2. (e.g., 500)
Scene Forces (Optional)
Magnitude of a constant wind force applied to both bobs. (e.g., 0.5)
Direction of the wind force (0=right, 90=up). (e.g., 0)
Electric charge of Bob 1 (for Lorentz force). (e.g., 1.0)
Electric charge of Bob 2. (e.g., -1.0)
Strength of a uniform magnetic field perpendicular to the plane (z-axis). >0 is into page (⊗), <0 is out of page (⊙). (e.g., 0.5)
Applies uniform wind force and/or Lorentz force (simplified).
Data Recording & Export
Maximum duration of simulation data to record. Large values use more memory. (e.g., 60) Est. Size: 0.0 MB
Ready to record. Press Start.

Equations Used

Coordinates:

x1 = L1 sin θ1
y1 = L1 cos θ1
x2 = x1 + L2 sin θ2 = L1 sin θ1 + L2 sin θ2
y2 = y1 + L2 cos θ2 = L1 cos θ1 + L2 cos θ2

Lagrangian (ℒ = T − V):

T = ½ m1 (L1 θ̇1)2 + ½ m2 [(L1 θ̇1)2 + (L2 θ̇2)2 + 2L1L2 θ̇1 θ̇2 cos(θ1 − θ2)]
V = −m1 g L1 cos θ1 − m2 g (L1 cos θ1 + L2 cos θ2)

Equations of Motion (from Euler-Lagrange: d/dt(∂ℒ/∂θ̇i) − ∂ℒ/∂θi = Qi):

M11   M12
M21   M22
θ̈1
θ̈2
=
F1
F2
+
Q1,ext
Q2,ext
Where M is the mass matrix, F contains gravitational and centrifugal/Coriolis terms, and Qext are external generalized forces (damping, wind, Lorentz).
θ̈1 = [−g(2m1+m2)sin θ1 − m2g sin(θ1−2θ2) − 2sin(θ1−θ2)m2(L2θ̇22 + L1θ̇12cos(θ1−θ2))] / [L1(2m1+m2−m2cos(2θ1−2θ2))] + Q′1

θ̈2 = [2sin(θ1−θ2)(L1θ̇12(m1+m2)+g(m1+m2)cos θ1+L2m2θ̇22cos(θ1−θ2))] / [L2(2m1+m2−m2cos(2θ1−2θ2))] + Q′2
Q′i represents the effect of external torques after inverting the mass matrix.

External Forces (Cartesian Components & Generalized Torques Qi):

Fg,j = (0, −mj g)
Fd,j = −dj vj
Fwind = (FW cos φW, FW sin φW)
FB,j = qj (vj × B) = qj (vj,y Bz, −vj,x Bz)
Qi,ext = Σj=1,2 (rj × (Fd,j + Fwind + FB,j))z

Total Energy (E = T + V):

E = Kinetic Energy (T) + Potential Energy (V)

Numerical Integration (Symplectic Semi-Implicit Euler):

θ̇n+½ = θ̇n + (h/2)θ̈(θn, θ̇n)
θn+1 = θn + h θ̇n+½
θ̇n+1 = θ̇n+½ + (h/2)θ̈(θn+1, θ̇n+½)

Energy Conservation: This simulation uses a symplectic (energy-preserving) integrator that maintains the Hamiltonian structure of the system. In an ideal system with no damping (d1=d2=0) and no external forces (wind/Lorentz forces = 0), the total mechanical energy E = T + V remains nearly constant over long simulations. Unlike standard explicit methods, symplectic integrators prevent long-term energy drift by preserving the phase-space volume. The "Energy Variation" metric reflects small bounded oscillations in energy (not cumulative drift) or actual energy changes if non-conservative forces are active. For the default parameters (L1=L2=1, m1=m2=1, g=9.80665, θ1=120°, θ2=−30°, θ̇1=θ̇2=0), the initial total energy is approximately 1.314 Joules.