Animate a Pendulum & Phase Space | QuantumSketch

Animate a pendulum alongside its phase-space portrait: the swing on the left, a point tracing angle vs angular velocity on the right, revealing the orbit.

By Shihab
2 min read

Animate a pendulum next to its phase-space portrait: the physical swing on the left, and a point tracing angle vs angular velocity on the right. Together they turn invisible "state" into a visible orbit.

Two views of the same motion

  • Left โ€” the swing. A rod and bob oscillate under gravity.
  • Right โ€” phase space. Plot a point at (angle ฮธ, angular velocity ฯ‰). As the pendulum swings, the point traces a closed loop.

Reading the phase portrait

| Pendulum moment | Phase-space point | |---|---| | Bottom of swing | max speed, ฮธ = 0 | | Turning point | speed = 0, ฮธ extreme | | One full period | one closed loop |

| Energy | Trajectory | |---|---| | Small swing | near-circular loop | | Large swing | stretched loop | | Over the top | runs off โ€” spinning, not swinging |

That boundary between "swinging" and "spinning" (the separatrix) is the payoff โ€” invisible in the physical view, obvious in phase space.

Add damping

With friction, the loop spirals inward to the center (rest) โ€” a clean visual for energy loss.

Manim building blocks

A Line rod + Dot bob updated by integrating the pendulum ODE, and a second Axes with a traced phase point. Because Manim computes the physics, the orbit is exact โ€” see Why Manim Beats Generative Video.

The prompt

"Show a swinging pendulum on the left and a point tracing angle vs angular velocity on the right, drawing the closed phase-space orbit; then add damping so it spirals in."

โ†’ Render it at quantumsketch.app.


Written by Shihab Shahriar Antor ยท Shahriar Labs

FAQ

Q.What is a phase-space portrait of a pendulum?

A phase-space portrait plots the pendulum's state as a single point whose coordinates are its angle and its angular velocity, rather than showing position over time. As the pendulum swings, that point traces a closed loop: at the bottom of the swing speed is maximum and angle is zero, while at the turning points speed is zero and angle is extreme. Small swings trace near-circular loops; larger swings trace stretched loops; if the pendulum has enough energy to go over the top, the trajectory stops looping and runs off, showing the boundary between swinging and spinning. Animating the bob and its phase point together links the physical motion to the abstract state space.

Q.How can I animate a pendulum and its phase space side by side?

Describe it as a prompt: 'Show a swinging pendulum on the left and a point tracing angle versus angular velocity on the right, drawing the closed phase-space orbit.' QuantumSketch renders it as a narrated Manim animation. Manim can integrate the pendulum's motion, draw the swinging rod and bob, and simultaneously plot and trace the phase-space point on a second set of axes, so the two views stay in sync. You choose the starting angle and whether to show damping.

Tags:#physics#animation#math
S

Shihab Shahriar

AI Engineer & Founder of Shahriar Labs. Exploring the intersection of design, cognition, and machine learning.