← SciSim / Neuroscience

HodgkinHuxley Model

🧠 Tier: Standard Undergraduate · Nobel Prize 1963 · Squid Giant Axon
§ 01
Interactive Simulation
Membrane V
–65.0
mV
Applied Iext
10.0
μA/cm²
Firing Rate
0.0
Hz
gNa
0.000
mS/cm²
gK
0.000
mS/cm²
Spike Count
0
spikes
Sim Time
0.0
ms
Iext (μA/cm²) 10.0
Na (mS/cm²) 120
K (mS/cm²) 36
gL (mS/cm²) 0.30
Cm (μF/cm²) 1.0
Noise σ (μA/cm²) 0.0
T sim (ms) 100
dt (ms) 0.025
⚠ dt too large — instability risk. Reduce dt below 0.025 ms.
§ 02
The Idea, Step by Step
▸ From a Plain-Language Hook to the Full Model
Start with a toilet flush. Press the handle a little and nothing happens; the water settles back. Press past a certain point and the whole tank empties in one unstoppable rush — and you cannot flush again until the tank refills. A neuron behaves the same way. A small poke does nothing, but once the voltage crosses a threshold, a full action potential fires in an all-or-nothing spike, and a brief "refill" time must pass before the next one. That single rule — small nudge, nothing; big enough nudge, full spike — is the whole story this page unpacks.
Name the players (high-school level). A nerve cell holds a voltage across its membrane, about $-65$ mV at rest (inside negative). Two kinds of gated "doors" sit in the wall: sodium (Na⁺) channels that let positive sodium in, and potassium (K⁺) channels that let positive potassium out. Sodium rushing in makes the voltage shoot up; potassium leaving brings it back down. The simplest way to see the balance is a current bookkeeping equation — capacitance times the rate of voltage change equals what flows in minus what flows out: $C_m\,\frac{dV}{dt} = I_{\text{ext}} - I_{Na} - I_K - I_L$. If you inject a steady $I_{\text{ext}} = 10\ \mu\text{A/cm}^2$, the membrane charges up until the sodium doors snap open and a spike launches.
The precise version (AP / intro-college). The doors are not simple on/off switches — each is a probability that depends on voltage and takes time to respond. Hodgkin and Huxley captured this with three gating variables: $m$ (sodium activation, fast), $h$ (sodium inactivation, slow), and $n$ (potassium activation, slow). The conductances become $g_{Na} = \bar{g}_{Na}\,m^3 h$ and $g_K = \bar{g}_K\,n^4$, and each gate relaxes toward a voltage-set target: $\frac{dx}{dt} = \alpha_x(V)(1-x) - \beta_x(V)\,x$. The spike is the choreography: $m$ opens almost instantly (Na⁺ floods in, voltage rockets up), then the slower $h$ shuts the sodium door while $n$ opens the potassium door (voltage crashes back down and briefly overshoots). The full derivation in §03 builds this from Kirchhoff's law one step at a time.
Try this in the sim above. (1) Drag Iext slowly upward and watch the trace switch from flat (subthreshold) to a steady train of spikes near ~6.5 μA/cm² — that is the firing threshold appearing in front of you. (2) Pull Na down below ~60: the spikes vanish, because without enough sodium doors the regenerative upswing can never get going. (3) Set Iext to $-5$, let it run ~60 ms, then snap it back to 0 and watch a spike appear from stopping inhibition — "anode break excitation," explained in the FAQ.
§ 03
Equation Derivation — Hodgkin–Huxley Model (1952)
▸ The Hodgkin–Huxley System — Governing Equations

Published in Journal of Physiology (1952), the Hodgkin–Huxley model is a system of four coupled nonlinear ODEs describing membrane voltage and channel gating dynamics of the squid giant axon. It earned Alan Hodgkin and Andrew Huxley the Nobel Prize in Physiology or Medicine (1963).

$$\boxed{C_m \dfrac{dV}{dt} = I_{\text{ext}} - \bar{g}_{Na}\, m^3 h\,(V - E_{Na}) - \bar{g}_K\, n^4\,(V - E_K) - g_L\,(V - E_L)}$$
$$\dfrac{dm}{dt} = \alpha_m(V)(1-m) - \beta_m(V)\,m \qquad \dfrac{dh}{dt} = \alpha_h(V)(1-h) - \beta_h(V)\,h \qquad \dfrac{dn}{dt} = \alpha_n(V)(1-n) - \beta_n(V)\,n$$

where the voltage-dependent rate functions are:


