In neurophysiology, several mathematical models of the action potential have been developed, which fall into two basic types. The first type seeks to model the experimental data quantitatively, i.e., to reproduce the measurements of current and voltage exactly. The renowned Hodgkin–Huxley model of the axon from the Loligo squid exemplifies such models. Although qualitatively correct, the H-H model does not describe every type of excitable membrane accurately, since it considers only two ions (sodium and potassium), each with only one type of voltage-sensitive channel. However, other ions such as calcium may be important and there is a great diversity of channels for all ions. As an example, the cardiac action potential illustrates how differently shaped action potentials can be generated on membranes with voltage-sensitive calcium channels and different types of sodium/potassium channels. The second type of mathematical model is a simplification of the first type; the goal is not to reproduce the experimental data, but to understand qualitatively the role of action potentials in neural circuits. For such a purpose, detailed physiological models may be unnecessarily complicated and may obscure the "forest for the trees". The FitzHugh–Nagumo model is typical of this class, which is often studied for its entrainment behavior. Entrainment is commonly observed in nature, for example in the synchronized lighting of fireflies, which is coordinated by a burst of action potentials; entrainment can also be observed in individual neurons. Both types of models may be used to understand the behavior of small biological neural networks, such as the central pattern generators responsible for some automatic reflex actions. Such networks can generate a complex temporal pattern of action potentials that is used to coordinate muscular contractions, such as those involved in breathing or fast swimming to escape a predator.
 In 1952 Alan Lloyd Hodgkin and Andrew Huxley developed a set of equations to fit their experimental voltage-clamp data on the axonal membrane. The model assumes that the membrane capacitance C is constant; thus, the transmembrane voltage V changes with the total transmembrane current Itot according to the equation
 where INa, IK, and IL are currents conveyed through the local sodium channels, potassium channels, and "leakage" channels (a catch-all), respectively. The initial term Iext represents the current arriving from external sources, such as excitatory postsynaptic potentials from the dendrites or a scientist's electrode.
 The model further assumes that a given ion channel is either fully open or closed; if closed, its conductance is zero, whereas if open, its conductance is some constant value g. Hence, the net current through an ion channel depends on two variables: the probability popen of the channel being open, and the difference in voltage from that ion's equilibrium voltage, V − Veq. For example, the current through the potassium channel may be written as
 which is equivalent to Ohm's law. By definition, no net current flows (IK = 0) when the transmembrane voltage equals the equilibrium voltage of that ion (when V = EK).
 To fit their data accurately, Hodgkin and Huxley assumed that each type of ion channel had multiple "gates", so that the channel was open only if all the gates were open and closed otherwise. They also assumed that the probability of a gate being open was independent of the other gates being open; this assumption was later validated for the inactivation gate. Hodgkin and Huxley modeled the voltage-sensitive potassium channel as having four gates; letting pn denote the probability of a single such gate being open, the probability of the whole channel being open is the product of four such probabilities, i.e., popen, K = n4. Similarly, the probability of the voltage-sensitive sodium channel was modeled to have three similar gates of probability m and a fourth gate, associated with inactivation, of probability h; thus, popen, Na = m3h. The probabilities for each gate are assumed to obey first-order kinetics
 where both the equilibrium value meq and the relaxation time constant τm depend on the instantaneous voltage V across the membrane. If V changes on a time-scale more slowly than τm, the m probability will always roughly equal its equilibrium value meq; however, if V changes more quickly, then m will lag behind meq. By fitting their voltage-clamp data, Hodgkin and Huxley were able to model how these equilibrium values and time constants varied with temperature and transmembrane voltage. The formulae are complex and depend exponentially on the voltage and temperature. For example, the time constant for sodium-channel activation probability h varies as 3(θ−6.3)/10 with the Celsius temperature θ, and with voltage V as
 In summary, the Hodgkin–Huxley equations are complex, non-linear ordinary differential equations in four independent variables: the transmembrane voltage V, and the probabilities m, h and n. No general solution of these equations has been discovered. A less ambitious but generally applicable method for studying such non-linear dynamical systems is to consider their behavior in the vicinity of a fixed point. This analysis shows that the Hodgkin–Huxley system undergoes a transition from stable quiescence to bursting oscillations as the stimulating current Iext is gradually increased; remarkably, the axon becomes stably quiescent again as the stimulating current is increased further still. A more general study of the types of qualitative behavior of axons predicted by the Hodgkin–Huxley equations has also been carried out.
 Because of the complexity of the Hodgkin–Huxley equations, various simplifications have been developed that exhibit qualitatively similar behavior. The FitzHugh–Nagumo model is a typical example of such a simplified system. Based on the tunnel diode, the FHN model has only two independent variables, but exhibits a similar stability behavior to the full Hodgkin–Huxley equations. The equations are
 where g(V) is a function of the voltage V that has a region of negative slope in the middle, flanked by one maximum and one minimum (Figure FHN). A much-studied simple case of the FitzHugh–Nagumo model is the Bonhoeffer-van der Pol nerve model, which is described by the equations
 where the coefficient ε is assumed to be small. These equations can be combined into a second-order differential equation
 This van der Pol equation has stimulated much research in the mathematics of nonlinear dynamical systems. Op-amp circuits that realize the FHN and van der Pol models of the action potential have been developed by Keener.
 A hybrid of the Hodgkin–Huxley and FitzHugh–Nagumo models was developed by Morris and Lecar in 1981, and applied to the muscle fiber of barnacles. True to the barnacle's physiology, the Morris–Lecar model replaces the voltage-gated sodium current of the Hodgkin–Huxley model with a voltage-dependent calcium current. There is no inactivation (no h variable) and the calcium current equilibrates instantaneously, so that again, there are only two time-dependent variables: the transmembrane voltage V and the potassium gate probability n. The bursting, entrainment and other mathematical properties of this model have been studied in detail.
 The simplest models of the action potential are the "flush and fill" models (also called "integrate-and-fire" models), in which the input signal is summed (the "fill" phase) until it reaches a threshold, firing a pulse and resetting the summation to zero (the "flush" phase). All of these models are capable of exhibiting entrainment, which is commonly observed in nervous systems.
 Whereas the above models simulate the transmembrane voltage and current at a single patch of membrane, other mathematical models pertain to the voltages and currents in the ionic solution surrounding the neuron.  Such models are helpful in interpreting data from extracellular electrodes, which were common prior to the invention of the glass pipette electrode that allowed intracellular recording.  The extracellular medium may be modeled as a normal isotropic ionic solution; in such solutions, the current follows the electric field lines, according to the continuum form of Ohm's Law
 where j and E are vectors representing the current density and electric field, respectively, and where σ is the conductivity.  Thus, j can be found from E, which in turn may be found using Maxwell's equations.  Maxwell's equations can be reduced to a relatively simple problem of electrostatics, since the ionic concentrations change too slowly (compared to the speed of light) for magnetic effects to be important.  The electric potential φ(x) at any extracellular point x can be solved using Green's identities
 where the integration is over the complete surface of the membrane; 
  
    
      
        
          ξ
        
      
    
    {\displaystyle {\boldsymbol {\xi }}}
  
 is a position on the membrane, σinside and φinside are the conductivity and potential just within the membrane, and σoutside and φoutside the corresponding values just outside the membrane.  Thus, given these σ and φ values on the membrane, the extracellular potential φ(x) can be calculated for any position x; in turn, the electric field E and current density j can be calculated from this potential field.