Snapshot 1: the time evolution of sodium ions from an initially linear concentration distribution. Snapshot 2: at the Nernst reversal potential, for an appropriate initial concentration distribution the system is at equilbrium. Snapshot 3: the initial delta spike of potassium ions decays as ions drift due to diffusion and the electric field.
Ions undergoing diffusion in the presence of an electric field give rise to an ionic current flux
) at position
) is the diffusion constant,
is the ionic concentration,
is the ion's charge (unitless),
is the Faraday constant,
is the universal gas constant,
is the temperature and
is the electric potential . Combined with the continuity equation
the Nernst-Planck equation describing the evolution of the ionic concentration in time is obtained as
In this demonstration, this equation is considered in a one-dimensional form to describe the diffusion of ions across a neural membrane. Let
denote the direction through the membrane, perpendicular to the surface, where
is the width of the membrane, such that
identify the interior, exterior of the neuron. Divide this distance into
compartments of width
. Furthermore, discretize time into time steps
denote the constant ion concentration and potential in compartment
at time step
. A finite difference approximation of the Nernst-Planck equation with zero-flux boundary conditions at the membrane boundaries is
As parameter values, we take the membrane width
, the spacing
, the temperature
. It is assumed that the electric field is constant across the membrane, i.e. the potential is a linear function of the distance, with a potential
. The time step is chosen to satisfy the stability criteria obtained by a von Neumann stability analysis 
is the magnitude of the electric field.
Four ion species may be examined, with diffusion constants taken from  (Table 10.1) at
in units of
Note that these values are approximate, and the diffusion constant may in general vary with temperature and across the membrane. The default values  (Table 1.3) of the initial interior concentrations in
and exterior concentrations are
These values may be adjusted using the sliders which add/subtract a percentage of the default concentrations.
Three initial concentration shapes are possible:
(i) the equilibrium shape at the Nernst reversal potential. If the membrane potential is also set to the Nernst reversal potential, the ionic flux is zero and the initial distribution is the equilbrium, indicated by a solid brown line.
(ii) a linear shape between the interior and exterior concetrations.
(iii) a delta function shape, with zero initial concentration everywhere across the membrane except the endpoints.
Note finally the connection between the Nernst-Planck equation and the Goldman-Hodgkin-Katz equation, which may be derived as the solution to the first differential equation above for constant ionic current flux.
 B. Hille, Ion channels of excitable membranes,
Sunderland, Mass: Sinauer, 2001. Print.
 Koch, Christof, Biophysics of computation information processing in single neurons,
New York: Oxford University Press, 1999. Print.