diff --git a/IDEAS.md b/IDEAS.md index d98c118..47993e3 100644 --- a/IDEAS.md +++ b/IDEAS.md @@ -76,6 +76,98 @@ Working scratch list. Same format as the NLOS post: vanilla JS, 2D canvas, scene - **Sun noise as an antenna check.** Point a dish at cold sky, then drag it onto the sun. Y-factor in dB updates live. Slider for dish size and frequency derives system noise temperature from the result. Calibration without a noise source. - **Noise temperature and noise figure, two views of one thing.** A receiver chain with a slider that toggles the unit between K and dB. Friis recomputes in both. Toss in a lossy feedline ahead of the LNA and watch the system noise temperature jump in a way the noise figure number understates. +## Signals, systems, and information theory + +- **The sampling theorem, aliased in front of you.** A continuous sine wave on top, a row of sample ticks below, reconstructed signal at the bottom. Slider for sample rate. Cross below 2*f and watch the reconstruction turn into a different, slower sine pretending to be the original. The point at which a CD sampling rate stops being arbitrary and becomes a physics statement. +- **Convolution, drawn two ways.** One signal slides across another, pointwise product summed at each offset. Payoff scene: the same operation in the frequency domain, where it collapses to a multiplication. Reader sees why "filter" and "impulse response" are the same object. +- **The Fourier transform, built from sines.** Start with a square wave. Add harmonics one at a time with a slider. The Gibbs overshoot appears and refuses to go away no matter how many terms you add. Second scene flips to a single narrow pulse in time and its flat spectrum, showing the time/frequency uncertainty trade. +- **Matched filter, against noise.** A known pulse buried in Gaussian noise. Slider for SNR. On one side the raw signal is invisible; on the other the matched filter output has a sharp peak exactly where the pulse lives. The reason GPS and radar work at negative SNR stops being voodoo. +- **The FFT butterfly.** N samples, a lattice of butterfly operations, twiddle factors labeled. Step through a size-8 FFT one stage at a time and watch N*log(N) happen instead of N squared. The single piece of math that most of modern signal processing sits on top of. +- **Shannon capacity.** C = B * log2(1 + S/N). Two sliders for bandwidth and SNR. The log curve is flatter than people expect. Show how far you can push bandwidth vs how far you can push SNR, and where each one hits diminishing returns. Plot an existing mode (FT8, QPSK, 64-QAM) against the Shannon limit to see how much room is left. +- **Bit error rate vs Eb/N0, for a few modulations.** Curves for BPSK, QPSK, 16-QAM, 64-QAM. Slider shifts Eb/N0 and a live constellation shows dots dispersing through the decision boundaries. Error-correction coding as a horizontal shift of the whole curve to the left. +- **Autocorrelation and cross-correlation.** Noisy signal on top. Its autocorrelation reveals the periodic piece hidden inside. Second scene: two copies of a PRN code, slide one against the other, correlation peak narrow and tall. The trick GPS uses to pick one satellite out of many on the same frequency. +- **Quantization noise.** An analog sine feeding an N-bit ADC. Slider for N. The reconstructed signal shows steps; the residual is white-ish noise. Spectrum plot shows the noise floor rising by 6 dB for every bit you drop. Dithering appears in a second scene and un-correlates the quantization from the signal. +- **The Z-transform and the unit circle.** Drag poles and zeros around the z-plane. Frequency response magnitude is the distance from the unit circle. Poles outside the circle blow up; poles inside, bounded. FIR vs IIR stops being a taxonomy and becomes "does your filter have any poles that aren't at the origin?". + +## EM and wave physics + +- **Maxwell, one equation at a time.** Four scenes, one per equation. Gauss with a charge surrounded by flux lines; Gauss for magnetism with none escaping; Faraday with a changing B-field inducing a loop voltage; Ampere-Maxwell with a current plus a changing E-field producing B. Final scene stacks all four to produce a self-propagating wave. +- **Plane wave versus spherical wave.** A point source radiates a spherical wave in one pane; a far-field observer sees it as locally planar in another. Slider for distance from source. The "when is it OK to treat this as a plane wave?" question becomes a number instead of a hunch. +- **Polarization, linear through elliptical.** Two orthogonal sinusoids with adjustable amplitude and phase delay. The resulting E-field vector traces a line, ellipse, or circle depending on the sliders. A receiver with a fixed linear antenna shows its extracted amplitude in real time. +- **Near field versus far field.** An antenna with its reactive near field, radiating near field, and far field zones shaded. Slider for observation distance. At what point does the pattern stop changing shape and only change amplitude? Spoiler: about 2*D^2/lambda from the aperture. +- **Poynting vector and where power flows.** A coaxial cable carrying DC and a coax carrying RF. Field lines, current, and the Poynting vector direction rendered. The surprise that energy flows in the dielectric, not the copper, demonstrated without words. +- **Skin depth as a function of frequency.** A conductor cross-section. Current density falls off exponentially from the surface. Slider for frequency and material. At 1 GHz in copper the skin depth is a couple of micrometers; at 50 Hz in iron it is centimeters. Explains why Litz wire exists and why silver-plating an audio connector is witchcraft. +- **Standing waves and SWR, visualized on a line.** A transmission line with adjustable load impedance. Forward wave, reflected wave, and their sum rendered as animated sinusoids. The voltage maxima and minima settle into the standing-wave pattern; SWR comes out as the ratio of max to min. The Smith chart becomes less mysterious once this has clicked. +- **Snell's law and total internal reflection.** Two media with adjustable refractive indices. Drag the incident ray angle. Watch the refracted ray bend; push past the critical angle and watch it disappear entirely. The physics underneath both fiber optics and moonrise mirage. +- **Reciprocity.** An antenna pattern used for transmit, then used for receive. The gain pattern is the same both ways. Slider animates between modes. Explains why a great receive antenna is also a great transmit antenna, and vice versa. +- **Radiation resistance and antenna efficiency.** A dipole with adjustable length. Input impedance, radiation resistance, loss resistance, efficiency. Shorten the dipole: loss resistance dominates and efficiency tanks. This is why a mobile HF whip hates 80 meters. + +## Semiconductors, from physics up + +- **The PN junction forming.** Two doped regions being brought into contact. Electrons and holes diffuse across, leave behind charged dopant atoms, create a depletion region and a built-in potential. Apply forward bias and watch the depletion region shrink; reverse bias and watch it grow. Diode I-V curve falls out. +- **A BJT in three regions.** A cross-section of an NPN with adjustable base current. Watch carriers injected from emitter across the thin base and swept into the collector. Slider moves the device from cutoff to active to saturation. The current-gain ratio beta emerges as "what fraction of emitter carriers make it to the collector." +- **A MOSFET forming a channel.** NMOS cross-section. Slider for gate voltage. Below threshold, nothing. Cross Vt and an inversion layer appears under the gate. Crank Vds and watch the channel pinch off at the drain end; saturation current stops depending on Vds. The place where the square-law equations actually come from. +- **Band diagrams, the short version.** Conduction and valence bands plotted through a device. Add a PN junction and the bands tilt. Apply a bias and they tilt more. The Fermi level stays level at equilibrium, and offsets from each other at bias. Every semiconductor behavior comes out of this picture if you read it right. + +## Circuits, the foundations + +- **Kirchhoff, on a circuit you actually made.** A real schematic with a few loops and nodes. Solve it by KVL, then by KCL, then by superposition. Each method animated as a separate pass over the same circuit. Same answer, three ways, and you get to pick the shortest one for your specific case. +- **Thevenin and Norton, interchangeable.** A messy network of sources and resistors. Collapse it to a Thevenin source and series resistor. Second scene converts to Norton. Slider changes a load; current and voltage at the load match in all three representations. +- **RC time constant, charging and discharging.** A capacitor through a resistor from a step source. Slider for R and C. Voltage rises as 1 - e^(-t/tau); discharge falls as e^(-t/tau). Tau drawn on the curve as the 63% point. The same math that shows up in every decoupling, debouncing, and low-pass filter problem. +- **RLC transient response.** Step into a series RLC. Underdamped rings, critically damped settles in one shot, overdamped crawls in. Slider for damping ratio. Shows up anywhere a system has both storage and resistance, which is everywhere. +- **Maximum power transfer.** A source with internal resistance Rs driving a load Rl. Slider for Rl. Power delivered to the load peaks exactly at Rl = Rs. Half the total power dissipates in Rs at that point, which is the price of matching. Useful for RF and audio alike. +- **Three-phase power, why three.** Three sinusoids, 120 degrees apart, summed on a neutral wire. The neutral current is zero at balanced load. Unbalance the loads and the neutral starts carrying the difference. The reason your oscilloscope doesn't see a flickering line voltage in a commercial building. + +## Digital fundamentals + +- **A CMOS inverter switching.** NMOS and PMOS stacked. Input sweeps from 0 to Vdd. Both transistors' operating regions rendered live. The switching point, short-circuit current spike, and propagation delay all show up on a time trace in a second pane. +- **A flip-flop, a latch, and metastability.** Data and clock signals drive a D flip-flop. Hold-time and setup-time violations cause a metastable output that takes an uncertain time to resolve. Slider for data-edge-to-clock-edge offset. The probability curve of resolution time is a separate scene. +- **PWM, as seen by a motor.** A square wave with adjustable duty cycle driving an RL load. Current follows an exponential average. Slider for switching frequency. Below a certain frequency the current ripples audibly; above it the ripple is invisible. The case for fast switching rendered as a ripple amplitude. +- **SPI, I2C, and UART on a scope.** Three short protocol exchanges side by side, same payload. SPI's clock and separate lines; I2C's start condition and address byte; UART's start, stop, and baud-rate-defined bit widths. The tradeoffs (speed, wire count, addressing, ack) made visible. +- **Clock domain crossing.** Two clocks at unrelated frequencies. A signal from one domain sampled by the other. Metastability events highlighted. Add a two-flop synchronizer and watch them disappear. Add a FIFO for multi-bit signals and watch the timing close. + +## Operating systems, from the kernel's side + +- **A scheduler picking the next task.** A ready queue of tasks with priorities and time slices. Tick by tick, the scheduler picks a task, runs it, updates its virtual runtime, puts it back. Completely Fair Scheduler's red-black tree animated. Second scene is realtime FIFO, third is round-robin. Contrast in one page. +- **A syscall round-trip.** User process issues a read(). Registers loaded, `syscall` instruction fires, CPU jumps to the kernel entry point, privileges flip, kernel code runs, bytes move, registers restored, user resumes. Each step a frame. The cost of a syscall as a visible number of cycles. +- **A page fault handled.** Virtual address that isn't mapped. MMU raises a fault, kernel handler decides: demand page from disk, copy-on-write fork duplicating a shared page, stack growth, segfault. Four different fates for the same hardware event, selected by which bit was missing. +- **Copy-on-write fork.** Parent process with memory mapped. fork() makes a child sharing those pages read-only. Write to one; the kernel copies only the touched page. Scene counts pages copied as the parent and child diverge, showing why fork() is cheap even for giant processes. +- **A mutex, spinning and sleeping.** Two threads contending for a resource. First scene: spinlock, burning CPU. Second: a futex that sleeps when contended. Slider for expected critical-section length. The tradeoff between cache-thrash and context-switch cost rendered. +- **Interrupts vs polling.** A NIC receiving packets. First scene polls constantly, CPU busy 100%. Second uses interrupts, CPU idle between packets. Third adds interrupt moderation (NAPI): an interrupt arms a poll loop when traffic is heavy. The reason 10 gigabit NICs do the thing they do. + +## Databases and storage + +- **A B-tree growing.** Empty B-tree of order 4. Insert keys one at a time. Watch the root split, then a level split, then a level split a level split. The reason every disk-based index on earth is some variation on this. +- **Write-ahead logging and crash recovery.** A transaction touches several pages. Redo records written to the WAL first, then pages updated in memory, then eventually flushed. Pull the plug mid-flush; the WAL replays to recover. The durability half of ACID made concrete. +- **MVCC, multiple readers, one writer.** Row with three historical versions tagged by transaction id. Reader at txn id X sees the version visible to X, even while a writer creates a new version. The scene where your long-running report doesn't block the application writing to the same table. +- **Two-phase commit, and how it fails.** Coordinator and three participants. Prepare phase, commit phase. At each possible crash point, the protocol's recovery logic is shown. The one crash window that leaves a participant blocked forever (the textbook liveness problem) is highlighted. +- **Paxos in slow motion.** Three acceptors, two proposers. Proposal numbers and acceptance states tracked. Reader steps through a run where a leader is elected, a value is chosen, and a network partition is tolerated. Second scene shows a failure mode (dueling proposers) and how to avoid it. +- **Consistent hashing for a sharded store.** A ring of hash slots. Drop a key onto the ring; it lands on the next node clockwise. Add a node: only keys between the new node and its predecessor move. Remove a node: its keys migrate to the next one. The reason every distributed cache and database on earth uses some version of this. + +## Cryptography, from numbers up + +- **RSA, key generation and encryption.** Pick two small primes. Compute modulus and totient. Choose e and derive d. Encrypt a tiny integer with (e, n); decrypt with (d, n). All numbers small enough to see. Second scene shows why you can't factor the modulus when the primes are 1024 bits. +- **An elliptic curve and point addition.** A real curve y^2 = x^3 + ax + b plotted. Pick two points; draw the chord; reflect the third intersection; that's the sum. Scalar multiplication by doubling. Second scene switches to the same group over a finite field and the pretty curve turns into a cloud of points, which is the one that actually secures TLS. +- **TLS 1.3 handshake.** ClientHello to Finished, message by message. Key schedule derivation at each stage. What is encrypted, what is not, what is signed. The round trips counted. The difference between 1.3 and 1.2 made visible. +- **A Merkle tree verifying a leaf.** A tree of hashes. Verifier has the root; prover provides a leaf plus a log(N) path of sibling hashes. Verifier recomputes the root and compares. The thing Bitcoin, Git, and every modern certificate transparency log are built on. +- **AES, one round at a time.** 16-byte state as a 4x4 grid. SubBytes, ShiftRows, MixColumns, AddRoundKey rendered as distinct operations. Step through all 10 rounds for AES-128 and watch the state diverge from plaintext to ciphertext. +- **Diffie-Hellman and MITM.** A clean DH exchange in one scene. In a second, an active attacker intermediates: the two honest parties each share a key with the attacker and think they share one with each other. The reason TLS adds authentication on top. +- **Hash collisions, and why SHA-256 doesn't.** A small hash function like SHAKE-8 with a visible output space. Birthday paradox on the collision probability as inputs accumulate. Second scene scales up: SHA-256 at 2^128 birthday bound, and what that number actually means. + +## Control theory, practical + +- **Pole placement on the s-plane.** Drag poles around, watch the step response change. Poles on the real axis damp without oscillation; complex pairs ring at the imaginary part and decay at the real part. Cross into the right half plane and the system runs away. Engineering instinct in one picture. +- **Root locus, drawn live.** An open-loop transfer function with a variable gain K. As K sweeps, the closed-loop poles trace paths from open-loop poles to open-loop zeros. The one time a graphical method earns its keep against a computer. +- **State-space, for somebody who's only seen transfer functions.** A second-order system written both ways. A slider changes the system matrix A. Eigenvalues of A are the poles of the transfer function; watch them move in lockstep. Once the equivalence clicks the formalism stops being intimidating. +- **A Kalman filter tracking a noisy target.** Position and velocity states. Noisy measurements coming in. The filter's state estimate and covariance update with each measurement. Slider for process noise and measurement noise. Crank measurement noise up and the filter trusts its model more; crank process noise up and it trusts the measurements more. + +## Numerical methods + +- **Newton's method finding a root.** A curve, a starting guess, the tangent line hitting zero, the next guess, the next tangent. Converges quadratically when you are near the root. Pick a pathological starting point and watch it diverge or oscillate forever. +- **Gradient descent on a real loss surface.** 2D loss function with adjustable step size. Too small and it takes forever; too big and it diverges. Add momentum and watch it ride through flat regions. Add adaptive step sizes (Adam) and watch it handle badly-conditioned basins. The whole animation you wish somebody had shown you the first time you trained a model. +- **Finite differences for a PDE.** Heat equation on a rod. Discretize space and time, march forward. Slider for dt/dx^2. Cross the stability bound and watch the simulation explode. Fix it with implicit Euler and watch it behave. The CFL condition rendered as "don't do this." +- **Conjugate gradient, step by step.** A quadratic loss in 2D. Regular gradient descent zig-zags toward the minimum. Conjugate gradient picks directions that don't undo previous progress and converges in exactly N steps for an N-dimensional problem. Side-by-side. + ## Longer arcs A couple of ideas that would be a whole series, not one post.