Vibe Coding Home

Simulation of coupled Pendulums and Emergent Synchronization

This software was largely created by AI Vibe Coding
Created by YouMinds
This simulation beautifully illustrates the synchronization phenomenon first observed by Christiaan Huygens in the 17th century. Huygens discovered that two pendulum clocks mounted on the same beam would eventually synchronize their swings due to subtle forces transferred through the shared structure.

Pendulum laboratory

Pendulums hang from a movable ceiling that is damped by a spring. The moving ceiling serves as the medium through which the pendulums exchange energy, gradually leading to emergent synchronization.

Global Controls

5
20
0.50
0.000
0.0
10.0
Specify the number of pendulums and other properties. Use the Damping Factor and Kick Strength to simulate a clockwork pendulum. Use the Time Scale to speed up the simulation.
Use the mouse to drag the pendulum simulation horizontally.

Motion and phase space

Phase Space Representation of Pendulum Motion
Graph showing angular position vs. angular velocity over time.
Temporal Evolution of Pendulum Angle
Graph depicting angular displacement as a function of time.
Show
Select a pendulum number or the ceiling to see the corresponding time course of movement and the phase plot.

Individual Pendulum Controls

Set individual parameters for the pendulums.
What is a emergent synchronization anyway
Emergent synchronization is the phenomenon where independent oscillators—such as pendulums, neurons, fireflies, or even planets—spontaneously synchronize their motion without a direct controlling force. Instead of external coordination, the synchronization arises naturally due to weak interactions between the elements.
Emergent synchronization demonstrates how order can arise from chaos. It is a fundamental principle in physics, biology, and even human behavior (like applause in a concert hall aligning naturally). This phenomenon occurs when individual components, initially acting independently, begin to coordinate their actions through local interactions, leading to large-scale order without a central control mechanism.
Human behavior also reflects emergent synchronization in social dynamics. Beyond synchronized applause, crowds walking in rhythm, collective movements in protests, or dancers naturally falling into step with one another all reveal the spontaneous alignment of independent actions. On a larger scale, financial markets, cultural trends, and even traffic flow demonstrate how synchronization can emerge from decentralized interactions, leading to structured and predictable patterns.
Understanding emergent synchronization provides insights into how complexity can self-organize, shaping natural and societal systems in ways that are both fascinating and fundamental to our world.
How does it work?
The following steps outline how this synchronization unfolds—beginning with independent rhythms, interacting through a shared medium, and gradually adjusting until unity emerges. The beauty of this process lies in its self-organizing nature, where order arises purely through local influences, rather than an external force dictating the outcome.
What is a phase space?
Phase space is a way of representing a system’s state by plotting all possible values of position and momentum (or other relevant variables). Each point in phase space corresponds to a possible state of the system. It’s especially useful in mechanics and dynamical systems to visualize how a system evolves over time.
The trajectory shows how the system evolves over time. For a simple pendulum without external forces, the phase space trajectory forms closed loops, indicating periodic motion.
How was it built
This software was created using Vibe Coding by a Large Language Model LLM / chatbot and reworked in look & feel.
Some features had to be implemented manually and corrections and improvements had to be made.
The following Vibe Coding prompts were used on DeepSeek:
"10 pendulums are attached to a ceiling. The ceiling can move freely horizontally. When the pendulums have equal length and mass but different starting positions, would the pendulums eventually sync due to the energy exchange via the ceiling ?"
"can you create the necessary math formulas using differential equations, to describe this scenario. Ignore damping, friction and loss."
"Also create the differential that describes the movement of the ceiling"
"create a single page html with javascript and a canvas. On the canvas show a simulation of 10 pendulums with a circle mass. Let the mass and length of each pendulum be individually configurable with a slider. Initialize with equal values for length and mass, but random starting positions. Each pendulum is attached to a ceiling. Spread the pendulums evenly. The ceiling can move horizontally. The ceiling mass is configurable with a slider. Add a button to reset the simulation. Compute and display all the movements of the pendulums and the ceiling based on the differential equations. Ignore friction loss and damping."
"The simulation is rather slow. Add sliders for the mass and length of each pendulum individually. Add a drag function that allows to drag the view horizontally."
"set the max time scale to 20. Do not limit the horizontally drag function. Do not use random values for the initial mass and length of the pendulums, only for the starting positions. Smooth the movement of the ceiling with a horizontal spring. Add a slider to control the spring strength. Compute all the physics with the spring impact. The spring has no loss and will preserve energy. "
"Add a button that toggles a clock mode. In clock mode each pendulum will receive a kick that accelerates the movement in the current direction when it swings through the vertical position. Add a slider to control the kick strength. The energy that is added to the pendulum by a kick is invers proportional to the current energy of the pendulum. So a fast pendulum will receive a small kick. Add a slider in the global controls that controls a damping factor for all the pendulums."
"Add a radio button for each pendulum and for the ceiling. When the radio is active draw two curves, one a motion curve over time and second a phase room for that pendulum or the ceiling."
"make sure to move the cross in the phase room so it always reflects the current center of the curve. Also add a slider with integer values from 1 to 10 that controls the number of pendulums and recreates the simulation."