Wave laboratory
Frequency counts the cycles in the window; amplitude is the height. Change the sliders and watch the curve. Play tracer follows the curve in the browser, without running Python on every frame.
Interactive widget (WaveScope)Try it in the web app →
| Quantity | Value |
|---|---|
| Frequency f | 2 cycles |
| Period T = 1/f | 0.5 |
| Peak to peak 2A | 1.4 |
| RMS value A/\sqrt 2 | 0.495 |
Try it
- Double the frequency. How many crests fit in the same width, and what happens to T?
- Halve the amplitude. Does the number of crests change?
- Start the tracer, then move a slider. The tracer keeps running.
The widget is an ordinary anywidget class (cell A1): the same class
works in Jupyter, VS Code, and marimo. Its sliders are bound to the input cells
frequency and amplitude (bind(WaveScope(), frequency=frequency, …)): moving a slider
writes the cell, the cells B8–B10 read it, and the value is saved with the workbook. Whether the
tracer is playing is the widget's own state and stays inside it.