hysteresis — hysteresis — return a value that depends on how you got here, not where you are
hysteresis [--deadband=WIDTH] [--coerce] [--remanent] INPUT output(now) = f(input(now), path taken to get here)
hysteresis wraps an input so that its output lags behind it and depends on the direction of approach. The same input read twice returns two different values if the two readings were reached from opposite sides. There is no bug here. The value is doing exactly what the state it remembers tells it to.
Two thresholds are maintained rather than one: a level to turn on and a lower level to turn off. Between them lies the deadband, a region in which hysteresis returns its previous answer and ignores you. This is the point of it. A system with a single threshold chatters; a system with two commits.
The stored state persists after the input that set it is withdrawn. Remove the field, the alignment stays. Stop pulling, the position holds. This retained answer is called remanence, and clearing it costs more than setting it did.
"From Greek hysterēsis, 'a shortcoming' or 'a coming after,' from hysteros, 'later, behind' — unrelated to hysteria despite the shared look. Sir James Alfred Ewing gave the word its technical sense around 1885 while studying iron that stayed magnetized after the field was removed. The area enclosed by the resulting magnetization loop is not a metaphor: it is energy dissipated as heat on every cycle, which is why transformer cores are built to keep that loop thin."
Setting a value is cheap; unsetting it is not. Coercivity is charged at the higher rate.
The system counts every tug it ignored and will report the total on request. Requests are discouraged.
There is no way to read the current output without also becoming part of its history.
backpressure(3), idempotent(3), quiescence(1). The living exhibit demonstrates the word in motion:
▸ operate hysteresis