$$\alpha_m(V) = \dfrac{0.1(V+40)}{1 - e^{-(V+40)/10}}, \quad \beta_m(V) = 4\,e^{-(V+65)/18}$$ $$\alpha_h(V) = 0.07\,e^{-(V+65)/20}, \quad \beta_h(V) = \dfrac{1}{1 + e^{-(V+35)/10}}$$ $$\alpha_n(V) = \dfrac{0.01(V+55)}{1 - e^{-(V+55)/10}}, \quad \beta_n(V) = 0.125\,e^{-(V+65)/80}$$
▸ Symbol Table
SymbolBiophysical MeaningUnitTypical Value
\(V\)Membrane potential (inside minus outside)mV−65 (rest) to +40 (peak AP)
\(C_m\)Membrane capacitance per unit areaμF/cm²1.0
\(I_{\text{ext}}\)Applied/injected external current densityμA/cm²0–20 (adjustable)
\(\bar{g}_{Na}\)Maximum sodium conductance (all channels open)mS/cm²120
\(\bar{g}_K\)Maximum potassium conductancemS/cm²36
\(g_L\)Leak conductance (constant, mixed ions)mS/cm²0.3
\(E_{Na}\)Sodium reversal (Nernst) potentialmV+50
\(E_K\)Potassium reversal potentialmV−77
\(E_L\)Leak reversal potentialmV−54.4
\(m\)Na⁺ activation gate (probability open); \(m \in [0,1]\)0.05 (rest)
\(h\)Na⁺ inactivation gate; \(h \in [0,1]\)0.60 (rest)
\(n\)K⁺ activation gate; \(n \in [0,1]\)0.32 (rest)
\(\alpha_x(V), \beta_x(V)\)Voltage-dependent opening/closing rate constants for gate xms⁻¹see equations above
\(\tau_x(V)\)Voltage-dependent time constant: \(\tau_x = 1/(\alpha_x+\beta_x)\)ms0.1–10 ms
\(x_\infty(V)\)Steady-state gate value: \(x_\infty = \alpha_x/(\alpha_x+\beta_x)\)0–1
▸ Step-by-Step Derivation from First Principles
STEP 1 — Equivalent Circuit Model
A patch of membrane is modeled as a parallel RC circuit: a capacitor \(C_m\) (lipid bilayer) in parallel with conductances for Na⁺, K⁺, and leak channels. By Kirchhoff's current law (KCL), the total current flowing into the capacitor equals the sum of ionic currents flowing out: $$I_{\text{ext}} = I_C + I_{Na} + I_K + I_L = C_m\frac{dV}{dt} + I_{Na} + I_K + I_L$$ Rearranging: \(C_m \frac{dV}{dt} = I_{\text{ext}} - I_{Na} - I_K - I_L\)
STEP 2 — Ohmic Ionic Current Terms
Each ionic current obeys Ohm's law: current = conductance × driving force (membrane voltage minus reversal potential). The driving force accounts for both electrical and diffusive gradients (Nernst equilibrium): $$I_{Na} = g_{Na}(V - E_{Na}), \quad I_K = g_K(V - E_K), \quad I_L = g_L(V - E_L)$$ where the conductances \(g_{Na}\) and \(g_K\) are variable (gated), while \(g_L\) is constant.
STEP 3 — Voltage-Clamp Evidence for Gating
Hodgkin and Huxley used voltage-clamp experiments to isolate and measure \(I_{Na}\) and \(I_K\) independently. They found that conductances activate (and Na⁺ also inactivates) with sigmoidal time courses. Empirically, \(g_{Na} \propto m^3 h\) and \(g_K \propto n^4\), where the integer powers come from fitting activation curve sigmoidicity: $$g_{Na}(t) = \bar{g}_{Na}\, m(t)^3\, h(t), \qquad g_K(t) = \bar{g}_K\, n(t)^4$$
STEP 4 — First-Order Kinetics for Each Gate
Each gating variable \(x \in \{m, h, n\}\) is modeled as a first-order kinetic process between open (1) and closed (0) states with voltage-dependent rates \(\alpha_x(V)\) (opening rate, ms⁻¹) and \(\beta_x(V)\) (closing rate, ms⁻¹): $$\frac{dx}{dt} = \alpha_x(V)(1 - x) - \beta_x(V)\,x$$ This can be rewritten as \(\frac{dx}{dt} = \frac{x_\infty(V) - x}{\tau_x(V)}\) where \(x_\infty = \frac{\alpha_x}{\alpha_x + \beta_x}\) and \(\tau_x = \frac{1}{\alpha_x + \beta_x}\).
STEP 5 — Empirical Rate Functions (Hodgkin-Huxley 1952)
The \(\alpha\) and \(\beta\) functions were fit to voltage-clamp data from the squid giant axon at 6.3°C. Note that \(\alpha_m\) and \(\alpha_n\) have removable singularities (0/0 form) at \(V = -40\) mV and \(V = -55\) mV respectively; L'Hôpital's rule gives the limiting values \(\alpha_m(-40) = 1.0\) ms⁻¹ and \(\alpha_n(-55) = 0.1\) ms⁻¹, which must be handled numerically to avoid division-by-zero errors.
STEP 6 — Temperature Scaling (Q10 Factor)
The rate functions scale with temperature via the Q10 rule. The original data were at 6.3°C; for temperature T°C, multiply all \(\alpha\) and \(\beta\) by: $$\phi = 3^{(T - 6.3)/10}$$ At body temperature (37°C): \(\phi \approx 3^{3.07} \approx 30\), making action potentials much faster in warm-blooded animals.
STEP 7 — Complete System Assembly
Combining steps 1–6 yields the complete 4-dimensional ODE system \((V, m, h, n)\) that constitutes the Hodgkin-Huxley model. The system is stiff: the fastest time constant (\(\tau_m \approx 0.1\) ms at depolarized voltages) is ~100× smaller than the slowest (\(\tau_n \approx 10\) ms near rest), requiring small integration time steps (\(dt \leq 0.025\) ms) for numerical stability with explicit methods.
STEP 8 — Slider-to-Symbol Mapping
I_ext slider → \(I_{\text{ext}}\) in μA/cm² (the stimulus current in the membrane equation)  |  ḡ_Na slider → \(\bar{g}_{Na}\) maximum sodium conductance  |  ḡ_K slider → \(\bar{g}_K\) maximum potassium conductance  |  g_L slider → \(g_L\) (constant leak)  |  C_m slider → membrane capacitance (scales integration time)  |  Noise σ → standard deviation of additive Ornstein-Uhlenbeck current noise injected at each step.

