Adding the Spike
Real neurons don't plateau — they fire. We bolt spiking onto the model by hand with one simple rule: when the water hits the rim, it spills and the bucket empties.
The spike-and-reset rule:
1. Pick a threshold voltage V_th.
2. Let the voltage charge up normally (the exact solution from the last lesson).
3. The instant V(t) > V_th → record a spike, count it, and reset the voltage to V_reset.
4. Start charging again. Repeat.
if V(t) > V_th: spike! → set V = V_reset, count += 1
A hard threshold and an instant reset. Simple, effective, slightly inelegant.
Play with it. Below is the real three-panel picture electrophysiologists use: ① the input you inject, ② the voltage sawtooth (charge up → spike → reset), and ③ the raster plot — one tick per spike. Slide the input current I:
Turn up I → the bucket fills toward a higher target, crosses the threshold V_th sooner, and the neuron fires faster. Below about I = 2.5 the target never reaches threshold, so the neuron stays silent. Each spike instantly resets the voltage to −75 mV — that vertical drop is the artificial "discontinuity" of the LIF model.
What you should see: more input I → the bucket fills faster → it hits threshold sooner → spikes come more often. Below about I = 2.5 the target voltage never even reaches threshold, so the neuron stays silent. This is the model finally behaving like a real, spiking neuron.
The honest catch: that instant vertical reset is a discontinuity — the voltage teleports. Mathematically it's a bit ugly (the elegant exact solution gets interrupted by a hand-coded rule), but it works and it gets results, so neuroscientists happily live with it.