Physics Simulations

Interactive physics simulations with real-time Canvas animation. Includes projectile motion, simple & double pendulum, wave interference, electric field lines, and force vector composition. Also: Mechanics | Vector Calculator | Waves.
Projectile Motion: Trajectory with real-time flight. x(t)=v0·cosθ·t, y(t)=h0+v0·sinθ·t-½gt². Range R=v0²sin(2θ)/g (h0=0). Max height H=h0+v0²sin²θ/(2g).
What are these physics simulations?

Five real-time Canvas animations show how the equations of physics look in motion: the trajectory of a ball under gravity, the swing of a single pendulum and the chaotic dance of a double pendulum, the interference pattern of two circular waves, the field lines around point charges, and the polygon composition of three forces. The math is identical to the formulas elsewhere on the site; the Canvas shows you what the solution looks like in time and space. Each panel takes a few inputs and produces either a numerical readout (projectile, force composition, e-field) or a visual one (pendulum, wave interference). Together they form a small lab in your browser where you can vary a parameter and watch the result change instantly.

Simulations are equations made visible: the same algebra, the same constants, the same boundary conditions — rendered as an animation that lets you vary parameters and watch the result change. Use them to build intuition: change the launch angle and watch the range peak at 45°, change the charge sign and watch field lines reverse, change the wavelength and watch the interference pattern shrink or spread.
Projectile motion — the canonical parabola

A ball launched with initial speed v0 at angle θ from height h0 follows the parametric equations x(t) = v0 cosθ · t and y(t) = h0 + v0 sinθ · t − ½g t². The Canvas traces the trajectory as the ball flies and reports the final range, flight time, and max height. The default sample (v0 = 25 m/s, θ = 45°, h0 = 0, Earth g = 9.81 m/s²) gives flight time ≈ 3.604 s, range ≈ 63.70 m, and max height ≈ 15.929 m. Switch to the Moon preset (g = 1.62) and the same launch reaches ≈ 385.8 m in ≈ 21.82 s — the same parabola, six times longer and farther, exactly what makes lunar sports so absurd and what astronaut Alan Shepard exploited with his makeshift six-iron. The Canvas redraws the path with a red dot tracking the ball position and labels the range and max height directly on the diagram.

Pendulum — simple harmonic and chaotic

A simple pendulum with length L released from angle θ obeys θ″(t) = −(g/L) sinθ, integrated here by semi-implicit Euler. For small amplitudes (sinθ ≈ θ) the motion is simple harmonic with period T = 2π√(L/g); the default L = 1.5 m on Earth gives T ≈ 2.458 s. For larger amplitudes the period grows slightly because sinθ is no longer a good linear approximation — a 60° swing is about 7% slower than a 5° swing of the same length. The double pendulum is a different beast: two rigid links with masses at the joints, governed by coupled nonlinear equations, integrated the same way but exhibiting chaos. Tiny differences in the initial angle lead to wildly different trajectories within a few cycles — the hallmark of deterministic chaos, which is why double pendulums are the textbook example of a chaotic mechanical system. Switch from "Simple" to "Double" in the dropdown and the second rod appears, taking initial angle θ2; press Start and watch the swing pattern diverge unpredictably. The single-pendulum sim also damps each frame (factor 0.9995), the way a real pendulum loses energy to air drag and pivot friction.

Wave interference — two-source superposition

Two point sources emit circular waves of the same wavelength λ; at every point in the plane, the resulting disturbance is the sum of the two. Where the two crests arrive in phase, the amplitude doubles (constructive interference); where a crest from one meets a trough from the other, they cancel (destructive interference). The condition for constructive interference is r1 − r2 = mλ for integer m; for destructive it is r1 − r2 = (m + ½)λ. The Canvas paints an intensity map (bright = high amplitude, dark = cancellation) and overlays the nodal lines where r1 − r2 = mλ (with the dashed-line option). The default separation (120 px = 3λ) shows clear alternating bright and dark bands along the perpendicular bisector — the same pattern that makes the bright and dark fringes in Thomas Young's double-slit experiment and produces the colored bands of light reflecting off an oil film.

Electric field lines — density encodes strength

The electric field around a point charge Q is a radial vector of magnitude E = kQ/r²; for two charges the field at any point is the vector sum Etotal = E1 + E2. The Canvas traces 16 field lines from the source region using an Euler-method step of size 4 px in the direction of the local field. Lines emerge from positive charges (Q > 0) and terminate on negative ones (Q < 0); in the default sample (Q1 = +5, Q2 = −3, with |Q1·Q2| = 15), the pattern shows lines leaving the red + charge on the left, curving outward, and most of them ending on the blue − charge on the right, with a few escaping to infinity (because the magnitudes are unequal). Field-line density is proportional to field strength: tightly packed lines indicate a strong field, sparse lines indicate a weak one. Reversing both signs reverses the line directions without changing the geometry.

Force composition — the polygon method

When multiple forces act on an object, the resultant is their vector sum, not their scalar sum. The polygon (or head-to-tail) method places each force vector tip-to-tail starting from the origin; the resultant R is the vector from the origin to the final tip. Component-wise: Rx = ΣFi cosθi, Ry = ΣFi sinθi, |R| = √(Rx² + Ry²), and θR = arctan(Ry/Rx). The Canvas draws each force as a colored arrow (F1 red, F2 blue, F3 green) from the origin, then a dashed purple line from origin to the final tip showing the resultant, plus light gray polygon lines tracing the path tip-to-tail. The default sample (F1 = 30 N at 0°, F2 = 25 N at 60°, F3 = 15 N at 150°) yields Rx ≈ 29.51 N, Ry ≈ 29.15 N, |R| ≈ 41.48 N, and θR ≈ 44.65° — a magnitude larger than any single input force because the directions partially reinforce.

Common misconceptions
  • The Canvas shows the actual physics, not a sketch. Every frame is computed from the underlying equation (Euler integration for pendulums, superposition for waves, vector sum for forces). Change the inputs and you change the math; the animation is a direct numerical visualization.
  • A pendulum's period depends on its amplitude. For small amplitudes (less than ~15°), the period is nearly amplitude-independent and equals T = 2π√(L/g). For larger amplitudes the period grows noticeably — a 90° swing takes about 18% longer than the small-angle formula predicts. The "seconds pendulum" of a grandfather clock is designed for a small swing precisely to keep its period rock-steady.
  • Electric field lines are real. They are a visualization of the field, not physical strings. The actual electric field is a vector at every point in space; lines just connect points where the field is tangent in a continuous way. You cannot "grab" a field line.
  • The polygon and parallelogram methods give different answers. They give the same resultant. The parallelogram method works for two forces; the polygon method extends naturally to any number. Both are equivalent applications of vector addition.

Related tools: Mechanics for the numerical kinematic formulas, Vector Calculator for component decomposition and the dot/cross product, Waves & Oscillations for the full traveling-wave equations, Electricity & Circuits for the current/voltage counterparts, and Optics & Light for the optical version of wave interference (Young's double-slit).