▸ Worked Numerical Example — One RK4 Step

Given initial conditions at \(t = 0\): \(V_0 = -65\) mV, \(m_0 = 0.052\), \(h_0 = 0.596\), \(n_0 = 0.317\), with parameters \(C_m = 1\), \(\bar{g}_{Na} = 120\), \(\bar{g}_K = 36\), \(g_L = 0.3\), \(I_{\text{ext}} = 10\) μA/cm², \(dt = 0.025\) ms.

Compute derivatives at \(t=0\) (the k₁ values):

$$I_{Na} = 120 \times (0.052)^3 \times 0.596 \times (-65 - 50) \approx 120 \times 0.000140 \times 0.596 \times (-115) \approx -1.155 \;\mu\text{A/cm}^2$$ $$I_K = 36 \times (0.317)^4 \times (-65 - (-77)) \approx 36 \times 0.01009 \times 12 \approx 4.358 \;\mu\text{A/cm}^2$$ $$I_L = 0.3 \times (-65 - (-54.4)) = 0.3 \times (-10.6) = -3.18 \;\mu\text{A/cm}^2$$ $$k_{1,V} = \frac{1}{1}\left(10 - (-1.155) - 4.358 - (-3.18)\right) = \frac{10 + 1.155 - 4.358 + 3.18}{1} \approx 9.977 \;\text{mV/ms}$$

RK4 update (schematic — all four k-values computed similarly):

$$V(dt) = V_0 + \frac{dt}{6}(k_{1,V} + 2k_{2,V} + 2k_{3,V} + k_{4,V}) \approx -65 + \frac{0.025}{6}(9.977 + \ldots) \approx -64.96 \;\text{mV}$$

Each gating variable is updated identically with its own \(k_1\) through \(k_4\) computed from \(\alpha_x(V)\) and \(\beta_x(V)\) at each sub-step. Gating variables are clamped to \([0,1]\) after each step.

▸ Primary References — Section 3
[HH52]Hodgkin & Huxley — A quantitative description of membrane current and its application to conduction and excitation in nerve, J. Physiol. 117:500–544, 1952. The original paper.
[DA01]Dayan & Abbott — Theoretical Neuroscience, MIT Press, 2001. Chapter 5: "Model Neurons I: Neuroelectronics".
[JW95]Johnston & Wu — Foundations of Cellular Neurophysiology, MIT Press, 1995. Chapters 6–8.
[ET10]Ermentrout & Terman — Mathematical Foundations of Neuroscience, Springer, 2010. Chapter 2: "Conductance-Based Models".
[IZH07]Izhikevich — Dynamical Systems in Neuroscience, MIT Press, 2007. Chapter 2. Free PDF: dynamicalsystems.org
§ 04
Frequently Asked Questions
🔬 Simulation What exactly is this simulation showing, and what does each slider control?
The simulation numerically integrates the four coupled ODEs of the Hodgkin-Huxley model in real time using the 4th-order Runge-Kutta method with dt = 0.025 ms by default. The main canvas shows membrane voltage V(t) as a waveform — each upswing is a true action potential generated by the interplay of Na⁺ activation (m gate), Na⁺ inactivation (h gate), and K⁺ activation (n gate). The I_ext slider is your stimulus: below ~6.5 μA/cm², the neuron is subthreshold; above it, you see repetitive firing whose rate increases with current. The ḡ_Na and ḡ_K sliders change the peak conductances — reducing ḡ_Na below ~60 mS/cm² eliminates action potentials entirely. The Noise σ slider adds stochastic current that can trigger spontaneous spikes or irregular firing.
Key takeaway: Every feature of the action potential waveform — height, width, AHP depth, refractory period — is directly traceable to specific parameter values and gating variable dynamics.
🧠 Conceptual What does the Hodgkin-Huxley model actually capture, and what does it leave out?
The HH model captures the macroscopic ionic currents responsible for the action potential — specifically how voltage-dependent conductances create a self-reinforcing depolarization followed by active repolarization. It successfully explains threshold, the all-or-nothing law, the absolute and relative refractory periods, repetitive firing, and anode break excitation. What it leaves out is equally important: it does not model individual channel stochasticity (it treats conductance as a continuous, averaged variable), it does not include calcium channels (critical for bursting and synaptic release), it does not model spatial propagation along the axon (only a point neuron or voltage-clamped patch), and it uses squid axon parameters that differ from mammalian neurons. Modern extensions include the Traub model (CA3 pyramidal cell) and the Blue Brain / Allen Brain cell models.
Key takeaway: The HH model is a mean-field approximation — it describes the average behavior of a large population of independent, two-state channels, not the stochastic gating of individual channels.
🌍 Applied Where does the Hodgkin-Huxley model appear in medicine and neurotechnology?
The HH model is the foundation of virtually all quantitative neurology and neural engineering. In epilepsy research, HH-type models explain how hyperexcitability arises from altered Na⁺ channel inactivation (SCN1A mutations in Dravet syndrome). In cardiac medicine, the Luo-Rudy and O'Hara-Rudy heart cell models are HH-type models — the same formalism predicts long-QT arrhythmias and guides drug design targeting K⁺ channels. In deep brain stimulation (DBS) for Parkinson's disease, HH-based network models help optimize stimulation parameters. Cochlear implant pulse sequence design uses HH-type auditory nerve models to maximize speech intelligibility. In AI and neuromorphic computing, Intel's Loihi chip implements LIF neurons inspired by HH simplifications, and spiking neural networks (SNNs) aim to match the energy efficiency of biological spike-based computation.
Key takeaway: If you understand Hodgkin-Huxley, you can read — and contribute to — neuropharmacology, epileptology, cardiac electrophysiology, neural prosthetics, and brain-inspired AI, all from the same mathematical framework.
💡 Non-Obvious What is "anode break excitation" and why does a neuron fire when you STOP applying current?
Anode break excitation (also called "post-inhibitory rebound spike") is one of the most counterintuitive phenomena in neuroscience: apply a strong hyperpolarizing (negative) current for 50–100 ms, then abruptly stop — and the neuron fires a spike, even though no depolarizing current was applied. The mechanism: prolonged hyperpolarization drives the h gate (Na⁺ inactivation) toward 1 (fully de-inactivated) while simultaneously driving n (K⁺ activation) toward 0 (K⁺ channels close). When the current turns off, the membrane springs back toward rest, but now the Na⁺ channel is unusually "primed" (high h, low n) — the inward Na⁺ current overwhelms the reduced K⁺ current and triggers a spike. To see this in the simulation: set I_ext to −5 μA/cm², run for ~60 ms, then snap I_ext back to 0.
Key takeaway: The action potential threshold is not a fixed voltage — it depends on the history of gating variable states; prior inhibition can paradoxically increase excitability.
📐 Computational Why use RK4 and not Euler integration? How small must dt really be?
The HH equations are stiff ODEs: the fastest time constant (\(\tau_m\) ≈ 0.1 ms at V = −40 mV) is ~100× smaller than the slowest (\(\tau_n\) ≈ 10 ms near rest). Forward Euler requires \(dt \ll \tau_{\min}\) for stability, meaning \(dt \lesssim 0.01\) ms. With \(dt = 0.1\) ms, Euler produces catastrophic instability — the gating variables blow up to values outside [0,1] and V diverges to ±∞ within milliseconds. RK4 uses four derivative evaluations per step, achieving 4th-order accuracy: the local truncation error is O(dt⁵) versus O(dt²) for Euler. In practice, RK4 with \(dt = 0.025\) ms gives accurate, stable results for the HH system. For production simulations, CVODE (implicit BDF method) is preferred because it adaptively controls step size on stiff ODEs. In this simulation, we enforce dt ≤ 0.05 ms and warn if a larger value is set.
Key takeaway: Euler + HH = numerical disaster; RK4 + dt ≤ 0.025 ms = accurate science. The stiffness ratio in HH is moderate; truly stiff models (full compartmental neurons) require implicit solvers.
🎓 Deep / Advanced What does bifurcation theory reveal about the Hodgkin-Huxley model that the simulation cannot directly show?
The transition from rest to repetitive firing as I_ext increases is a bifurcation — a qualitative change in the system's dynamics. For the standard HH parameters, the onset of repetitive firing occurs via a subcritical Hopf bifurcation: the resting state loses stability and a large-amplitude limit cycle (the action potential train) appears abruptly, with a finite minimum firing frequency (~50 Hz). This makes HH a "Type II" excitable system (Rinzel-Ermentrout classification): the f-I curve has a discontinuous onset. In contrast, a SNIC (saddle-node on invariant circle) bifurcation produces Type I excitability with a continuous f-I curve starting from 0 Hz (as in the Morris-Lecar model). The distinction has profound implications: Type II neurons tend to synchronize in networks, while Type I neurons encode a wider dynamic range of input intensities. These bifurcation structures are invisible to the time-domain simulation but are revealed by continuation methods (AUTO, XPPAUT) that trace equilibria and limit cycles as parameters vary.
Key takeaway: The type of bifurcation at spike onset determines synchronization properties, frequency-current relationships, and noise sensitivity — all of which matter enormously for neural circuit function.
🧠 Conceptual Why does the action potential have an absolute refractory period, and what sets its duration?
Immediately after an action potential, the Na⁺ inactivation gate h has been driven to nearly 0 (Na⁺ channels are fully inactivated), and the K⁺ activation gate n is near its maximum (K⁺ channels are wide open, hyperpolarizing the membrane). During this absolute refractory period (~1–2 ms), no amount of current can generate another action potential because the inward Na⁺ current is completely suppressed. The duration is set by the recovery time of h, governed by \(\tau_h(V)\) — roughly how long it takes h to recover from ~0 back toward 0.6. The subsequent relative refractory period (2–10 ms) occurs while h is partially recovered and n is still elevated; a spike can be triggered but requires a larger-than-normal I_ext and produces a smaller, slower action potential.
Key takeaway: The refractory period is not a "reset timer" — it is the natural consequence of Na⁺ channel inactivation dynamics (h gate kinetics) and sets the maximum firing frequency of the neuron (~500–1000 Hz for fast Na⁺ channels).
§ 03 Best Learning Resources
§ 05
Misconceptions & Common Errors
Sub-block A — Conceptual Misconceptions
"The Hodgkin-Huxley model describes individual ion channel openings — m, h, and n are the states of single channels."
The HH model is a mean-field / macroscopic conductance model. The variables m, h, n represent the fraction of a large population of independent, identical channels in the open state — not the state of any individual channel. A single Na⁺ channel stochastically flicks between open and closed states; the HH equations describe the ensemble average over ~10,000 channels per μm² of membrane. Individual channel stochasticity requires the Stochastic HH model (Fox & Lu, 1994) using Langevin noise terms or a full Markov chain Monte Carlo simulation. The HH model emerges from the stochastic model only in the thermodynamic limit (large channel number).
📖 Dayan & Abbott, Ch. 5 §5.4; Gerstner et al., Neuronal Dynamics Ch. 2.3
"During the action potential, Na⁺ flows OUT of the cell, which depolarizes it."
Na⁺ flows INTO the cell during depolarization. The driving force for Na⁺ is \(V - E_{Na}\): at rest, V ≈ −65 mV and E_Na ≈ +50 mV, so the driving force is −115 mV — strongly inward. Na⁺ ions rush in through open channels, carrying positive charge inside, which raises (depolarizes) V. K⁺ does the opposite: \(E_K ≈ -77\) mV, so at depolarized voltages (V > E_K), K⁺ is driven outward, removing positive charge and repolarizing the cell. The ionic current sign convention is: inward current (positive ions entering) is depolarizing; outward current is hyperpolarizing.
📖 Johnston & Wu, Ch. 6; Purves et al. — Neuroscience (5th ed.), Ch. 2
"A stable fixed point in the HH phase portrait means the neuron fires repetitively."
A stable fixed point means exactly the opposite: the neuron is in a stable resting or tonic state and does NOT fire repetitively. Repetitive firing corresponds to a stable limit cycle in the phase space — a closed orbit that the trajectory circles indefinitely. In the HH model, increasing I_ext causes the fixed point to lose stability (via Hopf bifurcation) and a limit cycle to appear. If you see the phase portrait trajectory spiraling into a point, the neuron is resting; if it forms a closed loop (the limit cycle), the neuron is firing rhythmically. An unstable fixed point with no limit cycle leads to trajectories that escape to infinity — biophysically unphysical and usually a sign of a numerical error or unphysiological parameter choice.
📖 Izhikevich — Dynamical Systems in Neuroscience, Ch. 4; Strogatz — Nonlinear Dynamics and Chaos, Ch. 7
Sub-block B — Common Numerical & Modeling Errors
Using forward Euler with dt = 0.1 ms for Hodgkin-Huxley integration: V += dt * dVdt(V,m,h,n)
Use RK4 with dt ≤ 0.025 ms. The HH system is stiff: \(\tau_m \approx 0.1\) ms at depolarized voltages. The Euler method requires \(dt < 2\tau_{\min} \approx 0.2\) ms for marginal stability, but the actual stability limit is much tighter for coupled nonlinear systems. With dt = 0.1 ms (Euler), m and h variables oscillate violently, producing non-physiological voltage traces that resemble real action potentials but have incorrect timing, height, and firing rate. Even with RK4, dt = 0.1 ms introduces 2–5% errors in spike timing. The correct approach: RK4 with dt = 0.01–0.025 ms, or use a semi-implicit (exponential Euler) method for the linear gating variable equations.
🔍 Why students do this: Euler is the first numerical method taught and is intuitive; the stiffness of HH is not obvious until the simulation blows up.
Not handling the singularity: alpha_m = 0.1*(V+40) / (1 - Math.exp(-(V+40)/10)) — causes NaN or Infinity at V = −40 mV.
Apply L'Hôpital's rule at the removable singularity. For \(\alpha_m\): when \(|V + 40| < 10^{-7}\), substitute the limit value \(\alpha_m = 1.0\) ms⁻¹ (the limit as V → −40 from L'Hôpital). Similarly for \(\alpha_n\): when \(|V + 55| < 10^{-7}\), use \(\alpha_n = 0.1\) ms⁻¹. In code: if (Math.abs(V+40) < 1e-7) return 1.0; else return 0.1*(V+40)/(1-Math.exp(-(V+40)/10));. Alternatively, use the numerically stable form \(\alpha_m = 0.1 \cdot x / (1 - e^{-x})\) where x = (V+40)/10, and note that this function equals \(x/(e^x - 1) \cdot e^x\), which is the Bose-Einstein-like function with a well-known stable implementation.
🔍 Why students do this: The formula looks fine algebraically; the singularity only manifests at exactly one voltage value and may not be encountered in tests with coarse V steps.
Forgetting to clamp gating variables: after RK4 update, m, h, or n can exceed [0,1] due to large dt or initial conditions, causing negative conductances or currents exceeding physical limits.
After every RK4 step, explicitly clamp all gating variables: m = Math.max(0, Math.min(1, m)), and similarly for h and n. This is a physical constraint — gating variables are probabilities. While analytically the HH equations guarantee \(x \in [0,1]\) if they start there (the right-hand side points inward at boundaries), numerical errors with large dt can push them outside this range, producing unphysical conductances. Additionally, clamp V to a reasonable physiological range (−150 to +70 mV) to catch runaway instabilities early and produce a meaningful error message rather than silent NaN propagation.
🔍 Why students do this: Trust that the math "should" keep variables in range without verifying that the numerics do too.
§ 05 References for Misconceptions & Errors