CST, Calculus for Cognitive Scientists Partial Differential Equation Models
CST, Calculus for Cognitive Scientists Partial Differential Equation Models
James K. Peterson
Calculus for
Cognitive
Scientists
Partial Differential Equation Models
Cognitive Science and Technology
Series editor
David M.W. Powers, Adelaide, Australia
123
James K. Peterson
Department of Mathematical Sciences
Clemson University
Clemson, SC
USA
We would like to thank all the students who have used the various iterations
of these notes as they have evolved from handwritten to the fully typed version
here. We particularly appreciate your interest as it is hard to find students who want
to learn how to wear so many hats! We have been pleased by the enthusiasm you
have brought to this interesting combination of ideas from many disciplines. These
ideas have been taught as an overload to small numbers of students over the last
10 years. We appreciate them very much!
vii
Contents
ix
x Contents
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
List of Figures
xv
xvi List of Figures
xxi
List of Code Examples
xxiii
xxiv List of Code Examples
This book again tries to show cognitive scientists in training how mathematics,
computer science, and science can be usefully and pleasurably intertwined. This is a
follow-up text to our first two sets of notes on mathematics for cognitive scientists,
which are our companion volumes (J. Peterson, Calculus for Cognitive Scientists:
Derivatives, Integration and Modeling (Springer, Singapore, 2015 in press)) and
(J. Peterson, Calculus for Cognitive Scientists: Higher Order Models and Their
Analysis (Springer, Singapore, 2015 in press)). In these notes, we add the mathe-
matics and computational tools needed to understand how to compute the terms in
the Fourier Series expansions that solve the cable equation. We derive the cable
equation from the first principles by going back to cellular biology and the relevant
biophysics. We discuss carefully ion movement through cellular membranes and
then show how the equations that govern such ion movement lead to the standard
transient cable equation. Then we learn how to solve the cable model using sep-
aration of variables. We go over carefully why Fourier Series converge and
implement MATLAB tools to compute the solutions. We then discuss how to
solve linear PDE in general using these tools. Finally, we develop the standard
Hodgkin–Huxley model of an excitable neuron and solve it using MATLAB tools.
As always, our chosen models are used to illustrate how these three fields influence
each other in interesting and useful ways. We also stress our underlying motto:
always take the modeling results and go back to the scientists to make sure they
retain relevance.
xxix
History
Based On:
Research Notes: 1992–1998
Class Notes: MTHSC 982 Spring 1997
Research Notes: 1998–2000
Class Notes: MTHSC 860 Summer Session I 2000
Class Notes: MTHSC 450, MTHSC 827 Fall 2001
Research Notes: Fall 2007 and Spring 2008
Class Notes: MTHSC 450 Fall 2008
Class Notes: MTHSC 450 Fall 2009
Class Notes: MTHSC 450 Spring 2010 and Fall 2010
Class Notes: MTHSC 450 Spring 2011 and Fall 2011
Class Notes: MTHSC 450 Spring 2012
Class Notes: MTHSC 434 Summer Session II 2010 and 2011
Class Notes: MTHSC 450 Fall 2011 and Spring 2012
Class Notes: MTHSC 434 Summer Session II 2012
Class Notes: MTHSC 434 Summer Session II 2014
xxxi
Part I
Introductory Matter
Chapter 1
Introduction
Linear PDE models such as the diffusion equation, wave equation and Laplace’s
equation to give you more experience with the separation of variables technique.
We then use the cable equation to develop a model of the input side of an excitable
neuron—the dendrite and then we build a model of the excitable neuron itself. This
consists of a dendrite, a cell body or soma and the axon along which the action
potential moves in the nervous system. In the process, we therefore use tools at the
interface between science, mathematics and computer science.
We are firm believers in trying to build models with explanatory power. Hence, we
abstract from biological complexity relationships which then are given mathemat-
ical form. This mathematical framework is usually not amenable to direct solution
using calculus and other such tools and hence part of our solution must include sim-
ulations of our model using some sort of computer language. In this text, we focus
on using MatLab/Octave as it is a point of view that is easy to get started with.
Even simple models that we build will usually have many parameters that must be
chosen. For example, in Peterson (2015b) we develop a cancer model based on a
singe tumor suppressor gene having two allele states. There are two basic types of
cell populations: those with no chromosomal instability and other cells that do have
some sort of chromosomal instability due to replication errors and so forth. The two
sets of populations are divided into three mutually exclusive sets: cells with both
alleles intact, cells having only one allele and cells that have lost both alleles. Once a
cell loses both alleles, cancer is inevitable. Hence, the question is which pathway to
cancer is most probable: the pathway where there is not chromosomal instability or
the pathway which does have chromosomal instabilities. The model therefore has 6
variables—one for each cell type in each pathway and a linear model is built which
shows how we think cell types turn into other cell types. The problem is all the two
dimensional graphical tools to help us understand such as phase plane analysis are
no longer useful because the full system is six dimensional. The model can be solved
by hand although it is very complicated and it can be solved using computational
tools for each choice of our model’s parameters. If you look at this model in Peterson
(2015b), you’ll see there are 4 parameters of interest. If we had 10 possible levels
for each parameter, we would have to solve the model computationally for the 104
parameter choices in order to explore this solution space. This is a formidable task
and it still doesn’t answer our question about which pathway to cancer is dominant.
In Peterson (2015b), we make quite a few reasonable assumptions about how this
model works to reduce the number of parameters to only 2 and then we approximate
the solutions using first order methods to find a relationship between these two para-
meters which tells us when each pathway is probably dominant. This is the answer
we seek: not a set of plots but a algebraic relationship between the parameters which
gives insight. Many times these types of questions are the ones we want to ask.
In this book, we are going to build a model of an excitable neuron and to do this we
will have to make many approximations. At this point, we will have a model which
generates action potentials but we still don’t know much about how to link such
excitable neuron models together or how to model second messenger systems and
1 Introduction 5
so forth. Our questions are much larger and more ill-formed than simply generating
a plot of membrane voltage versus time for one excitable neuron. Hence, this entire
book is just a starting point for learning how to model networks of neurons. In
Peterson (2015c), we develop our understanding further and develop MatLab/Octave
code to actually build neural circuit models. But that is another story.
The book (McElreath and Boyd 2007) also caution modelers to develop models
that are appropriately abstract yet simple. In McElreath and Boyd (2007, pp. 7–8),
we find a nice statement of this point of view. This book looks carefully at how to
build models to explain social evolution but their comments are highly relevant to us.
Simple models never come close to capturing all the details in a situation.... Models are like
maps – they are most useful when they contain details of interest and ignore others....Simple
models can aid our understanding of the world in several ways. There are ... a very large
number of possible accounts of any particular biological ... phenomenon. And since much of
the data needed to evaluate these accounts are ... impossible to collect, it can be challenging
to narrow down the field of possibilities. But models which formalize these accounts tell us
which are internally consistent and when conclusions follow from premises....Formalizing
our arguments helps us to understand which [models] are possible explanations. [Also]
formal models are much easier to present and explain. ...They give us the ability to clearly
communicate what we mean. [Further], simple models often lead to surprising results. If
such models always told us what we thought they would, there would be little point in
constructing them. ...They take our work in directions we would have missed had we stuck
to verbal reasoning, and they help us understand features of the system of study that were
previously mysterious.... Simple formal models can be used to make predictions about natural
phenomena.
Further, they make the same important points about the need for abstraction and the
study of the resulting formal models using abstract methods aided by simulations.
In McElreath and Boyd (2007, p. 8) we have
There is a growing number of modelers who know very little about analytic methods.
Instead these researchers focus on computer simulations of complex systems. When com-
puters were slow and memory was tight, simulation was not a realistic option. Without
analytic methods, it would have taken years to simulate even moderately complex systems.
With the rocketing ascent of computer speed and plummeting price of hardware,it has become
increasingly easy to simulate very complex systems. This makes it tempting to give up on
analytic methods, since most people find them difficult to learn and to understand.
There are several reasons why simulations are poor substitutes for analytic models. ...Equa-
tions – given the proper training – really do speak to you. They provide intuitions about the
reasons a ... system behaves as it does, and these reasons can be read from the expressions
that define the dynamics and resting states of the system. Analytic results tell us things that
we must infer, often with great difficulty, from simulation results.
This is our point with our comments about the cancer model. Simulation
approaches for the cancer model do not help us find the parameter relationships
we seek to estimate which pathway to cancer is the most likely for a given set of
parameter choices. The analytic reasoning we use based on our dynamic models helps
us do that. In the same way, simulation approaches alone will not give us insight into
the workings of neural systems that can begin to model portions of the brain cir-
cuitry humans and other animals have. The purpose of our modeling is always to
gain insight.
6 1 Introduction
This text covers the material in bioinformation processing in the following way.
Part I: Introductory Matter This is the material you are reading now.
Part II: Quantitative Tools In this part, we introduce computational tools based on
MatLab (although you can use the open source Octave just as easily. The students
we teach are not very comfortable with programming in other languages and
paradigms and so we have not used code based on C, C++ and so forth although
it is available. We discuss and provide code for
Part III: Deriving The Cable Model We now derive the basic cable equation so we
can study it. We start with a discussion of basic cell biology and the movement
of ions across cell membranes. Then, with the basic cable equation available for
study, we then turn to its solution in various contexts. We begin by removing time
dependence and discuss its solution in the three flavors: the infinite cable, the
half-infinite cable and the finite cable. To do the nonhomogeneous infinite cable
model, we introduce the method of variation of parameters and discuss what we
mean by linearly independent functions.
• Chapter 4: We go over the biophysics of how ions move inside cells and discuss
how proteins are made.
• Chapter 5: We discuss how ions move across biological membranes leading to
the derivation of the Nernst–Planck equation and the notion of Nernst equilibrium
voltages for different ions. We introduce the idea of signaling with multiple ion
species crossing a membrane at the same time.
• Chapter 6: We derive the basic cable model for the change in membrane voltage
with respect to space and time. We end with the transient membrane cable equation.
We are now need to study how to solve linear partial differential equations.
• Chapter 7: We solve the cable equation when there is no time independence. We
start with an infinite cable and finish with the half-infinite cable case.
• Chapter 8: We solve the cable equation when the cable has a finite length. This is
messy technically but it rewards your study with a deeper understanding of how
these solutions behave. Our method of choice is Variation of Parameters.
1.1 Chapter Guide 7
Part IV: Excitable Neuron Models The standard model of an excitable neuron then
glues together a dendrite model (a finite length cable) to an equipotential cell body
and an axon. The dendrite and cell body have a complicated interface where they
share a membrane and the resulting complicated cable equation plus boundary
conditions is known as the Ball and Stick Model. This model is solved using
the separation of variable technique and gives rise to a set of functions whose
properties must be examined. The numerical solutions we build then require new
tools in MatLab on root finding and the solution of linear equations. Once the
dendrite cable models have been solved, we use their solution as the input to
classical Hodgkin–Huxley models. Hence, we discuss the voltage dependent ion
gates and their usual Hodgkin–Huxley model in terms of activation and interaction
variables. Once the axon models are built, we then glue everything together and
generate action potentials using the dendrite–axon model we have built in this
part. The necessary MatLab scripts and code to implement these models are
fully described.
• Chapter 9: We learn how to solve the cable equation using a new technique called
separation of variables. To do this, we need to build what are called infinite series
solutions. Hence, once we find the infinite series solution to the cable equation,
we need to backtrack and describe some mathematical ideas involving series of
functions. We then include a discussion of Fourier series and their convergence. The
convergence of these series is a complicated topic and we include a fairly careful
explanation of most of the relevant ideas. We finish with a detailed development
of the way we would implement Fourier series computations in MatLab/Octave
code.
• Chapter 10: We then use separation of variables to solve a variety of additional
linear partial differential equations. We finish with an implementation of how to
build approximations to the series solutions in MatLab/Octave.
• Chapter 11: We build a primitive, although illuminating, model of an excitable
neuron which has a single dendritic cable, a body called the soma and a simplified
output cable called the axon. This model is the Ball Stick model and it is compli-
cated to solve. The usual method of separation of variables has some complications
which we must work around. We provide a full discussion of this and the relevant
MatLab/Octave code needed for approximating the solutions.
• Chapter 12: We finish this volume with a nice discussion of a classical Hodgkin–
Huxley model. We introduce the Hodgkin–Huxley ion gate model and add it to
the already developed Ball Stick model so that we have a full excitable nerve cell
model. We include our development of relevant code also.
Our style here is to assume you the reader are willing to go on this journey with
us. So we have worked hard at explaining in detail all of our steps. We develop
the mathematical tools you need to a large extent in house, so to speak. We also
try to present the algorithm design and the code behind our MatLab/Octave experi-
ments in a lot of detail. The interactive nature of the MatLab integrated development
8 1 Introduction
environment makes it ideal for doing the exploratory exercises we have given you in
these pages. If you work hard on this material, you will be ready for the later journeys
which begin to explain bioinformation processing in more detail along with more
advanced software techniques.
1.2 Code
All of the code we use in this book is available for download from the site Biologi-
cal Information Processing (http://www.ces.clemson.edu/~petersj/CognitiveModels.
html). The code samples can then be downloaded as the zipped tar ball Cognitive-
Code.tar.gz and unpacked where you wish. If you have access to MatLab, just add
this folder with its sub folders to your MatLab path. If you don’t have such access,
download and install Octave on your laptop. Now Octave is more of a command
line tool, so the process of adding paths is a bit more tedious. When we start up an
Octave session, we use the following trick. We write up our paths in a file we call
MyPath.m. For us, this code looks like this
Listing 1.1: How to add paths to Octave
f u n c t i o n MyPath ( )
%
s 1 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / : ’ ;
s 2 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o /GSO : ’ ;
s 3 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o /HH: ’ ;
s 4 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / I n t e g r a t i o n : ’ ;
s 5 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / I n t e r p o l a t i o n : ’ ;
s 6 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / L i n e a r A l g e b r a : ’ ;
s 7 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / N e r n s t : ’ ;
s 8 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o /ODE : ’ ;
s 9 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / RootsOpt : ’ ;
s 1 0 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / L e t t e r s : ’ ;
s 1 1 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o / Graphs : ’ ;
s 1 2 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o /PDE : ’ ;
s 1 3 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o /FDPDE : ’ ;
s 1 4 = ’ / home/ p e t e r s j / M a t L a b F i l e s / B i o I n f o /3DCode ’ ;
s = [ s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s 1 2 ] ;
addpath ( s ) ;
end
The paths we want to add are setup as strings, here called s1 etc., and to use this, we
start up Octave like so. We copy MyPath.m into our working directory and then do
this
Listing 1.2: Set paths in octave
o c t a v e>> MyPath ( ) ;
We agree it is not as nice as working in MatLab, but it is free! You still have
to think a bit about how to do the paths. For example, in Peterson (2015c),
we develop two different ways to handle graphs in MatLab. The first is in the
1.2 Code 9
References
R. McElreath, R. Boyd, Mathematical Models of Social Evolution: A Guide for the Perplexed
(University of Chicago Press, Chicago, 2007)
J. Peterson, Calculus for Cognitive Scientists: Derivatives, Integration and Modeling, Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd., Singapore, 2015a, in Press)
J. Peterson, Calculus for Cognitive Scientists: Higher Order Models and Their Analysis, Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd., Singapore, 2015b, in Press)
J. Peterson, BioInformation Processing: A Primer On Computational Cognitive Science. Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd., Singapore, 2015c, in press)
Part II
Quantitative Tools
Chapter 2
Graham–Schmidt Orthogonalization
In our work, we need to talk about vectors and functions using more advanced ideas.
In this chapter, we begin by discussing how to integrate functions numerically with
MatLab so that we can calculate the inner product of two functions in code. In
the second text, we introduced the ideas of vector spaces, linear dependence and
independence of vectors. Now we apply these ideas to vector spaces of functions and
finish with the Graham–Schmidt Orthogonalization process.
i−1
xi = a + (b − a)
m−1
x1 = a
m−1
x2 = a + 1 × h, where h =
b−a
··· = ···
xm = a + (m − 1) × h
The functions we use to build the interpolating polynomial for the m points x1 to xn
have the form
p0 (x) = 1
j
pj (x) = i=1 (x − xi ), 1 ≤ j ≤ m.
Thus,
p0 (x) = 1
p1 (x) = (x − x1 )
p2 (x) = (x − x1 )(x − x2 )
p3 (x) = (x − x1 )(x − x2 )(x − x3 )
..
.
pm−1 (x) = (x − x1 )(x − x2 ) · · · (x − xm−1 )
The Newton Interpolating polynomial to f for this partition is given by the polynomial
of degree m − 1
where the numbers c1 through cm are chosen so that Pm−1 (xj ) = f (xj ). For conve-
nience, let’s look at a four point uniform partition of [a, b], {x1 , x2 , x3 , x4 } and figure
out how to find these numbers cj . Hence the uniform step size here is h = b−a 3
here.
The Newton interpolating polynomial in this case is given by
p3 (x1 ) = f1 = c1
p3 (x2 ) = f2 = c1 + c2 (x2 − x1 )
p3 (x3 ) = f3 = c1 + c2 (x3 − x1 ) + c3 (x3 − x1 )(x3 − x2 )
p4 (x4 ) = f4 = c1 + c2 (x4 − x1 ) + c3 (x4 − x1 )(x4 − x2 )
+ c4 (x4 − x1 )(x4 − x2 )(x4 − x3 )
f1 = c1
f2 = c1 + c2 x21
f3 = c1 + c2 x31 + c3 x31 x32
f4 = c1 + c2 x41 + c3 x41 x42 + c4 x41 x42 x43
This is the system of equations which is in lower triangular form and so it is easy to
solve.
2.1 Numerical Integration 15
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
1 0 0 0 c1 f1
⎢1 x21 0 0 ⎥ ⎢c2 ⎥ ⎢f 2 ⎥
⎢ ⎥ ⎢ ⎥= ⎢ ⎥
⎣1 x31 x31 x32 0 ⎦ ⎣c3 ⎦ ⎣ f3 ⎦
1 x41 x41 x42 x41 x42 x43 c4 f4
or
The final calculation is the worst. Again, for convenience, let gij = fij /xij . Then we
can rewrite c3 as
We know
c4 x42 x43 = f41 /x41 − f21 /x21 − g31 − g21 /x32 x42
Since all the differences xij = h, the uniform step size, these formulae can be then
be rewritten.
c1 = f1
f2 − f1
c2 =
h
f3 −f1
− f2 −f1
c3 = 2h h
h
f3 − 2f2 + f1
=
2h2
f4 − 3f3 + 3f2 − f1
c4 =
6h3
Although this is messy to do by hand, it is easy to do in MatLab. First, we set f to be
the vector of function values f (x1 ), . . . , f (xm ). If func is the function we are using
in MatLab for the function f , this is done with the lines f = func(x) where x
has already been setup with a linspace command.
and the right value of c2 in the component f(2). The values for c3 and c4 are
not yet right. The next pass through the loop will set c3 correctly. When k = 2,
the MatLab code becomes f(3:4) = ( f(3:4) - f(2) )./ (x(3:4)
- x(2) ) which is short for f(3) = ( f(3) - f(2) )/(x(3)-x(2)
and f(4) = ( f(4) - f(2) )/(x(4)-x(2). Now remember what f(2),
f(3) are at this point and plug them in. We find f(3) has become (f31 /x31 −
f21 /x21 )/x32 or (g31 − g21 )/x32 . This is the proper value c3 should have. We now have
f(4) is (f41 /x41 − f21 /x21 )/x42 or (g41 − g21 )/x42 . Finally, the last pass through the
loop uses k = 3 and results in the line f(4:4) = ( f(4:4) - f(3) )./
(x(4:4) - x(3) ) which is just f(4) = (f(4) - f(3) )/ (x(4) -
x(3) ). Now plug in what we have for f(3) to obtain
which is exactly the value that c4 should be. This careful walk through the code is
what we all do when we are trying to see if our ideas actually work. We usually do
it on scratch paper to make sure everything is as we expect. Typing it out is much
harder!
These polynomials are called Newton interpolants and we can use these ideas
b b
to approximate a f (x)dx as follows. We approximate a f (x)ds by replacing f by a
Newton interpolant on the interval [a, b]. For an m point uniformly spaced partition,
we will use the m − 1 degree polynomial Pm−1 whose coefficients can be computed
recursively like we do above. We replace the integrand f by Pm−1 to find
b b
f (x)dx ≈ Pm−1 (x)dx
a a
b m−1
= c1 + ck+1 ki=1 (x − xi ) dx
a k=1
m−1 b
= c1 (b − a) + ck+1 ki=1 (x − xi ) dx
k=1 a
b
ki=1 (x − xi )dx
a
We will let
Sm1 = m − 1
m−1
Sm,k+1 = ki=1 (s − i + 1)ds, 1 ≤ k ≤ m − 1
0
b m−1
f (x)dx ≈ c1 (b − a) + ck+1 hk+1 Sm,k+1
a k=1
m−1
= c1 h(m − 1) + ck+1 hk+1 Sm,k+1
k=1
b m m
f (x)dx ≈ c1 h(m − 1) + cn hn Smn = ck hk Smk .
a n=2 k=1
The value of m we choose to use gives rise then to what is called an m point rule and
given m we can easily evaluate the needed coefficients Sm1 through Smm . Here are
some calculations:
m−1
Sm2 = sds
0
(m − 1)2
=
2
m−1
Sm3 = s(s − 1)ds
0
(m − 1)2
= (2m − 5)
6
m−1
Sm4 = s(s − 1)(s − 2)ds
0
(m − 1)2 (m − 3)2
=
4
2.1 Numerical Integration 19
We will denote this Newton Polynomial approximation to this integral using m points
by the symbol QNC(m) . Hence, for the case m = 4, we have
S41 = 3
9
S42 =
2
9
S43 =
2
9
S44 =
4
This leads to the approximation
b
f (x)dx ≈ c1 hS41 + c2 h2 S42 + c3 h3 S43 + c4 h4 S44
a
9 f2 − f1 2 9 f3 − 2f2 + f1 3 9 f4 − 3f3 + 3f2 − f1 4
= 3f1 h + h + h + h
2 h 2 h2 4 6h3
9 9 9
= 3f1 h + (f2 − f1 )h + (f3 − 2f2 + f1 )h + (f4 − 3f3 + 3f2 − f1 )h
2 4 24
9 9 3
= 3f1 h + (f2 − f1 )h + (f3 − 2f2 + f1 )h + (f4 − 3f3 + 3f2 − f1 )h
2 4 8
3h
= (8f1 + 12f2 − 12f1 6f3 − 12f2 + 6f1 f4 − 3f3 + 3f2 − f1 )
8
3h
= (f1 + 3f2 + 3f3 + f4 )
8
b−a
But h is 3
here, so our final 4 point formula is
b
b−a
f (x)dx ≈ (f1 + 3f2 + 3f3 + f4 )
a 8
2.1.2 Homework
We store the Newton–Cotes Weight vectors in this short piece of Matlab code
f (x) = e−x
2
, which have matlab codes
π 2
Here is our runtime. The first example is 0 sin(x)dx = 1 and the second is 0 e−x dx
2
which can only be evaluated numerically and has the value approximately 0.882. You
can see this by using the built in MatLab numerical integration function quad. The
following session computes the integral using quad: here,we use the anonymous
function h to pass into quad.
2 0.7853981633974483
3 1.0022798774922104
4 1.0010049233142790
5 0.9999915654729927
12 6 0.9999952613861668
7 1.0000000258372352
8 1.0000000158229039
9 0.9999999999408976
Another Example ? (1= yes , 0=no ) . 1
17 E n t e r f u n c t i o n name : ’ func2 ’
Enter l e f t endpoint 0
Enter r i g h t endpoint : 2 . 0
m QNC( f u n c 2 , 0 . 0 0 0 , 2 . 0 0 0 ,m )
22 2 1.0183156388887342
3 0.8299444678581678
4 0.8622241875991991
5 0.8852702891231793
6 0.8838030970892903
27 7 0.8819161924221999
8 0.8819818734329694
9 0.8820864256236417
Another Example ? (1= yes , 0=no ) . 0
The ideas of linear independence and dependence are hard to grasp, so even though
we went through these ideas in Peterson (2015), it is a good idea to do a repeat
performance. So let’s go back and think about vectors in 2 . As you know, we think
of these as arrows with a tail fixed at the origin of the two dimensional coordinate
system we call the x–y plane. They also have a length or magnitude and this arrow
makes an angle with the positive x axis. Suppose we look at two such vectors,
E and F. Each vector has an x and a y component so that we can write
a c
E= , F=
b d
The cosine of the angle between them is proportional to the inner product < E, F >=
ac + bd. If this angle is 0 or π, the two vectors lie along the same line. In any case,
the angle associated with E is tan−1 ( ab ) and for F, tan−1 ( dc ). Hence, if the two vectors
lie on the same line, E must be a multiple of F. This means there is a number β so
that
2.2 Linearly Independent Functions 23
E = βF.
Now let the number 1 in front of E be called −α. Then the fact that E and F lie on
the same line implies there are 2 constants α and β, both not zero, so that
αE + βF = 0.
Note we could argue this way for vectors in 3 and even in n . Of course, our ability
to think of these things in terms of lying on the same line and so forth needs to be
extended to situations we can no longer draw, but the idea is essentially the same.
Instead of thinking of our two vectors as lying on the same line or not, we can rethink
what is happening here and try to identify what is happening in a more abstract
way. If our two vectors lie on the same line, they are not independent things in the
sense one is a multiple of the other. As we saw above, this implies there was a linear
equation connecting the two vectors which had to add up to 0. Hence, we might say
the vectors were not linearly independent or simply, they are linearly dependent.
Phrased this way, we are on to a way of stating this idea which can be used in many
more situations. We state this as a definition.
αE + βF = 0.
We can then easily extend this idea to any finite collection of such objects as follows.
α1 E1 + · · · + αN EN = 0.
Note we have changed the way we define the constants a bit. When there are more
than two objects involved, we can’t say, in general, that all of the constants must be
non zero.
24 2 Graham–Schmidt Orthogonalization
2.2.1 Functions
We can apply these ideas to functions f and g defined on some interval I. By this we
mean either
• I is all of , i.e. a = −∞ and b = ∞,
• I is half-infinite. This means a = −∞ and b is finite with I of the form (−∞, b)
or (−∞, b]. Similarly, I could have the form (a, ∞) or [a, ∞,
• I is an interval of the form (a, b), [a, b), (a, b] or [a, b] for finite a < b.
We would say f and g are linearly independent on the interval I if the equation
implies α1 and α2 must both be zero. Here is an example. The functions sin(t) and
cos(t) are linearly independent on because
also implies the above equation holds for the derivative of both sides giving
for all t. The determinant of the matrix here is cos2 (t) + sin2 (t) = 1 and so picking
any t we like, we find the unique solution is α1 = α2 = 0. Hence, these two functions
are linearly independent on . In fact, they are linearly independent on any interval I.
This leads to another important idea. Suppose f and g are linearly independent
differentiable functions on an interval I. Then, we know the system
f (t) g(t) α1 0
=
f (t) g (t) α2 0
for all t in I. This determinant comes up a lot and it is called the Wronskian of
the two functions f and g and it is denoted by the symbol W (f , g). Hence, we have
the implication: if f and g are linearly independent differentiable functions, then
2.2 Linearly Independent Functions 25
W (f , g) = 0 for all t in I. What about the converse? If the Wronskian is never zero
on I, then the system
f (t) g(t) α1 0
=
f (t) g (t) α2 0
Theorem 2.2.1 (Two Functions are Linearly Independent if and only if their Wron-
skian is not zero)
If f and g are differentiable functions on I, the Wronskian of f and g is defined to
be
f (t) g(t)
W (f , g) = det .
f (t) g (t)
where W (f , g) is the symbol for the Wronskian of f and g. Sometimes, this is just
written as W , if the context is clear. Then f and g are linearly independent on I if
and only if W (f , g) is non zero on I.
If f , g and h are twice differentiable on I, the Wronskian uses a third row of second
derivatives and the statement that these three functions are linearly independent on
I if and only if their Wronskian is non zero on I is proved essentially the same way.
The appropriate theorem is
Theorem 2.2.2 (Three Functions are Linearly Independent if and only if their Wron-
skian is not zero)
If f , g and h are twice differentiable functions on I, the Wronskian of f , g and h is
defined to be
⎛⎡ ⎤⎞
f (t) g(t) h(t)
W (f , g, h) = det ⎝⎣ f (t) g (t) h (t) ⎦⎠ .
f (t) g (t) h (t)
where W (f , g, h) is the symbol for the Wronskian of f and g. Then f , g and h are
linearly independent on I if and only if W (f , g, h) is non zero on I.
For example, to show the three functions f (t) = t, g(t) = sin(t) and h(t) = e2t are
linearly independent on , we could form their Wronskian
26 2 Graham–Schmidt Orthogonalization
⎛⎡ ⎤⎞
t sin(t) e2t
⎝ ⎣ 2t ⎦⎠ cos(t) 2e2t sin(t) e2t
W (f , g, h) = det 1 cos(t) 2e = t −
− sin(t) 4e2t − sin(t) 4e2t
0 − sin(t) 4e2t
zero for all t? If so, that would mean the functions t sin(t), t cos(t) and sin(t) are
linearly dependent. We could then form another Wronskian for these functions which
would be rather messy. To see these three new functions are linearly independent, it
is easier to just pick three points t from and solve the resulting linearly dependence
equations. Since t = 0 does not give any information, let’s try t = −π, t = π4 and
t = π2 . This gives the system
⎡ ⎤⎡ ⎤ ⎡ ⎤
−4π 0√ 0√ α1 0
⎣ π 2 π 2 −5 2 ⎦ ⎣α2 ⎦ = ⎣0⎦
4 2 2
0 2 π2 −5 α3 0
too. This shows t sin(t), t cos(t) and sin(t) are linearly independent and show the
line 4t cos(t) + 2t sin(t) − 5 sin(t) is not zero for all t. Hence, the functions f (t) = t,
g(t) = sin(t) and h(t) = e2t are linearly independent. As you can see, these calcu-
lations become messy quickly. Usually, the Wronskian approach for more than two
functions is too hard and we use the pick three suitable points ti , from I approach
and solve the resulting linear system. If we can show the solution is always 0, then
the functions are linearly independent.
2.2.2 Homework
Exercise 2.2.4 Prove et , e2t and e3t are linearly independent on . Use the pick
three points approach here.
2.2 Linearly Independent Functions 27
Exercise 2.2.5 Prove sin(t), sin(2t) and sin(3t) are linearly independent on . Use
the pick three points approach here.
Exercise 2.2.6 Prove 1, t and t 2 are linearly independent on . Use the pick three
points approach here.
We can make the ideas we have been talking about more formal. If we have a set
of objects u with a way to add them to create new objects in the set and a way to
scale them to make new objects, this is formally called a Vector Space with the set
denoted by V . For our purposes, we scale such objects with either real or complex
numbers. If the scalars are real numbers, we say V is a vector space over the reals;
otherwise, it is a vector space over the complex field.
Definition 2.3.1 (Vector Space)
Let V be a set of objects u with an additive operation ⊕ and a scaling method .
Formally, this means
1. Given any u and v, the operation of adding them together is written u ⊕ v and
results in the creation of a new object w in the vector space. This operation is
commutative which means the order of the operation is not important. Also, this
operation is associative as we can group any two objects together first, perform
this addition ⊕ and then do the others and the order of the grouping does not
matter.
2. Given any u and any number c (either real or complex, depending on the type
of vector space we have), the operation c u creates a new object. We call such
numbers scalars.
3. The scaling and additive operations are compatible in the sense that they satisfy
the distributive laws for scaling and addition.
4. There is a special object called o which functions as a zero so we always have
o ⊕ u = u ⊕ o = u.
5. There are additive inverses which means to each u there is a unique object u† so
that u ⊕ u† = o.
(0 + 0) u = (0 u) ⊕ (0 u)
0 = (1 − 1) u
= (1 u) ⊕ (−1 u)
Comment 2.3.2 We usually say this much simpler. The set of objects V is a vector
space over its scalar field if there are two operations which we denote by u + v and
cu which generate new objects in the vector space for any u, v and scalar c. We
then just add that these operations satisfy the usual commutative, associative and
distributive laws and there are unique additive inverses.
Comment 2.3.3 The objects are often called vectors and sometimes we denote them
by u although this notation is often too cumbersome.
Comment 2.3.4 To give examples of vector spaces, it is usually enough to specify
how the additive and scaling operations are done.
• Vectors in 2 , 3 and so forth are added and scaled by components.
• Matrices of the same size are added and scaled by components.
• A set of functions of similar characteristics uses as its additive operator, pointwise
addition. The new function (f ⊕ g) is defined pointwise by (f ⊕ g)(t) = f (t) +
g(t). Similarly, the new function c f is defined by c f is the function whose
value at t is (cf )(t) = cf (t). Classic examples are
1. C[a, b] is the set of all functions whose domain is [a, b] that are continuous on
the domain.
2. C 1 [a, b] is the set of all functions whose domain is [a, b] that are continuously
differentiable on the domain.
3. R[a, b] is the set of all functions whose domain is [a, b] that are Riemann inte-
grable on the domain.
There are many more, of course.
Vector spaces have two other important ideas associated with them. We have already
talked about linearly independent objects. Clearly, the kinds of objects we were
focusing on were from some vector space V . The first idea is that of the span of a
set.
Definition 2.3.2 (The Span Of A Set Of Vectors)
Given a finite set of vectors in a vector space V , W = {u1 , . . . , uN } for some
positive
integer N, the span of W is the collection of all new vectors of the form Ni=1 ci ui for
any choices of scalars c1 , . . . , cN . It is easy to see W is a vector space itself and since
it is a subset of V , we call it a vector subspace. The span of the set W is denoted
by SpW . If the set of vectors W is not finite, the definition is similar but we say the
span of W is the set of all vectors which can be written as Ni=1 ci ui for some finite
set of vectors u1 , . . . uN from W .
Then there is the notion of a basis for a vector space. First, we need to extend the
idea of linear independence to sets that are not necessarily finite.
Definition 2.3.3 (Linear Independence For Non Finite Sets)
Given a set of vectors in a vector space V , W , we say W is a linearly independent
subset if every finite set of vectors from W is linearly independent in the usual
manner.
2.3 Vector Spaces and Basis 29
Comment 2.3.5 In a vector space like n , the maximum size of a set of linearly
independent vectors is n, the dimension of the vector space.
Comment 2.3.6 Let’s look at the vector space C[0, 1], the set of all continuous
functions on [0, 1]. Let W be the set of all powers of t, {1, t, t 2 , t 3 , . . .}. We can
use the derivative technique to show this set is linearly independent even though
it is infinite in size. Take any finite subset from W . Label the resulting powers as
{n1 , n2 , . . . , np }. Write down the linear dependence equation
c1 t n1 + c2 t n2 + · · · + cp t np = 0.
Take np derivatives to find cp = 0 and then backtrack to find the other constants are
zero also. Hence C[0, 1] is an infinite dimensional vector space. It is also clear that
W does not span C[0, 1] as if this was true, every continuous function on [0, 1]
would be a polynomial of some finite degree. This is not true as sin(t), e−2t and many
others are not finite degree polynomials.
Now there is an important result that we use a lot in applied work. If we have an object
u in a Vector Space V , we often want to find to approximate u using an element from
a given subspace W of the vector space. To do this, we need to add another property
to the vector space. This is the notion of an inner product. We already know what
an inner product is in a simple vector space like n . Many vector spaces can have
an inner product structure added easily. For example, in C[a, b], since each object is
continuous, each object is Riemann integrable. Hence, given two functions f and g
b
from C[a, b], the real number given by a f (s)g(s)ds is well-defined. It satisfies all
the usual properties that the inner product for finite dimensional vectors in n does
also. These properties are so common we will codify them into a definition for what
an inner product for a vector space V should behave like.
Comment 2.4.1 The inner product is usually denoted with the symbol < , > instead
of ω(,). We will use this notation from now on.
Comment 2.4.2 When we have an inner product, we can measure the size or mag-
nitude of an object, as follows. We define the analogue of the euclidean norm of an
object u using the usual || || symbol as
√
||u|| = < u, u >.
This is called the norm induced by the inner product of the object. In C[a, b], with
b
the inner product < f , g > = a f (s)g(s)ds, the norm of a function f is thus ||f || =
b 2
a f (s)ds. This is called the L2 norm of f .
Proof The proof is different than the one you would see in a Calculus text for 2 ,
of course, and is covered in a typical course on beginning analysis.
Hence, objects can be perpendicular or orthogonal even if we can not interpret them
as vectors in 2 . We see two objects are orthogonal if their inner product is 0.
Now, let’s return to the idea of finding the best object in a subspace W to approximate
a given object u. This is an easy theorem to prove.
with
N
p∗ = < u, w i > wi .
i=1
N N
E(a1 , . . . , aN ) = < u, u > −2 ai < u, w i > + ai2 .
i=1 i=1
This is a quadratic expression and setting the gradient of E to zero, we find the critical
points
aj =< u, w j > .
This is a global minimum for the function E. Hence, the optimal p∗ has the form
N
∗
p = < u, w i > wi .
i=1
32 2 Graham–Schmidt Orthogonalization
Finally, we see
N
∗
< p − p , wj > = < p, wj > − < p, wk >< wk , wj >
k=1
= < p, wj > − < p, wj >= 0,
inner product < V1 , E1 >. Hence, the vector < V1 , E1 > E1 in the vector portion of
V2 which lies in the direction of V1 . Now subtract this from V2 . Hence, define W by
W = V2 − < V2 , E1 > E1 .
< W, E1 > = < V2 − < V2 , E1 > E1 , E1 > = < V2 , E1 > − < V2 , E1 >< E1 , E1 >
= < V2 , E1 > − < V2 , E1 > = 0,
since < E1 , E1 > = ||E1 ||2 = 1. Let E2 be the unit vector given by W/||W ||. Then
from the linearly independent vectors V1 and V2 , we have constructed two new
linearly independent vectors which are mutually orthogonal, E1 and E2 . We also see
both {V1 , V2 } and {E1 , E2 } are bases for 2 but the new one {E1 , E2 } is preferred as
the basis vectors are orthogonal. We can see the new vectors in Fig. 2.2.
You should be able to see that this procedure is easy to extend to three linearly
vectors in 3 and finite sets of linearly independent functions as well. This type
of procedure is called Graham–Schmidt Orthogonalization and we can see this
graphically in 2 . First we graph the vectors. This done with calls to plot. We start
with the function Draw2DGSO and add the vector drawing code first. We do all of
our drawing between a hold on and hold off so we keep drawing into the figure
until we are done.
Note we also use the new text command to add text at desired points in the graph.
Next, we find the new basis vectors E1 and E2 and graph them.
Now if you just did this, you will probably see the E1 and E2 don’t necessarily
look perpendicular in the figure. This is because by itself, MatLab/Octave does not
necessarily use a square picture frame for our graph. So the x and y axes need not be
2.5 Graham–Schmidt Orthogonalization 35
the same size. If they are not this, will make us lose the appearance of orthogonality!
So to fix this, we make sure the x and y axes are the same size. This requires some
messy code as follows.
This sets the axes correctly, but we still need to make sure the figure is square. We do
this be setting the figure size with figure(’Position’,[0,0,600,600]);
at the top of the file. The full code to see what is happening in 2 is then given in
the function Draw2DGSO given below.
T = [ 0 : V2 ( 1 ) : V2 ( 1 ) ] ;
t e x t ( V2 ( 1 ) / 2 , V2 ( 2 ) / 2 , ’ V2 ’ ) ;
% Now p l o t e1
25 E1 = V1/norm ( V1 ) ;
% f i n d e q u a t i o n o f l i n e f o r v e c t o r V1
i f E1 ( 1 ) == 0
e1 = @( t ) t ;
else
30 e1 = @( t ) ( E1 ( 2 ) /E1 ( 1 ) ) ∗ t ;
end
T = [ 0 : E1 ( 1 ) : E1 ( 1 ) ] ;
p l o t (T , e1 (T) , ’r ’ , ’ linewidth ’ , 4 ) ;
% f i n d e q u a t i o n o f l i n e f o r v e c t o r e2
35 W = V2 − d o t ( V2 , E1 ) ∗E1
E2 = W/norm (W) ;
% f i n d e q u a t i o n o f l i n e f o r v e c t o r e2
i f E2 ( 1 ) == 0
e2 = @( t ) t ;
40 else
e2 = @( t ) ( E2 ( 2 ) /E2 ( 1 ) ) ∗ t ;
end
T = [ 0 : E2 ( 1 ) : E2 ( 1 ) ] ;
p l o t (T , e2 (T) , ’r ’ , ’ linewidth ’ , 4 , ) ;
45 % set axis limits
xmin = V1 ( 1 ) ;
i f ( V2 ( 1 ) < xmin )
xmin = V2 ( 1 ) ;
xmax = V1 ( 1 ) ;
50 else
xmax = V2 ( 1 ) ;
end
ymin = V1 ( 2 ) ;
i f ( V2 ( 2 ) < ymin )
55 ymin = V2 ( 2 ) ;
ymax = V2 ( 2 ) ;
else
ymax = V2 ( 1 ) ;
end
60 %
umin = xmin ;
i f ( ymin < umin )
umin = ymin ;
end
65 umax = xmax ;
i f ( ymax > umax )
umax = ymax ;
end
a x i s ( [ umin , umax , umin , umax ] ) ;
70 hold o f f
end
It is simple to use this code. The example we just worked out would be done this
way in MatLab/Octave.
The way to look at this is that the first column of these three vectors specifies the
start position [0, 0, 0]T and the second column is the end position coordinates V1T .
We then plot the line and add text with
Note we set the width of the plotted line to be of size 2 which is thicker than size 1.
Once this line is plotted, we do the others. So the code to plot the three vectors as
lines starting at the origin is as follows; note, we wrap this code between hold on
and hold off statements so that we draw into our figure repeatedly until we are
done.
W = V2 − < V2 , E1 > E1
Then to make this show up nicely, we draw lines between V1 and V2 to make the
plane determined by these vectors stand out.
It is again easy to use this code. Here is a sample session. Since we make up our
vectors, we always set up a matrix A using the vectors as rows and then find the
40 2 Graham–Schmidt Orthogonalization
determinant of A. If that was 0, we would know our choice of vectors was not
linearly independent and we would have to make up new vectors for our example.
We can use this code to generate a nice 3D plot of this procedure as shown in Fig. 2.3.
If you do this in MatLab/Octave yourself, you can grab the graph and rotate it around
to make sure you see it in the orientation that makes the best sense to you.
h = v − < v, g 1 > g 1 .
• Find the length of h and set the second new basis object as follows:
h
g2 = .
||h||
• Subtract the part of w which lies along the object g 1 and the object g 2 .
• Find the length of h and set the third new basis object as follows:
h
g3 = .
||h||
It is easy to see how to generalize this to four or more objects. In fact, the procedure is
the same whether we are using vectors or functions as long as the objects are linearly
independent.
To see how we could do GSO in computationally, we will now show some simple
MatLab code. We will use the numerical integration code presented in this chapter
42 2 Graham–Schmidt Orthogonalization
which uses Newton–Cotes formulae and also show you how to use the built-in quadra-
ture codes in MatLab itself. In general, doing GSO on functions is hard, as you will
see, due to numerical errors. The code we have shown you so far is hard-wired to
the number of linearly independent objects. Hence, we wrote 2D and 3D GSO code
separately. Now we’ll try to write more general code where the argument we send
into the function is a collection of linearly independent objects. The code ideas that
follow are specialized to functions, but it wouldn’t be hard to write similar code for
sets of independent vectors in n .
The first code is the one that uses Newton–Cotes ideas. This is written to perform
GSO on powers of t, but it could be easily generalized to more general functions.
Some word of explanation are in order. First, we use a generic powers of t function
We then use extensively the idea of pointers to functions which in MatLab are called
function handles. We also use the idea of anonymous functions in MatLab. The
basic syntax for these is something like h = @(x)x.^2; which sets up h as
an anonymous function so that a session line like h(3) would be evaluated as 32 .
The letter h here is the function handle which allows us to refer to this function in
other code. We do the GSO using nested loops of anonymous functions using syntax
like
to calculate each of the new basis objects gk . We start with the zero anonymous
function phi and progressively add up the pieces we must subtract that lie along the
previous gj objects. Once this is done, we subtract this sum from the original object
and then divide by the length. This then creates the new object gk .
2.5 Graham–Schmidt Orthogonalization 43
We also use an inner product implementation nested inside this code as follows:
which uses the function handles f and g we pass with the desired Newton–Cotes
b
order to approximate a f gds.
function c = ip ( f , g , a , b , r )
53 w = WNC( r ) ;
s = linspace (a ,b , r ) ’;
u = zeros (r ,1) ;
u = f ( s ) .∗ g( s ) ;
c = ( b−a ) ∗ (w’ ∗ u ) ;
58 end
end
Here are some Newton–Cotes results. First, we try a low order 3 Newton–Cotes
method. There is too much error here. In the snippet below, d is the matrix of <
gi , gj > inner products which should be an identity matrix. Note the many off diagonal
terms which are close to 1 is absolute value. Much error here.
d =
n f = s q r t ( i p ( f {M+1} , f {M+1} , a , b ) ) ;
g{M+1} = @( x ) f {M+1}(x ) / n f ;
25 y = z e r o s ( 1 , NumPoints ) ;
d = z e r o s (N+1 ,N+1) ;
y = g{M+1}( t ) ;
z ( : ,M+1) = y ’ ;
f o r k=M+2:N+1
30 %compute n e x t o r t h o g o n a l p i e c e
p h i = @( x ) 0 ;
f o r j = M+1: k−1
c = i p ( f {k } , g{ j } , a , b ) ;
p h i = @( x ) ( p h i ( x )+c ∗g{ j } ( x ) ) ;
35 end
p s i = @( x ) ( f {k } ( x ) − p h i ( x ) ) ;
nf = sqrt ( ip ( psi , psi , a , b) ) ;
g{k} = @( x ) ( p s i ( x ) / n f ) ;
y = g{k } ( t ) ;
40 z (: , k) = y ’ ;
end
f o r i=M+1:N+1
f o r j=M+1:N+1
d ( i , j ) = i p ( g{ i } , g{ j } , a , b ) ;
45 end
end
d
function c = ip ( f , g , a , b)
50 v = @( x ) ( f ( x ) . ∗ g ( x ) ) ;
t o l = 1 . 0 e −9;
c = quadl ( v , a , b , t o l ) ;
end
55 end
There are other ways to do this too, but this should give the idea. The bottom line is
that it is straightforward to do theoretically, but devilishly hard to do in practice!
Reference
J. Peterson, Calculus for Cognitive Scientists: Higher Order Models and Their Analysis, Springer
Series on Cognitive Science and Technology. (Springer Science + Business Media, Singapore
2015 in press)
Chapter 3
Numerical Differential Equations
These methods extend the simple Euler method by essentially looking at Taylor
expansions of f (t0 + αh, x0 + βk) for various choices of α, β and k and then com-
bining them in interesting ways to estimate error. Hence, we say these methods are
based on differences of multiple function evaluations. The iteration scheme generates
a sequence {x̂n } starting at x̂0 = x0 using the following recursion equation:
where h is the step size we use for our underlying partition of the time space giving
ti = t0 + i h
for appropriate indices and F is some function of the previous approximate solution,
the step size and the right hand side function f . For convenience of exposition, we
will switch to a different notation for the approximate values x̂n . We will now denote
them by yn and so we solve the recursion
yn+1 = yn + F(tn , yn , h, f ) h
y0 = x0
which tells us we are using βh f (t, x) as our generic k term and our basic difference
is an interpolation between our base point f (t, x) and the new point f (t + αh, x +
βh f (t, x)). The amount of interpolation is determined by the values of γ1 and γ2 .
3.1.1 Expansions of F
where the term O(h 3 ) consists of the third order partial derivatives of f in various
combinations all evaluated at some point ξ between (t, x) and (t +αh, x +βh f (t, x))
and multiplied by h 3 . Hence, these terms go to zero like h 3 does. We can multiply
out the vectors and matrices involved and assuming f has continuous second order
partials, the terms f t x and f xt will match. Thus, we obtain
f (t + αh, x + βh f (t, x)) = f (t, x) + f t (t, x) (αh) + f x (t, x)(βh f (t, x))
1 2 1
+ h2 α f tt (t, x) + αβ f t x (t, x) f (t, x) + β 2 f x x (t, x) f (t, x)
2 2
+ O (h 3 ),
We know also
x = f
x = f t + f x f
x = f tt + 2 f t x f + f x x f 2 + f t f x + f x2 f.
3.1 Approximating Solutions Numerically 49
where for ease of exposition, the terms evaluated at (tn , xn ) are denoted with a
superscript (n). Now, plug all of this into the original expression for Tn+1 . Here, we
will use the fact that hO(h 3 ) = O(h 4 ) too. We find (you will need to do this with a
pad of paper in hand!)
(n) (n)
Tn+1 = h x (tn ) − γ1 f − γ2 f
2 1 (n) (n) (n)
+h x (tn ) − αγ2 f t − βγ2 f f x
2
3 1 1 2 (n) (n) (n) 1 2 (n) (n) 2
+h x (tn ) − α γ2 f tt − αβγ2 f t x f − β γ2 f x x ( f )
6 2 2
+ O(h 4 )
where we combine all the order h 4 terms into one O(h 4 ). Now, plug in all the x etc.
terms. This is indeed messy, so follow along on your paper. You will get
Tn+1
(n) (n)
f + f x f (n) (n) (n)
= h 1 − γ1 − γ2 f (n) + h 2 t − αγ2 f t − βγ2 f (n) f x
2
(n) (n) (n) (n) (n) 2 (n) (n) (n)
f + 2 ft x f + f x x ( f ) + f t f x + ( f x )2 f (n)
+ h 3 tt
6
1 (n) (n) 1 (n)
− α f tt − αβ f t x f (n) − β 2 f x x ( f (n) )2
2 2
+ O(h 4 )
50 3 Numerical Differential Equations
From the above, we see we can make Tn+1 have zero error in the h and h 2 terms by
choosing
γ1 + γ2 = 1 (3.2)
2αγ2 = 2βγ2 = 1. (3.3)
There are many choices for α, β, γ1 and γ2 all of which give Runge–Kutta order two
methods.
• If we choose γ1 = 0 and γ2 = 1, we find α = β = 21 . This gives the numerical
method
yn+1 = yn + h f (tn + 0.5h, xn + 0.5h f (tn , xn ))
yn+1 = yn + h f (tn , xn ).
which has a local error proportional to h 3 . Since this error is due to the fact that
we truncate the Taylor series expansions for f earlier, this is known as truncation
error.
Finally, to build a method which has local error proportional to h 4 , we would need
to look at an additional evaluation for f . We would have
and follow the same sort of discussion. We would combine the various Taylor expan-
sions from the base point (t, x) and find how to zero the h, h 2 and h 3 error. This
would then be the family of Runge–Kutta order 3 methods. All of these methods
have error proportional to h 4 . Note, we do 3 function evaluations using f at various
places to generate this method.
Finally, if we solve a vector system, we basically apply the technique above to
each component of the vector solution. So if the problem is four dimensional, we are
getting a constant C and D for each component. This, of course, complicates our life
as one component might have such a fast growing error that the error for it is very
large compared to the others. To control this, we generally cut the step size h to bring
down the error. Hence, the component whose error grows the fastest controls how
big a step size we can use in this type of technique. Thus, the Runge–Kutta methods
are based on multiple function evaluations.
Now in the theory of the numerical solution of ordinary differential equations
(ODEs) we find that there a several sources of error in finding a numerical approxi-
mation to the solution of our model process.
1. As discussed earlier, usually we approximate the function f using a few terms of
the Taylor series expansion of f around the point (tn , yn ) at each iteration. This
truncation of the Taylor series expansion is not the same as the true function f
of course, so there is an error made. Depending on how many terms we use in
the Taylor series expansion, the error can be large or small. If we let h denote the
difference tn+1 − tn , a fourth order method is one where this error is of the form
C h 5 for some constant C. This means that is you use a step size which is one
half h, the error decreases by a factor of 32. For a Runge–Kutta method to have
a local truncation error of order 5, we would need to do 4 function evaluations.
Now this error is local to this time step, so if we solve over a very long interval
with say N being 100,000 or more, the global error can grow quite large due to
the addition of so many small errors. So the numerical solution of an ODE can be
very accurate locally but still have a lot of problems when we try to solve over a
long time interval. For example, if we want to track a voltage pulse over 1000 ms,
if we use a step size of 10−4 this amounts to 107 individual steps. Even a fifth
order method can begin to have problems. This error is called truncation error.
2. We can’t represent numbers with perfect precision on any computer system, so
there is an error due to that which is called round-off error which is significant
over long computations.
52 3 Numerical Differential Equations
3. There is usually a modeling error also. The model we use does not perfectly
represent the physics, biology and so forth of our problem and so this also intro-
duces a mismatch between our solution and the reality we might measure in a
laboratory.
The basic code to implement the Runge–Kutta methods is broken into two pieces.
We have discussed this in the earlier volumes, but for completeness, we’ll add it here
too. The first one, RKstep.m implements the evaluation of the next approximation
solution at point (tn , yn ) given the old approximation at (tn−1 .yn−1 ). Here is that code
for Runge–Kutta codes of orders one to four.
Once the step is implemented, we solve the system using the RK steps like this:
3.2 Runge–Kutta Fehlberg Methods 53
yn+1 = yn + h n × F(tn , yn , h n , f )
y0 = y0
where h n is the step size we use at time point tn and the function F is some function
of the previous approximate solution yn , the step size h n and the dynamics vector
f . We usually choose a numerical method which allows us to estimate what a good
step size would be at each step n and then alter the step size to that optimal choice.
Our order two method discussed earlier used
1 1
F(tn , yn , h n , f ) = f tn + h n , xn + h n f (tn , xn )
2 2
• Use a Runge–Kutta order 4 method to generate a solution with local error propor-
tional to h 5 . This needs four function evaluations.
• Do one more function evaluation to obtain a Runge–Kutta order 5 method which
generates a solution with local error proportional to h 6 .
• We now have two ways to approximate the true solution x at t + h. This gives us a
way to compare the two approximations and to use one more function evaluation
to get an estimate of the error we are making. We can then use that error estimate
to see if our step size h is too large (that is the error is too big and we can compute
a new h using our information), just right (we keep h as it is) or too small (we
double the step size).
Finally, just to give you the flavor of what needs to be computed, here is a outline of the
standard Runge–Kutta method: in what follows K is a six dimensional vector which
we use to store intermediate results. If the system we want to solve is a vector system
(for example, the vector function f we use in our Hodgkin–Huxley model dynamics
discussed later is at least 4 dimensional and is also computationally complex) these
six function evaluations can really slow us down!!
8 Compute f (t + 14 h, z)
K[1] ⇐ hf
1.0
z ⇐ y + 32.0 (3.0K[0] + 9.0K[1])
Compute f (t + 3.08.0
h, z)
13 K[2] ⇐ hf
1.0
z ⇐ y + 2197.0 (1932.0K[0] − 7200.0K[1] + 7296.0K[2])
Compute f (t + 12.0
13.0
h, z)
K[3] ⇐ h ∗ f
439.0 3680.0 845.0
18 z ⇐ y + 216.0 K[0] − 8.0K[1] + 513.0
K[2] − 4104.0
K[3]
Compute f (t + h, z)
K[4] ⇐ hf
8.0 3544.0 1859.0 11.0
z ⇐ y − 27.0 K[0] + 2.0K[1] − 2565.0
K[2] + 4104.0
K[3] − 40.0
K[4]
23
Compute f (t + 12 h, z)
K[5] ⇐ hf
See if this step size is acceptable. Given the tolerances 1 , the amount of error we are
willing to make in our discretization of the problem, and 2 , the amount of weight
we wish to place on the solution we previously computed y, compute local decision
parameters
Now although this step size is acceptable, it might be smaller than necessary; deter-
mine if ||e||∞ is smaller than some fraction of η—heuristically, 0.3 is a reasonable
fraction to use.
It is possible that the step size is too big which can be determined by checking the
local error
The maximum error is larger than the discretization error. A reasonable way to reset
the step size to reset to 0.9h ||e||η ∞ . The rational behind this choice is that if the biggest
error in the new computed solution is 5 times the allowed tolerance sought—1 , then
1 +2 ||y||∞
51
⇐ 0.2(1 + 21 ||y||∞ ) Now if the tolerance 2 is r times 1 , the computation
above would reset h to be 0.18h(1 + r ||y||∞ ). Hence the maximum component size
of the solution y influences how the step size is reset. If ||y||∞ was 10, then for r
0.1, the new step size is 0.36h. Of course, the calculations are a bit more messy, as
the ||y||∞ term is constantly changing, but this should give you the idea.
56 3 Numerical Differential Equations
Again, we stress that since this algorithm uses six function evaluations per time step
that is actually used, it is very costly. We also use 6 evaluations each time we reset
h even if we don’t use this time step. So we trade off the cost of these computations
for the ability to widen our time step choice as much as possible to save computation
time.
The basic RKF5 code is implemented using some dynamics function f of the form
f (t, y).
hvals = h ;
tvals = t ;
yvals = y ;
3.2 Runge–Kutta Fehlberg Methods 57
26 fvals = f ;
w h i l e t < tend
k1 = h∗ f e v a l ( fname , t , y ) ;
z = y+k1 / 4 ;
31 k2 = h∗ f e v a l ( fname , t +(h / 4 ) , z ) ;
z = y + ( 3 . 0 / 3 2 . 0 ) ∗k1 + ( 9 . 0 / 3 2 . 0 ) ∗k2 ;
k3 = h∗ f e v a l ( fname , t +3.0∗ h / 8 , z ) ;
z = y + ( 1 9 3 2 . 0 / 2 1 9 7 . 0 ) ∗k1 − ( 7 2 0 0 . 0 / 2 1 9 7 . 0 ) ∗k2 + ( 7 2 9 6 . 0 / 2 1 9 7 . 0 ) ∗k3 ;
k4 = h∗ f e v a l ( fname , t +12.0∗ h / 1 3 . 0 , z ) ;
36 z = y + ( 4 3 9 . 0 / 2 1 6 . 0 ) ∗k1 −8.0∗ k2 + ( 3 6 8 0 . 0 / 5 1 3 . 0 ) ∗k3 − ( 8 4 5 . 0 / 4 1 0 4 . 0 ) ∗k4 ;
k5 = h∗ f e v a l ( fname , t+h , z ) ;
z = y − ( 8 . 0 / 2 7 . 0 ) ∗k1+2∗k2 − ( 3 5 4 4 . 0 / 2 5 6 5 . 0 ) ∗k3 + ( 1 8 5 9 . 0 / 4 1 0 4 . 0 ) ∗k4
− ( 1 1 . 0 / 4 0 . 0 ) ∗k5 ;
k6 = h∗ f e v a l ( fname , t+h / 2 , z ) ;
temp1 = a b s ( k1 / 3 6 0 . 0 − ( 1 2 8 . 0 / 4 2 7 5 . 0 ) ∗k3 − ( 2 1 9 7 . 0 / 7 5 2 4 0 . 0 ) ∗k4+k5
/ 5 0 . 0 + ( 2 . 0 / 5 5 . 0 ) ∗k6 ) ;
41 temp2 = a b s ( y ) ;
e r r o r 1 = max ( temp1 ) ;
e r r o r 2 = max ( temp2 ) ;
% a d j u s t i n g s t e p s i z e code
% e r r o r i s ok , s o u s e s t e p s i z e h
46 % k e e p new t , new y from h e r e
d e c i s i o n t o l = s t e p t o l+e r r o r t o l ∗ e r r o r 2 ;
i f error1 < decisiontol
y = y + ( 1 6 . 0 / 1 3 5 . 0 ) ∗k1 + ( 6 6 5 6 . 0 / 1 2 9 2 5 . 0 ) ∗k3 + ( 2 8 5 6 1 . 0 / 5 6 4 3 0 . 0 ) ∗k4
− ( 9 . 0 / 5 0 . 0 ) ∗k5 + ( 2 . 0 / 5 5 . 0 ) ∗k6 ;
t = t + h;
51 hvals = [ hvals h ] ;
tvals = [ tvals t ] ;
yvals = [ yvals y ] ;
fvals = [ fvals f ];
% we h a v e computed t h e new s t a t e . S h o u l d we k e e p
56 % the step s i z e ? I f error i s too small , double h
% b u t don ’ t e x c e e d m a x s t e p o r go p a s t f i n a l t i m e
i f e r r o r 1 <= . 3 ∗ d e c i s i o n t o l
h d o u b l e = 2∗h ;
htop = min ( hdouble , maxstep ) ;
61 h = min ( htop , tend −t ) ;
end
% p i c k i n g an o p t i m a l s t e p s i z e when e r r o r i s t o o l a r g e
else
i f e r r o r 1 >= s t e p t o l
66 hnew = . 9 ∗ h∗ d e c i s i o n t o l / e r r o r 1 ;
h c l i p p e d = max ( hnew , m i n s t e p ) ;
h = min ( h c l i p p e d , tend −t ) ;
end
end
71 end
So we will change the way we write our dynamics functions so that we can pass in
a parameter vector. Consider the dynamics for the tunnel diode model we discussed
previously. Instead of editing the dynamics file every time we want to change the
inductance, resistance, capacitance and incoming voltage values, we will now pass
them in as a parameter p. We alter the RKF5 algorithm to allow the function f to use
a parameter vector p. We will pass back the time vector, tvals, the solution vector,
yvals, the values of the dynamics, fvals and, just for educational purposes, the
vector of stepsize values, hvals. Since this is a step size adjustment method, the
time values are no longer uniformly spaced and it is interesting to see how the values
of the step size change over time. We need to pass in two tolerances, errortol
and steptol, that are used in determining how we adjust h, a minimum possible
step size, minstep, and maximum possible step size, maxstep, the name of the
dynamics function, fname, an initial step size guess, hinit, the initial and final
times, tinit and tend, and the vector of initial values, yinit.
25 t = tinit ;
y = yinit ;
f = f e v a l ( fname , params , t , y ) ;
hvals = h;
30 tvals = t;
yvals = y;
fvals = f;
w h i l e t < tend
35 k1 = h∗ f e v a l ( fname , params , t , y ) ;
z = y+k1 / 4 ;
k2 = h∗ f e v a l ( fname , params , t +(h / 4 ) , z ) ;
z = y + ( 3 . 0 / 3 2 . 0 ) ∗k1 + ( 9 . 0 / 3 2 . 0 ) ∗k2 ;
k3 = h∗ f e v a l ( fname , params , t +3.0∗ h / 8 , z ) ;
40 z = y + ( 1 9 3 2 . 0 / 2 1 9 7 . 0 ) ∗k1 − ( 7 2 0 0 . 0 / 2 1 9 7 . 0 ) ∗k2 + ( 7 2 9 6 . 0 / 2 1 9 7 . 0 ) ∗k3 ;
k4 = h∗ f e v a l ( fname , params , t +12.0∗ h / 1 3 . 0 , z ) ;
z = y + ( 4 3 9 . 0 / 2 1 6 . 0 ) ∗k1 −8.0∗ k2 + ( 3 6 8 0 . 0 / 5 1 3 . 0 ) ∗k3 − ( 8 4 5 . 0 / 4 1 0 4 . 0 ) ∗k4 ;
k5 = h∗ f e v a l ( fname , params , t+h , z ) ;
z = y − ( 8 . 0 / 2 7 . 0 ) ∗k1+2∗k2 − ( 3 5 4 4 . 0 / 2 5 6 5 . 0 ) ∗k3 + ( 1 8 5 9 . 0 / 4 1 0 4 . 0 ) ∗k4
− ( 1 1 . 0 / 4 0 . 0 ) ∗k5 ;
45 k6 = h∗ f e v a l ( fname , params , t+h / 2 , z ) ;
temp1 = a b s ( k1 / 3 6 0 . 0 − ( 1 2 8 . 0 / 4 2 7 5 . 0 ) ∗k3 − ( 2 1 9 7 . 0 / 7 5 2 4 0 . 0 ) ∗k4+k5
/ 5 0 . 0 + ( 2 . 0 / 5 5 . 0 ) ∗k6 ) ;
temp2 = a b s ( y ) ;
e r r o r 1 = max ( temp1 ) ;
e r r o r 2 = max ( temp2 ) ;
50 % a d j u s t i n g s t e p s i z e code
% e r r o r i s ok , s o u s e s t e p s i z e h
% k e e p new t , new y from h e r e
d e c i s i o n t o l = s t e p t o l+e r r o r t o l ∗ e r r o r 2 ;
i f error1 < decisiontol
55 y = y + ( 1 6 . 0 / 1 3 5 . 0 ) ∗k1 + ( 6 6 5 6 . 0 / 1 2 9 2 5 . 0 ) ∗k3 + ( 2 8 5 6 1 . 0 / 5 6 4 3 0 . 0 ) ∗k4
− ( 9 . 0 / 5 0 . 0 ) ∗k5 + ( 2 . 0 / 5 5 . 0 ) ∗k6 ;
t = t + h;
hvals = [ hvals h ] ;
tvals = [ tvals t ] ;
yvals = [ yvals y ] ;
60 fvals = [ fvals f ];
% we h a v e computed t h e new s t a t e . S h o u l d we k e e p
% the step s i z e ? I f error i s too small , double h
% b u t don ’ t e x c e e d m a x s t e p o r go p a s t f i n a l t i m e
i f e r r o r 1 <= . 3 ∗ d e c i s i o n t o l
65 h d o u b l e = 2∗h ;
htop = min ( hdouble , maxstep ) ;
h = min ( htop , tend −t ) ;
end
% p i c k i n g an o p t i m a l s t e p s i z e when e r r o r i s t o o l a r g e
70 else
i f e r r o r 1 >= s t e p t o l
hnew = . 9 ∗ h∗ d e c i s i o n t o l / e r r o r 1 ;
h c l i p p e d = max ( hnew , m i n s t e p ) ;
h = min ( h c l i p p e d , tend −t ) ;
75 end
end
end
Let’s try using this in some tests. We solve the tunnel diode model for L = 5 micro
henrys, C = 2 pico fahrads, R = 1.5 kilovolts and u = 1.2 Volts. We solve this with
the following lines in MatLab:
60 3 Numerical Differential Equations
This generates the plot of Vc versus time in Fig. 3.1 and I L versus time in Fig. 3.2.
We can also see the step size history in Fig. 3.3. Note how the step size changes
throughout the course of the solution. The step size plot shows us that to obtain
reasonable error, we need the h to be as low as 0.01 sometimes. For 10 time units,
this would require 1000 calculations requiring 6 function evaluations each time step
for a total of 6000 separate calculations. The RKF5 code here generates 91 individual
steps. We don’t keep track, however, how many times we reject a step size and restart.
Ignoring that, we have 546 function evaluations here. Even with restarts, this is a
significant reduction in computation time.
References
J. Peterson, Calculus for Cognitive Scientists: Derivatives, Integration and Modeling, Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd, Singapore, 2015a, in press)
J. Peterson, Calculus for Cognitive Scientists: Higher Order Models and Their Analysis, Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd, Singapore, 2015b, in press)
Part III
Deriving the Cable Model
Chapter 4
Biological Molecules
We will begin by going through some background material on what might be called
the chemistry of life; we had a hard time getting all of these things straight, so
for all of those mathematician and computer scientist types out there, here is
the introduction we wished we had when we started out. Molecules depend on the
interplay of non covalent and covalent interactions. Recall covalent bonds share
electrons in a tightly coupled way. There are three fundamental covalent bonds:
• Electrostatic Bonds due to Coulomb’s Law
• Hydrogen Bonds
• Vanderwaals Bonds
The force F between two molecules is called a molecular bond. Specifically, the
force between two charges is given by the formula:
1 q1 q2
F= (4.1)
4π0 r 2
where q1 and q2 are the charges on the bonding units, r is the distance between the
units and 0 is a basic constant which depends on the solution (air, water and so
forth) that the units live within. For example, in Fig. 4.1, we see a representation of
the electrostatic attraction between two common molecules; one with a carboxyl and
the other with an amide group on their ends.
Hydrogen bonds occur when a hydrogen atom is shared between two other atoms
as shown in Fig. 4.2: The atom to which the hydrogen is held more tightly is called the
hydrogen donor and the other one which is less tightly linked is called the hydrogen
acceptor. You can see this represented abstractly as follows:
O H
CH2− C N H3+ C −
O− H
Fig. 4.1 Electrostatic attraction between two molecules: one has a carboxyl group and the other
an amide group
O
O H O O H
The molecule on the left has a net negative charge and the one on the
right has a positive charge. Hence, there is an attraction due to the
charges.
Recall, one Angstrom, (1 Å), is 10−10 meters or 10−8 cm. Hydrogen bond lengths
vary as we can see in Table 4.1.
The donor in biological systems is an oxygen or nitrogen with a covalently attached
hydrogen. The acceptor is either oxygen or nitrogen. These bonds are highly direc-
tional. The strongest bonds occur when all the atoms line up or are collinear (think
alignment of the planets like in the Tomb Raider movie!). In Fig. 4.3, we see an
idealized helix structure with two attached carbon groups. The carbons are part of
the helix backbone and the rest of the molecular group spills out from the backbone.
4.1 Molecular Bonds 67
Energy 0
Distance
Repulsion decreases
Maximum attraction
If the two groups are separated enough along the background, the oxygen of the top
one is close enough physically to the nitrogen of the bottom group to allow them
to share a hydrogen. As you might expect, this sort of hydrogen bonding stabilizes
helical structures. This sort of upward spiral occurs in some protein configurations.
There is also a nonspecific attractive force which occurs when any two atoms
are 3–4 Å apart which is called a Vanderwaals Bond. The basis of this bond is that
the charge distribution around an atom is time dependent and at any instant is not
perfectly symmetrical. This “transient” asymmetry in an atom encourages a similar
asymmetry in the electron distribution around its neighboring atoms. The standard
picture of this force is shown in Fig. 4.4. The distance for maximum attraction varies
with the atom involved as we can see in Table 4.2.
68 4 Biological Molecules
Table 4.2 shows us the H–C has a 3.20 Å Vanderwaals interaction radius; H–N
has a 2.70 Å; and H–P has a 13.10 Å.
These three different types of bonds are therefore ranked according to their interaction
distance as shown in Table 4.3 where although we haven’t really discussed it, it should
be easy to understand that to pull a bond apart you would have to exert a force or in
other words do some work.
The amount of work you do can be measure in many units, but a common one in
biology is the calorie which can be converted to the standard physics energy measure
of ergs. The abbreviation kcal refers to 103 calories and the term mole refers to a
collection of 6.02 × 1023 (Avogadro’s Number) of molecules. Note that the covalent
bond is far stronger than the other bonds we have discussed!
The ultimate source of energy for most life is the sun (we will neglect here those
wonderful Mid-Atlantic smokers with a sulfur based life chemistry that does not
require any oxygen or photosynthesis at all). Energy can be stored in various ways
for later use—kind of like a battery. Some common energy sources are given in
Table 4.4.
−
O 99Å
H 105◦ H N H O C
+
The water molecule shown on the left has an asymmetric charge distri-
bution which has a profound effect on how molecules interact in liquid.
There is an attraction due to this asymmetry: the positive side of water
attracts the negative side of other molecules.
Basically, energy is moved from one storage source or another via special helper
molecules so that a living thing can perform its daily tasks of eating, growing, repro-
ducing and so forth. Now for us, we are going to concentrate on what happens inside
a cell. Most of us already know that the inside of a cell is a liquid solution which is
mostly water but contains many ions. You probably have this picture in your head
of an ion, like Na+ sitting inside the water close to other such ions with which they
can interact. The reality is more complicated. Water is made up of two hydrogens
and one oxygen and is what is called a polar molecule. As you can see from the left
side of Fig. 4.5, the geometry of the molecule means that the minus and plus charges
are not equally balanced. Hence, there is a charge gradient which we show with the
vertical arrow in the figure. The asymmetrical distribution of charge in water implies
that water molecules have a high affinity for each other and so water will compete
with other ions for hydrogens to share in a hydrogen bond.
If we had two molecules, say NH3 and COH2 , shown on the right side of Fig. 4.5,
we would see a hydrogen bond from between the oxygen of COH2 and the central
hydrogen of NH3 due to the asymmetrical distribution of charge in these molecules.
However, in an environment with water, the polarized water molecules are attracted
to these asymmetrical charge distributions also and so each of these molecules will
actually be surrounded by a cage of water molecules as shown in Fig. 4.6a. This shield
of polar water molecules around the molecules markedly reduces the attraction
between the + and − sites of the molecules. The same thing is true for ionized
molecules. If we denote a minus ion by a triangle with a minus inside it and a plus
ion by a square with a plus inside it, then this caging effect would look something
like what is shown in Fig. 4.6b.
This reduction occurs because the electric field of the shield opposes the electric
field of the ion and so weakens it. Consider common table salt, NaCl. This salt
can ionize into Na+ and Cl − , the exact amount that ionizes being dependent on the
solution you drop the salt into. The minus side of NaCl is very attractive to the
positive side of a polar water molecule which in turn is attracted to the negative side
of another water molecule. The same thing can be said about the positive side of the
salt. The presence of the polar water molecules actively encourages the splitting or
disassociating of the salt into two charged pieces. Hence, water can dissolve many
70 4 Biological Molecules
Fig. 4.6 The polarity of water induces cages to form. a Polar bonding with water. b Ion water cages
polar molecules, like the salt mentioned above, that serve as fuels, building blocks,
catalysts and information carriers. This causes a problem because the caging of an
ion by water molecules also inhibits ion interactions. Biological systems have solved
this problem by creating water free micro environments where polar interactions
have maximal strength. A consequence of this is that non polar groups aren’t split
apart by water and so it is energetically more favorable for non polar molecules to be
placed into one cage rather that have a separate water cage for each one. If we denote
a non polar molecule by the symbol NP enclosed in a circle, as a thought experiment
we can add our non polar molecule to a water environment. A cavity in the water
is created because the non polar molecule disrupts some hydrogen bonds of water
to itself. We see a picture like the one in Fig. 4.7a. This means that the number of
ways to from hydrogen bonds in the cage around the non polar molecule is smaller
that the the number of ways to from hydrogen bonds without the non polar molecule
present. This implies a cost to caging NP as order is created. Now if a second non
polar molecule NP is added, where will it go? If a second cage is created, more
hydrogen bonds are used up than if both NP molecules clump together inside one
cage. Remember always that order is costly and disorder is energetically favored.
So two non polar molecules clump together to give the picture shown in Fig. 4.7b.
Fig. 4.7 It is more efficient to group non polar molecules in cages. a Non polar molecule water
cages. b Non polar molecule group water cages
4.3 Hydrocarbons 71
4.3 Hydrocarbons
We need to learn a bit about the interesting molecules we will see in our quest to
build interesting models of cell function. Any good organic chemistry book is good
to have as a general reference on your shelf if you really like this stuff. We will begin
with simple hydrocarbons.
The basic thing to remember is that carbon’s outer shell of electrons is four shy of
being filled up. The far right edge of the periodic table consists of the noble gases or
elements because their outer most electron shells are completely populated. Hence,
they are considered special or noble. For us, a quick way to understand hydrocarbons
is to think of a carbon as wanting to add four more electrons so that it can be like
a noble gas. Of course, there are less anthropomorphic ways to look at it and really
nice physical models but looking at it in terms of a want really helps! We typically
draw a carbon atom, denoted by C, surrounded by four lines. Each of the lines is
ninety degrees apart and the lines represent a covalent bond with something. On the
left side of Fig. 4.8, we see a carbon with three of its covalent bonds with hydrogen
(hence, these lines go from the central C to an H) and the last covalent bond on the
left goes to an unknown molecule we denote as R. The R is called a residue and must
supply an electron for this last covalent bond. The molecule CH4 is called methyl
and is the simplest hydrocarbon (note the residue here is just a hydrogen); here we
have the molecule by CH3 R; for example, a ionized phosphate group, PO3− , would
supply such an electron and we would have the molecule CH3 PO3 . The next simplest
hydrocarbon is one that is built from two carbons. If the two carbons bond with each
other, that will leave six bonds left over to fill. If all of these bonds are filled with
hydrogens, we get the molecule ethyl with chemical formulae C2 H6 . Usually, we
think of the left most hydrogen as being replaced by a residue R which we show on
the right side of Fig. 4.8.
H H H
R C H R C C H
H H H
Methyl with Residue R Ethyl with Residue R
Carbon is represented by the symbol C and it can form four simple bonds. In the methyl
molecule, three of the bonds are taken up by hydrogen (symbol H) and the last one is used
to attach the residue (symbol R). In the ethyl molecule, the right most carbon uses its last
available bond to connect to the right most carbon. The right most carbon then has one last
bond that can be used to add the residue. The residue group itself be quite complicated.
Fig. 4.8 Methyl and ethyl can have side chains of arbitrary complexity called residues
72 4 Biological Molecules
Clearly, these groupings can get complicated very quickly! We won’t show any
more specific molecules, but you can get the flavor of all this by looking at Fig. 4.8
which shows a few of the residues we will see attached to various hydrocarbons. Of
course, we can also use more than two carbons and if you think about it a bit, as the
number of carbons we use goes up, there is no particular reason to think our pictures
will always organize the carbons in a central chain like beads on a string. Instead,
the carbons may forms side chains or branches, from circular groupings where the
last carbon in a group bonds to the first carbon and so forth. Also our pictures are
just idealizations to help us think about things; these molecules live in solutions, so
there are water cages, there are three dimensional concerns—like which carbons are
in a particular plane—and so forth. We won’t really discuss those things in a lot of
detail. However, the next step is to look at a special class of molecules called amino
acids and we will see some of this complication show up in our discussions there.
Methyl + residue hydroxyl: The chemical formula here is OH and since O needs
to add electrons so that its outer electron shell can be filled, we think of it as having
a polarity or charge of −2. Oxygen shares the single electron of hydrogen to add
one electron to oxygen’s outer shell bringing oxygen closer to a filled outer shell.
Hence, the hydrogen bond here brings the net charge of the hydroxyl group to
−1 as hydroxyl still needs one more electron. In fact, it is energetically favorable
for the hydroxyl group to accept an electron to fill the outermost shell. Hence,
hydroxyl can act as OH − in an ionic bond. Since carbon wants electrons to fill
its outer shell, it saves energy for the hydroxyl group and the carbon to share one
of carbon’s outer electrons in a covalent bond. If we use the hydroxyl group as
the residue for methyl, we replace one of the hydrogen’s in methyl with hydroxyl
giving CH3 –OH.
Methyl + residue amide: The chemical formula here is NH2 and since N needs
three electrons to fill its outer most electron shell, we think of it as having a
polarity or charge of −3. Here N forms a single bond with the two hydrogens.
This molecule can accept an electron and act as the ion NH2− or it can bond
covalently with carbon replacing one methyl’s hydrogens. The methyl plus amide
residue would then be written as CH3 –NH2 .
4.4 Amino Acids 73
Methyl + residue carbonyl: The hydroxyl OH can form a covalent bond with
carbon and an oxygen can form a double covalent bond with carbon to give
COOH. This molecule can accept an additional electron and function in an ionic
bond as COOH − or it can form a covalent bond giving the group OOH which can
add an electron and function in ionic bonds as OOH − . This group can then form a
double covalent bond with carbon and share two electrons. The carbon atom then
can share two more electrons with another oxygen in a double covalent bond. This
gives the molecule COOH. This molecule finds it favorable to add an electron
in the outer shell so that it can form ionic bonds. In this state, we would call it
COOH − . The carbonyl can also form a covalent bond with another carbon. The
methyl molecule plus carbonyl residue would then be written as CH3 –COOH.
Methyl + phosphate: The chemical formula here is PO4 . Phosphate, P, has three
covalent bonds that can be used to fill its outer most electron shell. It carries two
electrons in its 2s orbital and three in its 2p orbitals. Since oxygen needs two
electrons to fill its outermost shell, the 2s electrons of phosphorus can be shared
with one oxygen. This is still considered a single bond as only two electrons are
involved (it is actually called a coordinate covalent bond). However, this bond is
often drawn as a double bond in pictorial representations anyway. The remaining
three electrons carbon needs to fill its 2p orbitals are then obtained by covalent
sharing with oxygen. Each of these three oxygen’s sharing a 2p carbon orbital,
still needs an electron. Hence, phosphate can form the ionic bond using PO−3 4 .
The three oxygen covalently sharing 2p orbitals can then ionically bond with
hydrogens to create the molecule PO4 H3 which is usually written reversed as
H3 PO4 . If you leave off one of the hydrogens, we have H2 PO− 4 . which can form
a residue on methyl giving methyl phosphate H2 PO4 CH3 .
Phosphates in dilute water solutions exist in four forms. In a strongly basic solu-
tion, PO−34 predominates. However, in a weakly basic setting, HPO4 is more
−2
common. In a weakly acid water solution, the dominant form is H2 PO−1 4 and
finally, in a strongly acidic solution, H3 PO4 has the highest concentration.
Methyl + thiol: The chemical formula here is SH and since sulphur has two cova-
lent bonds that can be used to fill its outer most electron shell, we think of it as
having a polarity or charge of −2. Hence, the hydrogen bond here gives us an ion
with −1. So we can denote this group as SH − . A methyl molecule with a thiol
residue would thus have the formula SH–CH3 .
If we replace two of the hydrogens on the methyl group with an amide group
and a carboxyl group we obtain the molecule NH2 –COOH–CH2 . We can see how a
molecule of this type will be assembled using are simple pictorial representation of
covalent bonds in Fig. 4.9. As we mentioned earlier, we think of the central carbon as
the α carbon so that we distinguish it from any other carbons that are attached to it.
In fact, one way to look at all this is to think that since a carbon lacks four electrons
in its outer shell, it is energetically favorable to seek alliances with other molecules
so that it can fill these empty spots. This is, of course, a very anthropomorphic way
to look at it, but it helps you see what is going on at a gut level. So draw the α carbon
with four dots around it. These are the places in the outer shell that are not filled.
74 4 Biological Molecules
Chemical theory tells us that the outer shell of a carbon consists of four groupings
of two electrons each. So when we draw four groupings of just one electron per
group we are clearly indicating that one electron is missing in each group. Now the
amide molecule is handled in a similar way: the nitrogen is missing three electrons
in its outer shell which we indicate by three single dots placed around the nitrogen.
A hydrogen has only one electron as it has a very simple shell structure; hence it is
drawn as a single dot. So hydrogen would like one more electron to fill its outer shell
and the nitrogen would also like an additional electron to fill one of its groups. So
a good solution is for the two atoms to share an electron which we denote by a box
around the two single electrons. Continuing in this way, we can build an electron dot
diagram for the amide and its connection to the α carbon. The carbonyl is a little
more complicated. So far we have only looked at bonds between atoms where one
electron is shared. Another type of bond which is even stronger is one where two of
the outer shell electrons are shared between two atoms. The carbonyl group would
be written as C = OOH to reflect the fact the there is such a double bond between
the carbon and the first oxygen. Oxygen is missing only two electrons in its outer
shell and so this double bond which is indicated by the double bars = completely
fills the outer shell of the oxygen and half of the outer shell of the carbon. One of the
remaining two outer shell groups is then filled by a hydroxyl group, OH. Note the
hydroxyl group is an oxygen with one of its outer shell groups filled by a hydrogen
leaving one group to fill. It does this by sharing with one of the remaining two groups
that are open on the carbon of the carbonyl group. This leaves one opening left on
the carbon of the carbonyl which is used to make a shared bond with the α carbon
of the amino acid. The entire electron dot diagram is shown in Fig. 4.9 and it is very
complex. So we generally do not use this kind of explicit notation to draw an amino
acid. All of this detail is assumed in the simple skeleton formula we see on the left
4.4 Amino Acids 75
N H2 N H3+
H C COOH H C COO −
R R
Here we see a typical amino acid. The common elements are the carboxyl and amide groups.
Each amino acid then has a different residue. The carbon atom in the middle is called the
central carbon and the elements attached to it can be ionized in a variety of ways. This
ionization can substantially effect how the amino acid reacts with other molecules. Also,
charge distribution in amino acids is not uniform and so one side of an amino acid may act
more positive than the other.
COO − H
+H +H
3N C H 3N C COO −
H CH3
Glycine Alanine
Glycine’s residue is H and alanine’s, is CH3 . Glycine is the simplest amino acid and is
optically inactive.
COO − H
+H +H
3N C H 3N C COO −
CH2
CH
CH
CH3 CH3
CH3 CH3
Valine Leucine
Valine’s residue is CH(CH3 )2 and Leucine’s is CH2 CH(CH3 )2 . Note Valine and Leucine
have a longer residue which makes them hydrophobic.
COO − H
+H +H
3N C H 3N C COO −
H C CH3
CH2 CH2
CH2
CH2
CH3
Isoleucine Proline
Isoleucine’s residue is HCCH3 CH2 CH3 and Proline’s is a cyclic structure H2 CCH2 CH2
attaching to both the amide and the central carbon. Isoleucine is hydrophobic but Proline’s
cyclic residue is indifferent to water.
COO − COO −
+H C H +H C H
3N 3N
CH2 CH2
C C
H −C C−H H −C C−H
H −C C−H H −C C−H
C−H C − OH
Phenylalanine Tyrosine
Phenylalanine has a very hydrophobic phenyl group as a residue. The ring structure of the
phenyl group creates a localized cloud of pi electrons which make it very reactive. Tyrosine
replaces the bottom C − H with C − OH. The addition of the hydroxyl group makes this
amino acid hydrophilic. It is also very reactive due to the localized pi electron cloud.
hand side of Fig. 4.10 and in the notation CH2 NH2 COOH. The structure shown in
Fig. 4.9 is that of the amino acid glycine (G or Gly).
An amino acid can exist in ionized or non ionized forms as shown on the right
side of Fig. 4.10 and of course all we have said about water cages is still relevant.
Another important thing is the three dimensional (3D) configuration of an amino
acid. An amino acid occurs in two different 3D forms. To keep it simple, look at this
simple representation
4.4 Amino Acids 77
COO −
COO −
+H C H
3N
+H C H
CH2 3N
C C
H −C CH CH
CH2
H −C CH
SH
CH NH
Trytophan Cysteine
Tryptophan’s residue is fairly complicated with a phenyl group off to the left. It is very
hydrophobic. Cysteine plays a special role in biology because bonds similar to hydrogen
bonds can form between sulphur atoms occurring on different cysteine molecules. These
bonds are called disulfide links.
COO −
COO −
+H C H
3N
+H C H
3N
CH2
H C OH
CH2
H
S
CH3
Methionine Serine
Methionine is hydrophobic. If you look at Alalanine on the right side of Figure 4.11, you’ll
see that Serine is formed by Adding a hydroxyl group to the methyl residue on Alalanine.
This is called hydroxylation.
R + y axis
↑
H ← Cα → NH2 + x axis
↓
COOH
The R, H, NH2 and COOH are in the xy plane and the Cα carbon is along the positive
z axis above the side groups. The NH2 is on the positive x axis and the R is on the
positive y axis. This is the L form as if you take your right hand, line up the fingers
along the NH2 line and rotate your fingers left towards the residue R. Note your
78 4 Biological Molecules
COO −
COO −
+H C H
3N
+H C H
3N
CH2
H C OH
CH2
CH3
CH2
N H3+
Lysine Threonine
Lysine is very polar and hence, it is very hydrophobic. Threonine is a hydroxylated version
of Valine (see the left side of Figure 4.12).
COO −
COO −
+H
+H C H 3N C H
3N
CH2
(CH2 )3 C
NH C CH
NH NH
C N H2+
CH
N H2
Arganine Histidine
Arganine and Histidine are very polar, hydrophobic and are positive ions at neutral pH.
However, Histidine is a negative ion at physiological pH.
thumb points out of the page towards the positive z axis location of Cα . Also, it is
easy to visualize by just imaging grabbing the Cα and pulling it up out of the page
that the other groups lie in. The other form is called the R form and looks like this:
H
↑
COOH ← Cα → NH2 + x axis
↓
R − y axis
4.4 Amino Acids 79
H H
+H +H
3N C COO − 3N C COO −
CH2 (CH2 )2
C C
O O− O O−
Asparate Glutamate
H H
+H +H
3N C COO − 3N C COO −
CH2 (CH2 )2
C C
O N H2 O N H2
Asparagine Glutamine
The oxygen ion in Aspartate and Glutamate is replaced by the amide group in both
Asparagine and Glutamine. This change makes these amino acids neutral in charge.
The R, NH2 , H and COOH are in the xy plane and the Cα carbon is along the negative
z axis below the side groups. Here the NH2 is on the positive x axis but the R is on the
negative y axis. This is the R form as if you take your right hand, line up the fingers
along the NH2 line and rotate your fingers right towards the residue R. Hence, we
pull the Cα down below the page determined by the other groups here. For unknown
reasons, only L-forms are used in life on earth. Now there are a total of twenty amino
acids: we list them in Fig. 4.11 (glycine and alanine), Fig. 4.12 (valine and leucine),
Fig. 4.13 (isoleucine and proline), Fig. 4.14 (phenylalanine and tyrosine), Fig. 4.15
(tryptophan and cysteine), Fig. 4.16 (methionine and serine), Fig. 4.17 (lysine and
threonine), Fig. 4.18 (arginine and histidine), Fig. 4.19 (aspartate and glutamate) and
Fig. 4.20 (asparagine and glutamine). We have organized all of these figures so that
the residues are underneath the central carbon. As you can see, all have the common
80 4 Biological Molecules
amino acid structure with different residues R attached. The type of residue R deter-
mines the chemical and optical reactivity of the amino acids. For convenience, we
list the standard abbreviations for the names of the amino acids in table form as well
as in the figures in Table 4.5.
Amino acids can link up in chains because the COOH on one can bond with the NH2
on another as is seen in Fig. 4.21. In this figure, there is an outlined box that contains
the bond between the COOH and the NH2 ; this is called the peptide bond and is
shown in Fig. 4.21. The two amino acids that pair are connected by a rigid planar
bond. There is a Cα1 atom from amino acid one and another Cα2 from amino acid two
attached to this bond. The COOH and NH2 bond looks like this in block diagram
form. The COOH loses an OH and the NH2 loses an H to form the bond. Think of
bond as forming a rigid piece of cardboard and attached on the left is the amino acid
built around Cα1 and attached on the right is the amino acid build around Cα2 .
Now think of Cα1 as attached to a pencil which is plugged into the side of the peptide
bond. The Cα1 to CO bond is an axis that amino acid one is free to rotate about. Call
this angle of rotation 1 . We can do the same thing for the other side and talk about a
rotation angle 2 for the NH to Cα2 bond. In Fig. 4.21, R1 is the residue or side chain
for the first amino acid and R2 is the side chain for the other. Note amino acid one
starts with an N2 H group on the left and amino acid two ends with a COOH group
on the right
The peptide bond allows amino acids to link into chains as we show in the next block
diagram.
O (+y local axis)
↑
N2 H ← Cα1 → 1 ← C → N(+x local axis) → 2 ← Cα2 → COOH
↓
H
We show the peptide bond with a bit more three dimensionality in Fig. 4.22. We can
also draw the chain with two peptide bonds as we indicate in Fig. 4.23. You can see
that the side chains, R1 , R2 and R3 , then hang off of this chain of linked peptide bonds.
In a longer chain, there are two rotational degrees of freedom at the central carbon of
any two peptide bonds; i.e. a rotation angle with the peptide bond on the right and on
the left. This means that if we imagine the linked peptide bonds as beads on a string,
there is a great deal of flexibility possible in the three dimensional configuration of
these beads on the string. It isn’t hard to imagine that if the beads of string were long
enough, full loops could form and there could even be complicated repeated patterns
or motifs. Also, these beads on a string are molecular groupings that are inside a
solution that is full of various charged groups and the residues or side chains coming
off of the string are also potentially charged. Hence, there are many forces that act on
this string including hydrogen bonds between residues, Vanderwaals forces acting
on motifs and so forth.
Now the peptide bond is always the same, so let’s indicate it by a simple PP. Then
we have
It is then easy to show a chain of three amino acids with three separate rotation
angles. We have simplified the picture by replacing → 1 ← with just 1 and so
forth giving the block diagram
We also show this in Fig. 4.24. In this picture, we show the chain we just laid out in
block form above.
If we look at one three amino acid piece of a long chain, we would see the
following molecular form as represented in Fig. 4.25. As discussed above, as more
and more amino acids link up, we get a chain of peptide bonds whose geometry is
very complicated in solution. To get a handle on this kind of chain at a high level,
we need to abstract out of this a simpler representation.
In Fig. 4.26, we show how we can first drop most of the molecular detail and just
label the peptide bond planes using the letter P. We see we can now represent our chain
in the very compact form –NCCNCCNCCN–. This is called the backbone of the
chain. The molecules such as side chains and hydrogen atoms hang off the backbone
in the form that is most energetically favorable. Of course, this representation does
not show the particular amino acids in the chain, so another representation for a five
4.5 Peptide Bonds 83
amino acid chain would be A1 A2 A3 A4 A5 where the symbol Ai for appropriate indices
i represents one of the twenty amino acids. The peptide bonds are not even mentioned
as it is assumed that they are there. Also, note that in these amino acid chains, the
left end is an amino group and the right end is a carbonyl group.
We roughly classify chains of amino acids by their length. Hence, we say polypep-
tides are chains of amino acids less than or equal to 50 units long. Clearly, this naming
is a judgment call. Further, longer chains of amino acids are called proteins. As we
mentioned earlier, these long chains have side chains and other things that interact
via weak bonds or via other sorts of special bonds. For example, the amino acid
cysteine (see the right side of Fig. 4.15) has the residue CH2 SH and if the residues of
two cysteine’s in an amino acid chain can become physically close (this can happen
even if the two cysteines are very far apart on the chain because the chain twists and
bend in three dimensional space!), a S–S bond can form between the sulphur in the
SH groups. This is called a disulfide bond and it is yet another important bond for
amino acid chains. An example of this bond occurs in the protein insulin as shown
in Fig. 4.27. In Fig. 4.27, note we represent the amino acid chains by drawing them
as beads on a string: each bead is a circle containing the abbreviation of an amino
acid as we listed in Table 4.5. This is a very convenient representation even if much
detail is hidden.
In general, for a protein, there are four ways to look at its structure: The primary
structure is the sequence of amino acids in the chain as shown in Fig. 4.28a.
To know this, we need to know the order in which the amino acids occur in the
chain: this is called sequencing the protein. Due to amino acid interactions along the
chain, different regions of the full primary chain may form local three dimensional
structures. If we can determine these, we can say we know the secondary structure
of the protein. An example is a helix structure as shown in Fig. 4.28b. If we pack
Fig. 4.28 First and second order protein foldings. a Primary structure of a protein. b Secondary
structure of a protein
Fig. 4.29 Third and fourth order protein foldings. a Tertiary structure of a protein. b Quatenary
structure of a protein
secondary structures into one or more compact globular units called domains, we
obtain the tertiary structure an example of which is shown in Fig. 4.29a. In this
figure, each rectangle represents secondary structural elements. Finally, the protein
my contain several tertiary elements which are organized into larger structures.
This way the amino acid far apart in the primary sequence structure can be brought
close enough together in three dimensions to interact. This is called the quatenary
structure of the protein. An example is shown in Fig. 4.29b
Our genetic code is contained in linear chains of what are called nucleic acids in
combination with a particular type of sugar. These nucleic acid plus sugar groups are
used in a very specific way to code for each of the twenty amino acids we mentioned
in Sect. 4.4. So our next task is to discuss sugars and nucleic acids and the way these
things are used to code for the amino acids.
4.7.1 Sugars
Consider the cyclic hydrocarbon shown in Fig. 4.30a The ring you see in Fig. 4.30a
is formed from five carbons and one oxygen. For sugars, we label the carbons with
86 4 Biological Molecules
Fig. 4.31 Three dimensional Furan structures. a The 3 C endo Furan. b The 2 C endo Furan
Fig. 4.32 Oxygenated and de-oxygenated ribose sugars. a The ribose sugar. b The deoxy ribose
sugar
Fig. 4.33 Forms of nitrogenous bases. a The generic Purine. b The generic Pyrimidine
4.7.2 Nucleotides
There are four special nitrogenous bases which are important. They come in two
flavors: purines and pyrimidines. The purines have the form shown in Fig. 4.33a
while the pyrimidines have the one shown in Fig. 4.33b. There are two purines and
two pyrimidines we need to know about: the purines adenine and guanine and the
pyrimidines thymine and cytosine. These are commonly abbreviated as shown in
Table 4.6.
88 4 Biological Molecules
Fig. 4.34 Purine and Pyrimidine nucleotides. a Adenine. b Guanine. c Thymine. d Cytosine
on another nucleotide with a phosphate or PO3− bridge. Symbolically this looks like
Fig. 4.38. This chain of three nucleotides has a terminal OH on the 5 C of the top
sugar and a terminal OH on the 3 C of the bottom sugar. We often write this even
more abstractly as shown in Fig. 4.39 or just OH– Base 3 P Base 2 P Base 1
P –OH, where the P denotes a phosphate bridge. For example, for a chain with
bases adenine, adenine, cytosine and guanine, we would write OH–A–p–A–p–C–
p–G–OH or OHApApCpGOH. Even this is cumbersome, so we will leave out the
common phosphate bridges and terminal hydroxyl groups and simply write AACG. It
is thus understood the left end is an OH terminated 5 C and the right end an hydroxyl
terminated 3 C .
90 4 Biological Molecules
The last piece in this puzzle is the fact that the purine and pyrimidine nucleotides can
bond together in the following ways: A to T or T to A and C to G or G to C. We say that
adenine and thymine and cytosine and guanine are complementary nucleotides. This
bonding occurs because hydrogen bonds can form between the adjacent nitrogen or
between adjacent nitrogen and oxygen atoms. For example, look at the T –A bond
in Fig. 4.40. Note the bases are inside and the sugars outside. Finally, note how the
bonding is done for the cytosine and guanine components in Fig. 4.41. Now as we
have said, nucleotides can link into a long chain via the phosphate bond. Each base
in this chain is attracted to a complimentary base. It is energetically favorable for two
chains to form: chain one and its complement chain 2. In the following table, Table 4.7,
we see how this pairing is done for a short sequence of nucleotides. Note that the
5
pairs with a 3 and vice versa. Each pair of complimentary nucleotides is called
a complimentary base pair. The forces that act on the residues of the nucleotides
and between the nucleotides themselves coupled with the rigid nature of the peptide
bond between two nucleotides induce the two chains to form a double helix structure
under cellular conditions which in cross-section (see Fig. 4.42) has the bases inside
and the sugars outside.
92 4 Biological Molecules
The complimentary nucleotides fit into the spiral most efficiently with 100 degrees
of rotation and 1.5 Angstroms of rise between each base pair. Thus, there are 3.6 base
pairs for every 360 degrees of rotation around the spiral with a rise of 3.6 × 1.5 = 5.4
Angstroms. This is, of course, hard to draw! If you were looking down at the spiral
from the top, you could imagine each base to base pair as a set of bricks. You would
see a lower set of bricks and then the next pair of bricks above that pair would be
rotated 100 degrees as shown in Fig. 4.43. To make it easier to see what is going on,
only the top pair of bases have the attached sugars drawn in. You can see that when
you look down at this spiral, all the sugars are sticking outwards. The double helix is
called DNA when deoxy-ribose sugars are used on the nucleotides in our alphabet.
The name DNA stands for deoxy-ribose nucleic acid. A chain structure closely related
to DNA is what is called RNA, where the R refers to the fact that oxy-ribose sugars or
simply ribose sugars are used on the nucleotides in the alphabet used to build RNA.
The RNA alphabet is slightly different as the nucleotide Thymine,T, in the DNA
alphabet is replaced by the similar nucleotide Uracil, U. The chemical structure of
uracil is shown in Fig. 4.44 right next to the formula for thymine. Note that the only
difference is that carbon 5 C holds a methyl group in thymine and just a hydrogen in
4.7 Nucleic Acids 93
uracil. Despite these differences, uracil will still bond to adenine via a complimentary
bond. It is rare for the long string of oxygenated ribose nucleotides to form a double
helix, although within that long chain of nucleotides there can indeed be local hairpin
like structures and so forth. Amino acids are coded using nucleotides with what is
called the triplet code. This name came about because any set of three nucleotides
is used to construct one of the twenty amino acids through a complicated series of
steps. We will simply say that each triplet is mapped to an amino acid as a shorthand
for all of this detail. There are 20 amino acids and only 4 nucleotides. Hence, our
alphabet here is {A, C, T , G} The number of ways to take 3 things out of an alphabet
of 4 things is 64. To see this, think of a given triplet as a set of three empty slots;
there are 4 ways to fill slot 1, 4 independent ways to fill slot 2 (we know have 4 × 4
ways to fill the first two slots) and finally, 4 independent ways to fill slot 3. This gives
a total of 4 × 4 × 4 or 64 ways to fill the three slots independently. Since there are
only 20 amino acids, it is clear that more than one nucleotide triplet could be mapped
to a given amino acid! In a similar way, there are 64 different ways to form triplets
from the RNA alphabet {A, C, U, G}. We tend to identify these two sets of triplets
and the associated mapping to amino acids as it is just a matter of replacing the T in
one set with an U to obtain the other set.
94 4 Biological Molecules
Organisms on earth have evolved to use this nucleotide triplet to amino acid mapping
(it is not clear why this is the mapping used over other possible choices!). Now
proteins are strings of amino acids. So each amino acid in this string can be thought
of as the output of a mapping from the triplet code we have been discussing. Hence,
associated to each protein of length N is a long chain of nucleotides of length 3N.
Even though the series of steps by which the triplets are mapped into a protein is
very complicated, we can still get a reasonable grasp how proteins are made from
the information stored in the nucleotide chain by looking at the process with the
right level of abstraction. Here is an overview of the process of protein transcription.
When a protein is built, certain biological machines are used to find the appropriate
place in the DNA double helix where a long string of nucleotides which contains the
information needed to build the protein is stored. This long chain of nucleotides which
encodes the information to build a protein is called a gene. Biological machinery
unzips the double helix at this special point into two chains as shown in Fig. 4.45. A
complimentary copy of a DNA single strand fragment is made using complimentary
pairing but this time adenine pairs to uracil to create a fragment of RNA. This
fragment of RNA serves to transfer information encoded in the DNA fragment
to other places in the cell where the actual protein can be assembled. Hence, this
RNA fragment is given a special name—Messenger RNA or mRNA for short. This
transfer process is called transcription.
For example, the DNA fragment 5 ACCGTTACCGT 3 has the DNA complement
3
TGGCAATGGCA5 although in the cell, the complimentary RNA fragment
3
UGGCAAUGGCA5
is produced instead. Note again that the 5 pairs with a 3 and vice versa. There are many
details of course that we are leaving out. For example, there must be a special chunk
of nucleotides in the original DNA string that the specialized biological machines
can locate as the place to begin the unzipping process. The mRNA is transferred to a
special protein manufacturing facility called the ribosome where three nucleotides
at a time from the mRNA string are mapped into their corresponding amino acid.
From what we said earlier, there are 64 different triplets that can be made from the
alphabet {A, C, U, G} and it is this mapping that is used to assemble the protein chain
a little at a time. For each chain that is unzipped, a complimentary chain is attracted
to it in the fashion shown by Table 4.7. This complimentary chain will however be
built from the oxygenated deoxy-ribose or simply ribose nucleotides. Hence, this
complimentary chain is part of a complimentary RNA helix. As the amino acids
encoded by mRNA are built and exit from the ribosome into the fluid inside the
cell, the chain of amino acids or polypeptides begins to twist and curl into its three
96 4 Biological Molecules
dimensional shape based on all the forces acting on it. We can write this whole
process symbolically as DNA → mRNA → ribosome → Protein. This is known
as the Central Dogma of Molecular Biology.
Hence to decode a particular gene stored in DNA which has been translated to its
complimentary mRNA form all we need to know are which triplets are associated
with which amino acids. These triplets are called DNA Codons. The DNA alphabet
form of this mapping is given in Table 4.8; remember, the RNA form is the same, we
just replace the thymine’s (T’s) by uracil’s (U’s).
For example, the DNA sequence,
TAC|TAT|GTG|CTT|ACC|TCG|ATT
AUG|AUA|CAC|GAA|UGG|AGC|UAA
Note that shifting the reading by one base to the right or left changes completely
which triplets we read for coding into amino acids. This is called a frame shift and it
can certainly lead to a very different decoded protein. Changing one base in a given
triplet is a very local change and is a good example of a mutation or a kind of damage
produced by the environment or by aging or disease. Since the triplet code is quite
redundant, this may or may not result in a amino acid change. Even if it does, it
corresponds to altering one amino acid in a potentially long chain.
Chapter 5
Ion Movement
We are now in a position to discuss how ions move in and out of the membranes that
surround individual cells. This background will eventually enable us to understand
how an excitable cell can generate an action potential.
The functions carried out by membranes are essential to life. Membranes are highly
selective permeability barriers instead of impervious containers because they contain
specific pumps and gates as we have mentioned. Membranes control flow of infor-
mation between cells and their environment because they contain specific receptors
for external stimuli and they have mechanism by which they can generate chemical
or electrical signals.
Membranes have several important common attributes. They are sheet like struc-
tures a few molecules thick (60–100 Å). They are built from specialized molecules
called lipids together with proteins. The weight ratio of proteins to lipids is about
4 : 1. They also contain specialized molecules called carbohydrates (we haven’t
yet discussed these) that are linked to the lipids and proteins. Membrane lipids are
small molecules with a hydrophilic (i.e. attracted to water) and a hydrophobic (i.e.
repelled by water) part. These lipids spontaneously assemble or form into closed
bimolecular sheets in aqueous medium. Essentially, it is energetically most favor-
able for the hydrophilic parts to be on the outside near the water and the hydrophobic
parts to be inside away from the water. If you think about it a bit, it is not hard to see
that forming a sphere is a great way to get the water hating parts away from the water
by placing them inside the sphere and to get the water loving parts near the water by
placing them on the outside of the sphere. This lipid sheet is of course a barrier to the
flow of various kinds of molecules. Specific proteins mediate distinctive functions of
these membranes. Proteins serve many functions: as pumps, pumps, gates, receptors,
energy transducers and enzymes among others.
Fig. 5.1 The phospholipid membranes. a A typical phospholipid. b An abstract lipid. c The hy-
drophobic phospholipid end group. d The hydrophilic phospholipid end group
Membranes are thus structures or assemblies, whose constituent protein and lipid
molecules are held together by many non-covalent interactions which are coopera-
tive. Since the two faces of the membrane are different, they are called asymmetric
fluid structures which can be regarded as 2-D solutions of oriented proteins and
lipids. A typical membrane is built from what are called phospholipids which have
the generic appearance shown in Fig. 5.1a. Note the group shown in Fig. 5.1d is polar
and water soluble—i.e. hydrophilic and the other side, Fig. 5.1c, is water phobic. In
these drawings, we are depicting the phosphate bond as a double one.
Of course, this is way too much detail to draw; hence, we use the abstraction shown
in Fig. 5.1b using the term head for the hydrophilic part and tail for the hydrophobic
part. Thus, these lipids will spontaneously assemble so that the heads point out and
the tails point in allowing us to draw the self assembled membrane as in Fig. 5.2a.
We see the heads orient towards the water and the tails away from the water
spontaneously into this sheet structure. The assembly can also form a sphere rather
than a sheet as shown in Fig. 5.2b. A typical mammalian cell is 25 µm in radius where
a µm is 10−6 meter. Since 1 Å is 10−10 meter or 10−4 µm, we see a cell’s radius is
around 250,000 Å. Since the membrane is only 60 Å or so in thickness, we can see
the percentage of real estate of the cell concentrated in the membrane is very small.
So a molecule only has to go a small distance to get through the membrane but to
move through the interior of the cell (say to get to the nucleus) is a very long journey!
Another way of looking at this is that the cell has room in it for a lot of things!
5.2 The Physical Laws of Ion Movement 99
Fig. 5.2 Membrane structures. a The self assembled lipid sheet membrane structure. b The self
assembled lipid sphere membrane structure
We have relied on the wonderful books of Johnston and Wu (1995) and Weiss (1996)
in developing this discussion. They provide even more details and you should feel free
to look at these books. However, the amount of detail in them can be overwhelming,
so we are trying to offer a short version with just enough detail for our mathemati-
cal/biological engineer and computer scientist audience! An ion c can move across
a membrane due to several forces.
First, let’s talk about what concentration of a molecule means. For an molecule b,
the concentration of the ion is denoted by the symbol [b] and is measured in molecules
liter
.
Now, we hardly ever measure concentration in molecules per unit volume; instead
we use the fact that there are 6.02 × 1023 molecules in a Mole and usually measure
concentration in the units Moles
cm3
= M where for simplicity, the symbol M denotes the
concentration in Moles per cm3 . This special number is called Avogadro’s Number
and we will denote it by N A . In the discussions that follow, we will at first write all
of our concentrations in terms of molecules, but remember what we have said about
Moles as we will eventually switch to those units as they are more convenient.
The force that arises from the rate of change of the concentration of molecule b
acts on the molecules in the membrane to help move them across. The amount of
molecules that move across per unit area due to this force is labeled the diffusion
flux as flux is defined to a rate of transfer ( something
second
) per unit area. Now look at a
cross section of the membrane and draw a perpendicular line through it. We can then
measure position of molecules in the membrane with the variable x: the membrane
100 5 Ion Movement
Ohm’s Law of Drift relates the electrical field due to an charged molecule, i.e. an
ion, c, across a membrane to the drift of the ion across the membrane where drift is
the amount of ions that moves across the membrane per unit area. In mathematical
form
where it is important to define our variables and units very carefully. We have:
• Jdrift is the drift of the ion which has units of cmmolecules
2 −second .
∂V
E=−
∂x
Now the valence of ion c is the charge on the ion as an integer; i.e. the valence of
Cl − is −1 and the valence of Ca +2 is +2. We let the valence of the ion c be denoted
by z. It is possible to derive the following relation between concentration [c] and the
electrical conductivity ∂el :
5.2 The Physical Laws of Ion Movement 101
∂el = μ z [c]
where dimensional analysis shows us that the proportionality constant μ, called the
cm2
mobility of ion c, has units volt−second . Hence, we can rewrite Ohm’s Law of Drift as
∂V
Jdri f t = −μz[c] (5.3)
∂x
We see that the drift of charged particles goes against the electrical gradient.
There is a relation between the diffusion coefficient D and the mobility μ of an ion
which is called Einstein’s Relation. It says
κT
D= μ (5.4)
q
where
• κ is Boltzmann’s constant which is 1.38 × 10−23 joule
◦K .
q
μ has units volt−coulomb
◦K
K
coulombs volt−second
= cm
sec
which reduces to the units
of D.
Further, we see that Einstein’s Law says that diffusion and drift processes are addi-
tive because Ohm’s Law of Drift says Jdri f t is proportional to μ which by Einstein’s
Law is proportional to D and hence Jdiff c.
anions a j with valences z −j , we have the charge due to an ion is its valence times the
charge due to an electron e giving
N
M
z i+ e [ci ] = |z −j | e [c j ] (5.5)
i=1 j=1
Of course, in a living cell, the membrane is permeable, so Eq. 5.5 is not valid!
The membrane capacitance of a typical cell is one micro fahrad per unit area. Typi-
cally, we use F to denote the unit fahrads and the unit of area is cm2 . Also, recall that
µF
1F = 1 coulomb
volt
. Thus, the typical capacitance is 1.0 cm 2 . Now our simple cell will be
a sphere of radius 25 µM with the inside and outside filled with a fluid. Let’s assume
the ion c is in the extracellular fluid with concentration [c] = 0.5 M and is inside the
cell with concentration [c] = 0.5 M. The inside and outside of the cell are separated
by a biological membrane of the type we have discussed. We show our simple cell
model in Fig. 5.3.
Right now in our picture, the number of ions on both sides of the membrane are the
same. What if one side had more or less ions than the other? These uncompensated
ions would produce a voltage difference across the membrane because charge is
capacitance times voltage (q = cV ). Hence, if we wanted to produce a one volt
potential difference across the membrane, we can compute how many uncompensated
ions, δ[c] would be needed:
10−6 F coulombs
δ[c] = × 1.0 V = 10−6
cm2 cm2
Now the typical voltage difference across a biological membrane is on the order of
100 millivolts or less (1 millivolt is 10−3 V and is abbreviated mV). The capacitance
of the membrane per cm2 multiplied by the desired voltage difference of 100 mV
will give the uncompensated charge, n, per cm2 we need. Thus, we find
ions Mole
0.5 × N A × V ol = 1.97 × 1016 ions
Mole cm3
implying the percentage of uncompensated ions to give rise to a voltage difference
of 100 mV is only 2.51 × 10−7 %.
J = Jdrift + Jdiff
Thus, applying Ohm’s Law 5.3 and Ficke’s Law 5.1, we have
∂V ∂[c]
J = −μ z [c] −D
∂x ∂x
Next, we use Einstein’s Relation 5.4 to replace the diffusion constant D to obtain
what is called the Nernst Planck equation.
104 5 Ion Movement
∂V κT ∂[c]
J = −μ z [c] − μ
∂x q ∂x
∂V κT ∂[c]
= −μ z [c] + (5.6)
∂x q ∂x
This equation has the units of current per unit area because
R(T = 1) joules
= 8.614 × 10−5 (5.9)
F coulomb
κT RT
Thus, since q
is the same as F
, they are interchangeable in Eq. 5.8 giving
J μ ∂V ∂[c]
I = zF = − z F [c]
2
+ z RT (5.10)
NA NA ∂x ∂x
The current form of the Nernst–Planck equation given in Eq. 5.10 describes ionic
current flow driven by electro-chemical potentials (concentration gradients and elec-
tric fields). We know that the current I is opposite to ∂V
∂x
, with ∂[c]
∂x
if the valence z
∂[c]
is negative and against ∂x if the valence z is positive. When the net current due to
all of these contributions is zero, we have I = 0 and by the Nernst–Planck Current
Equation 5.10, we have
μ ∂V ∂[c]
0=− z F [c]
2
+ z RT
NA ∂x ∂x
implying
∂V ∂[c]
z 2 F [c] = −z RT
∂x ∂x
or since there is only one independent variable x
dV RT 1 d[c]
=−
dx z F [c] d x
106 5 Ion Movement
Now let x1 and x2 be the start and end position of the membrane, respectively.
Now, integrate between positions x1 and x2 :
x2 x2
dV RT d[c]
dx = − dx
x1 dx zF x1 [c]
Now assume that the membrane voltage and the concentration [c] are functions of
the position x in the membrane and hence can be written as V (x) and [c](x); we
will then let V (x1 ) = V1 , V (x2 ) = V2 , [c](x1 ) = [c]1 and [c](x2 ) = [c]2 . Then, upon
integrating, we find
V2 [c]2
RT d[c]
dV = −
V1 z F [c]1 [c]
RT [c]2
V2 − V1 = − ln
zF [c]1
Vm = Vin − Vout
For a given ion c, the equilibrium potential of the ion is denoted by E c and is defined
as the potential across the membrane which gives a zero Nernst–Planck current. We
will let the position x1 be the place where the membrane starts and x2 , the place where
the membrane ends. Here, the thickness of the membrane is not really important. So
the potential at x1 will be considered the inner potential Vin and the potential at x2 will
be considered the inner potential Vout . From our discussions above, we see that the
assumption that I is zero implies that the difference V1 − V2 is −E c and so labeling
[c]2 and [c]1 as [c]out and [c]in respectively, we arrive at the following equation:
RT [c]out
Ec = ln (5.11)
zF [c]in
This important equation is called the Nernst equation and is an explicit expression
for the equilibrium potential of an ion species in terms of its concentrations inside
and outside of the cell membrane.
5.4.1 An Example
Let’s compute some equilibrium potentials. In Table 5.1, we see some typical inner
and outer ion concentrations and the corresponding equilibrium voltages. Unless
otherwise noted, we will assume a temperature of 70 degrees Fahrenheit—about
5.4 Equilibrium Conditions: The Nernst Equation 107
R 8.31 joules mV
= = 0.0861 (5.12)
F 96,480 coulomb − degrees Kelvin degrees Kelvin
Let’s look at some examples of this sort of calculation. While it is not hard to do
this calculation, we have found that all the different units are confusing to students
coming from the mixed background we see. Now at a temperature of 294.11 Kelvin,
RT
F
becomes 25.32 mV. Hence, all of our equilibrium voltage calculations take the
form
1 [c]out
Ec = 25.32 ln mV
z [c]in
where all we have to do is to use the correct valence of our ion c. Also, remember
that the symbol ln means we should use a natural logarithm! Here are some explicit
examples for this temperature:
1. For frog muscle, typical inner and outer concentrations for potassium are [K + ]out
is 2.25 mM (the unit mM means milliMoles) with [K + ]in at 124.0 mM. Then,
since z is +1, we have
2.25
E K + = 25.32 ln mV = 25.32 × (−4.0094) mV = −101.5168 mV
124.0
2. For frog muscle, typical inner and outer concentrations for chlorine are [Cl − ]out
is 77.5 mM with [Cl − ]in at 1.5 mM. Then, since z is −1, we have
77.5
E Cl − = −25.32 ln mV = −25.32 × (3.944) mV = −99.88 mV
1.5
3. For frog muscle, typical inner and outer concentrations for Calcium are [Ca +2 ]out
is 2.1 mM (the unit mM means milliMoles) with [Ca +2 ]in at 10−4 mM. Then, since
z is +2, we have
2.1
E Ca + = 0.5 × 25.32 ln mV = 12.66 × (9.9523) mV = 126.00 mV
10−4
We summarize the results above as well as two other sets of calculations in Table 5.1.
In the first two parts of the table we use a temperature of 294.11 Kelvin and the
conversion RT F
is 25.32 mV. In the last part, the temperature is higher (310 Kelvin)
and so RTF
becomes 26.69 mV. All concentrations are given in mM.
108 5 Ion Movement
Now let’s do some calculations using MatLab for various ions. First, we will write a
MatLab function to compute the Nernst voltage. Here is a simple MatLab function
to do this.
Centigrade of 37 degrees C (quite hot!) and the inside concentration is 124 milliMoles
with the outside concentration 2.5 milliMoles.
This function call produces the following output (edited to remove extra blank lines).
5.5.1 Homework
Exercise 5.5.1 Use the MatLab functions we have written above to generate a
plot of the Nernst potential versus inside concentration for the Sodium ion at
T = 20 degrees C. Assume the outside concentration is always 440 milliMoles and
let the inner concentration vary from 2 to 120 in 200 uniformly spaced steps.
Exercise 5.5.2 Rewrite our Nernst and NernstMemVolt functions to accept temper-
ature arguments in degrees Fahrenheit.
Exercise 5.5.3 Rewrite our NernstMemVolt function for just Sodium and Potassium
ions.
110 5 Ion Movement
Exercise 5.5.4 For the following outside and inside ion concentrations, calculate
the Nernst voltages at equilibrium for the temperatures 45, 55, 65 and 72 ◦ F.
[c]in [c]out
K+ 130.0 5.25
Na+ 15.4 129.0
Cl− 1.8 77.5
Ca+2 10−5 3.1
The electrical potential across the membrane is determined by how well molecules
get through the membrane (its permeability) and the concentration gradients for the
ions of interest. To get a handle on this let’s look at an imaginary cell which we
will visualize as an array. The two vertical sides you see on each side of the array
represent the cell membrane. There is cell membrane on the top and bottom of this
array also, but we don’t show it. We will label the part outside the box as the Outside
and the part inside as Inside. If we wish to add a way for a specific type of ion to
enter the cell, we will label this entry port as gates on the bottom of the array. We
will assume our temperature is 70 ◦ F which is 21.11 ◦ C and 294.11 ◦ K.
To get started, let’s assume no potential difference across the membrane and add
100 mM of KCl to both the inside and outside of the cell as shown.
Inside
Outside
100 mM 100 mM
K Cl
K Cl
The KCl promptly disassociates into an equal amount of K + and Cl − in both the
inside and outside of the cell as shown below:
5.6 Electrical Signaling 111
Inside
Outside
100 mM K + 100 mM K +
100 mM Cl −
100 mM Cl −
Now, we add to the cell channels that are selectively permeable to the ion K + .
These gates allow K + to flow back and forth across the membrane until there is a
balance between the chemical diffusion force and the electric force. We don’t expect
a nonzero equilibrium potential because there is charge and concentration balance
already. Using Nernst’s Equation 5.11 we see since z is 1 that for our temperature,
RT
zF
is 25.32 mV and
RT [K + ]out 100
EK = ln −
= 25.32 ln =0
F [K ]in 100
Inside
(K + Gates)
Outside
100 mM K + 100 mM K +
100 mM Cl −
100 mM Cl −
Inside
(K + Gates)
Outside
10 mM K + 100 mM K +
10 mM Cl −
100 mM Cl −
112 5 Ion Movement
This set up a concentration gradient with an implied chemical and electrical force.
We see
10
E K = 25.32 ln
100
= −58.30
Hence, Vin − Vout is −58.30 mV and so the outside potential is 58.30 more than
the inside; more commonly, we say the inside is 58.30 mV more negative than the
outside.
Homework
Exercise 5.6.1 Consider a cell permeable to K + with the following concentrations
on ions:
Inside
(K + Gates)
Outside
90 mM K + 120 mM K +
90 mM Cl −
120 mM Cl −
Now add 100 mM NaCl to the outside and 10 mM to the inside of the cell. We then
have
Inside
(K + Gates)
Outside
10 mM K + 100 mM N a + 100 mM K + 10 mM N a +
10 mM Cl − 100 mM Cl −
100 mM Cl − 10 mM Cl −
Note there is charge balance inside and outside but since the membrane is permeable
to K + , there is still a concentration gradient for K + . There is no concentration
gradient for Cl − . Since the membrane wall is not permeable to N a + , the N a +
5.6 Electrical Signaling 113
concentration gradient has no effect. The K + concentration gradient is still the same
as our previous example, the equilibrium voltage for potassium remains the same.
Next replace the potassium gates with sodium gates as shown below. We can then
use the Nernst equation to calculate the equilibrium voltage for N a + :
100
E N a = 25.32 ln
10
= 58.30
Inside
(N a + Gates)
Outside
10 mM K + 100 mM N a + 100 mM K + 10 mM N a +
10 mM Cl − 100 mM Cl −
100 mM Cl − 10 mM Cl −
Let’s look at what happens if the cell has two types of gates. The cell now looks like
this:
Inside
(K + Gates)
Outside (N a + Gates)
10 mM K + 100 mM N a +
10 mM Cl − 100 mM Cl − 100 mM K + 10 mM N a +
100 mM Cl − 10 mM Cl −
There are now two currents: K + is leaving the cell because there is more K + inside
than outside and N a + is going into the cell because there is more N a + outside. What
determines the resting potential now?
114 5 Ion Movement
Recall Ohm’s Law for a simple circuit: the current across a resistor is the voltage
across the resistor divided by the resistance; in familiar terms I = VR using time
honored symbols for current, voltage and resistance. It is easy to see how this idea
fits here: there is resistance to the movement of an ion through the membrane. Since
I = R1 V , we see that the ion current through the membrane is proportional to the
resistance to that flow. The term R1 seems to be a nice measure of how well ions
flow or conduct through the membrane. We will call R1 the conductance of the ion
through the membrane. Conductance is generally denoted by the symbol g. Clearly,
the resistance and conductance associated to a given ion are things that will require
very complex modeling even if they are pretty straightforward concepts. We will
develop some very sophisticated models in future chapters, but for now, for an ion
c, we will use
Ic = gc (Vm − E c )
where E c is the equilibrium voltage for the ion c that comes from the Nernst Equation,
Ic is the ionic current for ion c and gc is the conductance. Finally, we denote the voltage
across the membrane to be Vm . Note the difference between the membrane voltage
and the equilibrium ion voltage provides the electromotive force or emf that drives
the ion. In our cell, we have both potassium and sodium ions, so we have
i K = g K (Vm − E K ), i N a = g N a (Vm − E N a ).
At steady state, the current flows due to the two ions should sum to zero; hence
iK + iNa = 0
implying
0 = g K (Vm − E K ) + g N a (Vm − E N a )
You will note that although we have already calculated E K and E N a here, we are not
able to compute Vm because we do not know the particular ionic conductances.
5.6.5.1 Homework
Let’s look at what happens if the cell has K + and N a + gates. The cell now looks
like this:
5.6 Electrical Signaling 115
Inside
(K + Gates)
Outside (N a + Gates)
20 mM K + 130 mM N a +
20 mM Cl − 130 mM Cl − 80 mM K + 10 mM N a +
15 mM Cl − 15 mM Cl −
i ion = gc (Vm − E c )
where Vm , as mentioned, is the actual membrane voltage, c denotes our ion, gc is the
conductance associated with ion c and E c is the Nernst equilibrium voltage. Hence
for three ions, potassium (K + ), sodium (N a + ) and chlorine (Cl − ), we have
There is also a capacitative current. We know the voltage drop across the capacitor
Cm is given by Vqmm ; hence, the charge across the capacitor is Cm Vm implying the
capacitative current is
116 5 Ion Movement
d Vm
i m = Cm
dt
At steady state, i m is zero and the ionic currents must sum to zero giving
i K + i N a + i Cl = 0
Hence,
1 rNa rCl
Vm = EK + ENa + E Cl
1 + r N a + rCl 1 + r N a + rCl 1 + r N a + rCl
Hence, if we are given the needed conductance ratios, we can compute the membrane
voltage at equilibrium for multiple ions. Some comments are in order:
• By convention, we set Vout to be 0 so that Vm = Vin − Vout is −58.3 mV in our
first K + gate example.
5.6 Electrical Signaling 117
• These equations are only approximately true, but still of great importance in guid-
ing our understanding.
• Ion currents flowing through a channel try to move the membrane potential toward
the equilibrium potential value for that ion.
• If several different ion channels are open, the summed currents drive the membrane
potential to a value determined by the relative conductances of the ions.
• Since an ion channel is open briefly, the membrane potentials can’t stabilize and
so there will always be transient ion currents. For example, if N a + channels pop
open briefly, there will be transient N a + currents.
Finally, let’s do a simple example: assume there are just sodium and potassium gates
and the relative conductances of N a + and K + are 4 : 1. Then r N a is 4 and for the
concentrations in our examples above:
1 4
Vm = (−58.3) mV + (58.3) mV = 34.98 mV
5 5
5.6.6.1 Homework
Now let’s do some calculations using MatLab for this situation. First, we will write
a MatLab function to compute the Nernst voltage across the membrane using our
conductance model. Here is a simple MatLab function to do this which uses our
previous Nernst function. We will build a function which assumes the membrane is
permeable to using potassium, sodium and chlorine ions.
118 5 Ion Movement
Let’s try this out for the following example: we assume we know
• The temperature is 20 degrees Celsius.
• The ratio g N a to g K is 0.03.
• The ratio of gC to g K is 0.1.
• The inside and outside concentrations for potassium are 400 and 20 milliMoles
respectively.
• The inside and outside concentrations for sodium are 50 and 440 milliMoles
respectively.
• The inside and outside concentrations for chlorine are 40 and 560 milliMoles
respectively.
We then enter the function call into MatLab like this:
Our abstract cell is a spherical ball which encloses a fluid called cytoplasm. The
surface of the ball is actually a membrane with an inner and outer part. Outside
the cell there is a solution called the extracellular fluid. Both the cytoplasm and
extracellular fluid contain many molecules, polypeptides and proteins disassociated
into ions as well as sequestered into storage units. In this chapter, we will be interested
in what this biological membrane is and how we can model the flow of ionized species
through it. This modeling is difficult because some of the ions we are interested in
can diffuse or drift across the membrane and others must be allowed entry through
specialized holes in the membrane called gates or even escorted, i.e. transported or
pumped, through the membrane by specialized helper molecules.
There are five general mechanisms by which molecules are moved across biological
membranes. All of these methods operate simultaneously so we should know a little
about all of them.
Fig. 5.5 Transport through water channels. a Osmosis. b Diffusion and water channel transport
or a molecule called a trigger. If the external signal is voltage, we call these channels
voltage gates. When the gate is open, the ion is able to physically move through
the opening.
• Carrier Mediated Transport: in this case, the dissolved substance combines with
a carrier molecule on the one side of the membrane. The resulting complex that
is formed moves through the membrane. At the opposite end of the membrane,
the solute is released from the complex. A probable abstraction of this process is
shown in Fig. 5.6.
• Ion Pumps: ions can also be transported by a mechanism which is linked to the
addition of an OH group to the molecule adenine triphosphate. This process is
called hydrolysis and this common molecule is abbreviated ATP. The addition
of the hydroxyl group to ATP liberates energy. This energy is used to move ions
against their concentration gradient.
In Fig. 5.7, parts c through e, we see abstractions of the remaining types of transport
embedded in a membrane.
In Fig. 5.8, we see a schematic of a typical voltage gate. Note that the inside of the
gate shows a structure which can be in an open or closed position. The outside of
the gate has a variety of molecules with sugar residues which physically extend into
the extracellular fluid and carry negative charges on their tips. At the outer edge of
the gate, you see a narrowing of the channel opening which is called the selectivity
filter. As we have discussed, proteins can take on very complex three dimensional
shapes. Often, their actual physical shape can switch from one form to another due
to some external signal such as voltage. This is called a conformational change. In
a voltage gate, the molecule which can block the inner throat of the gate moves from
5.7 Ion Flow 121
its blocking position to its open position due to such a conformational change. In
fact, this molecule can also be in between open and closed as well. The voltage gated
channel is actually a protein macromolecule which is inserted into an opening in the
membrane called a pore. We note that this macromolecule is quite big (1800–4000
amino acids) with one or more polypeptide chains and 100’s of sugar residues hang
off the extracellular face. When open, the channel is a water filled pore with a fairly
122 5 Ion Movement
large inner diameter which would allow the passage of many things except that there
is one narrow stretch of the channel called a selectivity filter which inhibits access.
The inside of the pore is lined with hydrophilic amino acids which therefore like
being near the water in the pore and the outside of the pore is lined with hydrophobic
amino acids which therefore dislike water contact. These therefore lie next to the lipid
bilayer. Ion concentration gradients can be maintained by selective permeabilities of
the membrane to various ions. Most membranes are permeable to K + , maybe Cl −
and much less permeable to N a + and Ca +2 . This type of passage of ions through
the membrane requires no energy and so it is called the passive distribution of the
5.7 Ion Flow 123
ions. If there is no other way to transport ions, a cell membrane permeable to several
ion species will reach an equilibrium potential determined by the Nernst equation.
Let c+n denote a cation of valence n and a −m be an anion of valence −n. Then the
Nernst equilibrium potentials for these ions are given by
At equilibrium, the ionic currents must sum to zero forcing these two potentials to
be the same. Hence, E c is the same as E a and we find
implying
Exponentiating these expressions, we find that the ion concentrations must satisfy
the following expression which is known as Donnan’s Law of Equilibrium.
1 1
[c+n ]out m
[a −m ]in n
= −m
[c+n ]in [a ]out
Inside
Outside
[K + ]out [K + ]in
[Cl − ]out
[Cl − ]in
and we would have that at Donnan equilibrium, the inner and outer ion concentrations
would satisfy
or
Now assume that there are other negative ions in the cell, say A−m . Then, [A−m ]out
is zero and we have
Inside
Outside
[K + ]out [K + ]in
[Cl − ]out
[Cl − ]in [A−m ]in
Then because there must be charge neutrality, [K + ]in = [Cl − ]in + [A−m ]in and
[K + ]out = [Cl − ]out . Also, we must have the usual Donnan Equilibrium state (re-
member the ion A−m does not play a role in this):
Thus,
[K + ]in
2
= [K + ]in ([Cl − ]in + [A−m ]in )
= [K + ]in [Cl − ]in + [K + ]in [A−m ]in
= [K + ]out [Cl − ]out + [K + ]in [A−m ]in
= [K + ]2out + [K + ]in [A−m ]in
> [K + ]2out
There are many pumps within a cell that move substances in or out of a cell with or
against a concentration gradient.
• N a + K + Pump: this is a transport mechanism driven by the energy derived from
the hydrolysis of ATP. Here 3 N a + ions are pumped out and 2 K + ions are pumped
5.7 Ion Flow 125
in. So this pump gives us sodium and potassium currents which raise [N a + ]out and
[K + ]in and decrease [N a + ]in and [K + ]out . From Table 5.1, we see that [N a + ]out
is typically bigger, so this pump is pushing N a + out against its concentration
gradient and so it costs energy.
• N a + Ca +2 Pump: this pump drives out 3 N a + ions inside the cell for every Ca +2
ion that is moved out. Hence, this pump gives us sodium and calcium currents
which raise [N a + ]in and [Ca +2 ]out and decrease [N a + ]out and [Ca +2 ]in . Here,
the N a + movement is with its concentration gradient and so there is no energy
cost.
• Plasma membrane Ca +2 Pump: this pump is also driven by the hydrolysis of ATP.
Here, Ca +2 is pumped into a storage facility inside the cell called the endoplasmic
reticulum which therefore takes Ca + 2 out of the cytoplasm and so brings down
[Ca +2 ]in .
• H C O3− Cl − Exchange: this is driven by the N a + concentration gradient and
pumps H C O3− into the cell and Cl − out of the cell.
• Cl − N a + K + Co transport: This is driven by the influx of N a + into the cell. For
every one N a + and K + that are pumped into the cell via this mechanism, 2 Cl −
are driven out.
Consider a system which has two compartments filled with ions and a membrane
with K + and Cl − gates between the two compartments as shown below:
100 mM A− 0 mM A−
150 mM K + 150 mM K +
50 mM Cl − 150 mM Cl −
100 mM A− 0 mM A−
150 mM K + 150 mM K +
100 mM Cl − 100 mM Cl −
100 mM A− 0 mM A−
200 mM K + 100 mM K +
100 mM Cl − 100 mM Cl −
Now we see that there is a concentration imbalance in K + ! The point here is that
this kind of analysis, while interesting, is so qualitative that it doesn’t give us the
final answer quickly! To get to the final punch line, we just need to find the Donnan
Equilibrium point. This is where
From our discussion above, we know that the number of mM’s of K + and Cl − that
move from Compartment Two to Compartment One will always be the same in order
to satisfy space charge neutrality. Let x denote this amount. Then we must have
[K + ] One = 150 + x
[K + ]T wo = 150 − x
[Cl − ]T wo = 150 − x
[Cl − ] One = 50 + x
5.7 Ion Flow 127
So at ECE, we have
100 mM A− 0 mM A−
180 mM K + 120 mM K +
80 mM Cl − 120 mM Cl −
What are the membrane voltages? Of course, they should match! Recall, in the
derivation of the Nernst equation, the voltage difference for ion c between side 2 and
1 was
RT [c]2
E c = V1 − V2 = ln
zF [c]1
Here, Compartment One plays the role of side 1 and Compartment Two plays the
role of side 2. So for K + , we have
[K + ]T wo 120
E K = VOne − VT wo = 25.32 ln +
= 25.32 ln = −10.27 mV
[K ] One 180
and for Cl − ,
[Cl − ]T wo 120
E Cl = VOne − VT wo = −25.32 ln −
= −25.32 ln = −10.27 mV
[Cl ] One 80
Are we at osmotic equilibrium? To see this, we need to add up how many ions are in
each compartment. In Compartment One, there are 360 ions and in Compartment Two
there are 240 ions. Since there are more ions in Compartment One than Compartment
Two, water will flow from Compartment One to Compartment Two to try to dilute
the ionic strength in Compartment One. We are ignoring this effect here.
128 5 Ion Movement
5.7.4.1 Homework
Exercise 5.7.1 Consider a system which has two compartments filled with ions and
a membrane with K + and Cl − gates between the two compartments as shown below:
80 mM A− 30 mM A−
160 mM K + 50 mM K +
80 mM Cl − 20 mM Cl −
Note the ion A can’t pass between compartments. Assume the system is held at the
temperature of 70 degree Fahrenheit.
We now will work our way through another way to view the movement of ions across
biological membranes that was developed by Goldman in 1943 and Hodgkin and Katz
in 1949. This is the Goldman–Hodgkin–Katz or GHK model. Going through all
of this will give you an increased appreciation for both the kind of modeling we
need to do: what to keep from the science, what to throw away and what tools to
use for the model itself . We start with defining carefully what we mean by the word
permeability. We have used this word before but always in a qualitative sense. Now
we will be quantitative.
where
• Jmolar is the molar flux which is in the units cm2moles
−second
.
• P is the membrane permeability of the ion c which has units of cm
second
.
• [] is the change in the concentration of c measured in the units moles
cm 3 .
Ficke’s Law of diffusion gives Jdiff = −D ∂∂x[c] where Jdiff is measured in cmmolecules
2 −second .
Jdiff Dm d[c]
=−
NA NA dx
where we now explicitly label the diffusion constant as belonging to the membrane.
These two fluxes should be the same; hence
Dm d[c]
Jmolar = −P [c] = − (5.14)
NA dx
We will want to use the above equation for the concentration of c that is in
the membrane itself. So we need to distinguish from the concentration of c inside
and outside the cell and the concentration in the membrane. We will let [c] denote
the concentration inside and outside the cell and [cm ], the concentration inside the
membrane. Hence, we have
Dm d[cm ]
Jmolar = −P [c] = − (5.15)
NA dx
Now a substance will probably dissolve differently in the cellular solution and in the
biological membrane, let’s model this quantitatively as follows: Let [c]in denote the
concentration of c inside the cell, and [c]out denote the concentration of c outside the
cell. The membrane has two sides; the side facing into the cell and the side facing
to the outside of the cell. If we took a slice through the cell, we would see a straight
line along which we can measure our position in the cell by the variable x. We have
x is 0 when we are at the center of our spherical cell and x is x0 when we reach the
inside wall of the membrane (i.e. x0 is the radius of the cell for this slice). We will
assume that the thickness of the membrane is a uniform . Hence, we are at position
x0 + when we come to the outer boundary of the membrane. Inside the membrane,
we will let [cm ] denote the concentration of c. We know the membrane concentration
will be some fraction of the cell concentration. So
for some constants βi and βo . The ratio of the boundary concentrations of c and the
membrane concentrations is an important parameter. From the above discussions,
we see these critical ratios are given by:
[cm ]x0 +
βo =
[c]out
[cm ]x0
βi =
[c]in
For this model, we will assume that these ratios are the same: i.e. βo = βi ; this com-
mon value will be denoted by β. The parameter β is called the partition coefficient
between the solution and the membrane. We will also assume that the membrane
concentration [cm ] varies linearly across the membrane from [c]in at x0 to [c]out at
x0 + . This model is shown in Fig. 5.9: Thus, since we assume the concentration
inside the membrane is linear, we have for some constants a and b:
[cm ](x) = a x + b
[cm ](x0 ) = [cm ]in = β[c]in
[cm ](x0 + ) = [cm ]out = β[c]out
[cm ]in = a x0 + b
[cm ]out = a (x0 + ) + b
= a x0 + b + a
= [cm ]in + a
d[cm ] β β
= ([c]out − [c]in ) = C
dx
Now recall that
Jmolar = −P [c]
Dm d[cm ]
=−
NA dx
Dm β
=− ([c]out − [c]in )
NA
Thus, we have a way to express the permeability P in terms of low level fundamental
constants:
Dm β
P=
NA
Finally, letting μm be the mobility within the membrane, we note that Einstein’s
relation tells us that Dm = κT μ = RT
q m
μ , so we conclude
F m
β RT μm
P= (5.16)
F N A
132 5 Ion Movement
dV m
Em = −
dx
implying
x0 + x0 +
dV m
−E d x =
m
=⇒ −E m dx = d V m =⇒ −E m = Vout
m
− Vinm
dx x0 x0
The Nernst equation will hold across the membrane, so we have that the voltage due
to c across the membrane is Vcm with
RT [c]out
E c = Vcm = Vinm − Vout
m
= ln
zF [c]in
Further, by assumption (3), the Nernst–Planck equation holds across the membrane,
so the ion current in the membrane, Im is given by
μm dV m d[cm ]
I m
=− z F [c ]
2 m
+ z RT
NA dx dx
Also, since
dV m V m − Vinm −Vcm
= −E m = out =
dx
we have
μm m −Vc
m
d[cm ]
I m
=− z F [c ]
2
+ z RT
NA dx
μm 2 V m
μ m d[c m
]
= z F [cm ] c − z RT
NA NA dx
5.8 Movement of Ions Across Biological Membranes 133
μm z 2 F [cm ] m μm d[cm ]
Im − Vc = − z RT (5.17)
NA NA dx
To make sense out of this complicated looking equation, we will make a change of
variable: define y m as follows:
μm z 2 F [cm ] m
ym = I m − Vc (5.18)
NA
Thus,
dy m dIm μm z 2 F m d[cm ]
= − Vc
dx dx NA dx
dIm
We know that at equilibrium, the current flow will be zero and so dx
= 0. Hence,
at steady state, we have
dy m μm z 2 F m d[cm ]
=− Vc
dx NA dx
or
dy m μm z d[cm ]
− =
z F Vcm d x NA dx
] m
This gives us an expression for the term d[c
dx
in Eq. 5.17. Using our change of variable
y m and substituting for the concentration derivative, we find
μm z d[cm ] dy m
y = −RT
m
= −RT −
NA dx z F Vcm d x
RT dy m
ym = (5.19)
z F Vcm d x
RT dy m
dx =
z F Vcm y m
x0 + x0 +
RT dy m
dx = m
x0 z F Vc x0 ym
134 5 Ion Movement
which gives
RT y m (x0 + )
= ln (5.20)
z F Vcm y m (x0 )
To simplify this further, we must go back to the definition of the change of variable
y m . From Eq. 5.18, we see
μm z 2 F [cm ](x0 + ) m
y m (x0 + ) = I m (x0 + ) − Vc
NA
μm z 2 F [cm ](x0 ) m
y m (x0 ) = I m (x0 ) − Vc
NA
At steady state the currents I m (x0 + ) and I m (x0 ) are the same value. Call this
constant steady state value I0m . Then we have
μm z 2 F [cm ](x0 + ) m
y m (x0 + ) = I0m − Vc
NA
μm z 2 F [cm ](x0 ) m
y m (x0 ) = I0m − Vc
NA
Finally, remember how we set up the concentration terms. We used the symbols
[cm ]out to represent [cm ](x0 + ) and [cm ]in to represent [cm ](x0 ). Thus, we have
μm z 2 F [cm ]out m
y m (x0 + ) = I0m − Vc
NA
μm z 2 F [cm ]in m
y m (x0 ) = I0m − Vc
NA
z F Vcm
ξ= (5.21)
RT
Recall that we defined the permeability by
Dm β
P=
NA
β RT μm
P=
F N A
5.8 Movement of Ions Across Biological Membranes 135
Now from the definition of ξ and P, we find that Eq. 5.20 gives
m
y (x0 + )
= ln
ξ y m (x0 )
Now, plug in the expressions for the y m terms evaluated at x0 + and x0 to find
⎛ ⎞
μm z 2 F [cm ]out
I0m − NA
Vcm I0m − zμm
NA
z F Vcm [cm ]out
ξ = ln ⎝ ⎠ = ln
I0m − μm z 2 F [cm ](x0 )
Vcm I0m − NzμAm z F Vcm [cm ]in
NA
μm ξ RT
I0m − zμm
NA
ξ RT [cm ]out I0m − NA
z
[cm ]out
= ln = ln
I0m − N Am ξ RT [cm ]in I0m − μmNξ ART
zμ z
[cm ]in
and so
μm ξ RT z m β RT μm
[c ]out = ξz [c]out
NA N A
But we know from the definition of P that the fractional expression is just P F and
so we have
μm ξ RT z m
[c ]out = zP F ξ [c]out
NA
μm ξ RT z m
[c ]in = zP F ξ [c]in
NA
I0m − zP F ξ [c]out
eξ =
I0m − zP F ξ [c]in
(I0m − zP F ξ [c]in )eξ = I0m − zP F ξ [c]out
leading to
We can solve the above equation for the steady state current term I0m . This gives
[c]in eξ − [c]out
I0m = zP F ξ
eξ − 1
I K + I N a + ICl = 0
Further, the associated Nernst potentials for the ions should all match because oth-
erwise there would be current flow:
where we denote this common potential by V0m . From the GHK current equation, we
have (note the valences for potassium and sodium are +1 and for chlorine is −1)
5.8 Movement of Ions Across Biological Membranes 137
⎛ F V0m
⎞
P K F 2 V0m ⎝ [K + ]in − [K + ]out e− RT ⎠
IK = F V0m
RT 1 − e− RT
⎛ F V0m
⎞
P N a F 2 V0m ⎝ [N a + ]in − [N a + ]out e− RT ⎠
IN a = F V0m
RT 1 − e− RT
⎛ −F V0m
⎞
PCl F 2 V0m ⎝ [Cl − ]in − [Cl − ]out e− RT ⎠
ICl = −F V0m
RT 1 − e− RT
F V0m
For convenience, let ξ0 denote the common term RT
. Then we have
[K + ]in − [K + ]out e−ξ0 [N a + ]in − [N a + ]out e−ξ0
I K = P K Fξ0 , I N a = P N a Fξ0
1 − e−ξ0 1 − e−ξ0
[Cl − ]in − [Cl − ]out eξ0
ICl = PCl Fξ0
1 − eξ0
F ξ0 e−ξ0
− P K [K + ]out + P N a [N a + ]out + PCl [Cl ]in .
1 − e−ξ0
Rewriting, we obtain
eξ0 P K [K + ]in + P N a [N a + ]in + PCl [Cl − ]out
= P K [K + ]out + P N a [N a + ]out + PCl [Cl ]in
Finally, taking logarithms, we obtain the GHK Voltage equation for these ions:
RT P K [K + ]out + P N a [N a + ]out + PCl [Cl ]in
V0m = ln (5.23)
F P K [K + ]in + P N a [N a + ]in + PCl [Cl − ]out
Now to actually compute the GHK voltage, we will need the values of the three
permeabilities. It is common to rewrite this equation in terms of permeability ratios.
We choose one of the permeabilities as the reference, say P N a , and compute the
ratios
PK PCl
rK = , rCl =
PN a PN a
5.8.4 Examples
Now let’s use the GHK voltage equation for a few sample calculations.
Consider a squid giant axon. Typically, the axon at rest has the following permeability
ratios:
PK 1.0
= = 33.33
PN a 0.03
PN a 0.03
= = 0.3
PCl 0.1
Thus, we have
PK
rK = = 33.33
PN a
PCl
rCl = : 3.33
PN a
5.8 Movement of Ions Across Biological Membranes 139
Now look at the part of Table 5.1 which shows the ion concentrations for the squid
axon. we will use a temperature of 294.11◦ Kelvin and the conversion RT
F
is 25.32 mV.
Also, recall that all concentrations are given in mM. Thus, the GHK voltage equation
for the squid axon gives
RT [N a + ]out + r K [K + ]out + rCl [Cl ]in
V0m = ln
F [N a + ]in + r K [K + ]in + rCl [Cl − ]out
440.0 + 33.33 × 20.0 + 3.333 × 40.0
= 25.32 (mV) ln
50.0 + 33.33 × 400.0 + 3.333 × 560.0
1239.9
= 25.32 (mV) ln
15248.48
= −63.54 mV
Now assume there is a drastic change in these permeability ratios: we now have:
PK 1.0
rK = = = 0.0667
PN a 15.0
PCl 0.1
rCl = = = 0.00667
PN a 15.0
We see that this large change in the permeability ratio between potassium and
sodium triggers a huge change in the equilibrium voltage across the membrane. It is
actually far easier to see this effect when we use permeabilities than when we use
conductances. So as usual, insight is often improved by looking at a situation using
different parameters! Later, we will begin to understand how this explosive switch
from a negative membrane voltage to a positive membrane voltage is achieved. That’s
for a later chapter!
140 5 Ion Movement
We haven’t talked much about how the pumps work in our model yet, so just to give
the flavor of such calculations, let’s look at a hypothetical pump for an ion c. Let Ic
denote the passive current for the ion which means no energy is required for the ion
flow (see Sect. 5.7.1 for further discussion). The ion current due to a pump requires
p
energy and we will let Ic denote the ion current due to the pump. At steady state,
we would have
p
I N a+ + I N a+ = 0
p
IK + + IK + = 0
Let the parameter r be the number of N a + ions pumped out for each K + ion pumped
in. This then implies that
p p
r I K + + I N a+ = 0
and so
r I K + + I N a+ = 0 (5.25)
Fξ0
−ξ
r P K [K + ]in − [K + ]out e−ξ0 + P N a [N a + ]in − [N a + ]out e−ξ0 = 0
1−e 0
giving
r P K [K + ]in − [K + ]out e−ξ0 − P N a [N a + ]in − [N a + ]out e−ξ0 = 0
r P K [K + ]in + P N a [N a + ]in − r P K [K + ]out + P N a [N a + ]out e−ξ0 = 0
5.8 Movement of Ions Across Biological Membranes 141
or
r P K [K + ]out + P N a [N a + ]out
eξ0 =
r P K [K + ]in + P N a [N a + ]in
The N a + − K + pump moves out 3N a + ions for every 2K + ions that go in. Hence
the pumping ratio is r is 1.5. Thus for our usual squid axon using only potassium
and sodium ions and neglecting chlorine, we find for a permeability ratio of
P K : P N a = 1.0 : 0.03
that
1.5 · 33.33 · 20.0 + 440.0
V0m = 25.32 (mV) ln
1.5 · 33.33 · 400.0 + 50.0
1439.90
= 25.32 (mV) ln
200480.0
= −66.68 mV
Our sample calculation thus shows that the pump contributes −66.68 to −63.11 or
−3.57 mV to the rest voltage. This is only 66.68
3.57
or 5.35 percent!
142 5 Ion Movement
There are specialized cells in most living creatures called neurons which are adapted
for generating signals which are used for the transmission of sensory data, control of
movement and cognition through mechanisms we don’t fully understand. A neuron
is an example of what is called an excitable cell and its membrane is studded with
many voltage gated sodium and potassium channels. In terms of ionic permeabilities,
the GHK voltage equation for the usual sodium, potassium and chlorine ions gives
P K [K + ]out + P N a [N a + ]out + PCl [Cl ]in
V0m = 25.32 (mV) ln
P K [K + ]in + P N a [N a + ]in + PCl [Cl − ]out
which is about −60 mV at rest but which we have already seen can rapidly increase to
+40 mV upon a large shift in the sodium and potassium permeability ratio. Recalling
our discussion in Sect. 5.6, we can write the rest voltage in terms of conductances as
gK gN a gCl
V0m = EK + ENa + E Cl
g K + g N a + gCl g K + g N a + gCl g K + g N a + gCl
Either the conductance or the permeability model allows us to understand this sudden
increase in voltage across the membrane in terms of either sodium to potassium per-
meability or conductance ratio shifts. We will study all of this in a lot of detail later,
but for right now, let’s just say that under certain circumstances, the rest potential
across the membrane can be stimulated just right to cause a rapid rise in the equilib-
rium potential of the cell, followed by a sudden drop below the equilibrium voltage
and then ended by a slow increase back up to the rest potential. The shape of this
wave form is very characteristic and is shown in Fig. 5.10. This type of wave form is
called an action potential and is a fundamental characteristic of excitable cells. In the
figure, we draw the voltage across the membrane and simultaneously we draw the
conductance curves for the sodium and potassium ions. Recall that conductance is
reciprocal resistance, so a spike in sodium conductance, for example, is proportional
to a spike in sodium ion current. So in the figure we see that sodium current spikes
first and potassium second.
Now that we have discussed so many aspects of cellular membranes, we are at
a point where we can develop a qualitative understanding of how this behavior is
generated. We can’t really understand the dynamic nature of this pulse yet (that is
it’s time and spatial dependence) but we can explain in a descriptive fashion how
the potassium and sodium gates physical characteristics cause the behavior we see
in Fig. 5.10. The changes in the sodium and potassium conductances that we see
in the action potential can be explained by molecular properties of the sodium and
potassium channels. As in the example we worked through for the resting potential for
the squid nerve cells, for this explanation, we will assume the chlorine conductance
does not change. So all the qualitative features of the action potential will be explained
solely in terms of relative sodium to potassium conductance ratios. We have already
seen that if we allow a huge increase in the sodium to potassium conductance ratio,
5.9 Excitable Cells 143
depends on the voltage across the cell membrane. We typically use the following
terminology:
• When the voltage across the membrane is above the resting membrane voltage,
we say the cell is depolarized.
• When the voltage across the membrane is below the resting membrane voltage,
we say the cell is hyperpolarized.
These gates transition from resting to open when the membrane depolarizes. In
detail, the probability that the gate opens increases upon membrane depolarization.
However, the probability that the gate transitions from open to closed is NOT voltage
dependent. Hence, no matter what the membrane voltage, once a gate opens, there
is a fixed probability it will close again.
Hence, an action potential can be described as follows: when the cell membrane is
sufficiently depolarized, there is an explosive increase in the opening of the sodium
gates which causes a huge influx on sodium ions which produces a short lived rapid
increase in the voltage across the membrane followed by a rapid return to the rest
voltage with a typical overshoot phase which temporarily keeps the cell membrane
hyperpolarized. We can explain much of this qualitatively as follows: The voltage
gated channels move randomly back and forth between their open and closed states.
At rest potential, the probability that a channel will move to the open position is
small and hence, most channels are in the closed position. When the membrane is
depolarized from some mechanism, the probability that a channel will transition to
the open position increases. If the depolarization of the membrane lasts long enough
or is large enough, then there is an explosive increase in the cell membrane potential
fueled by
Explosive Depolarization of the Membrane The depolarization causes a few N a +
channels to open. This opening allows N a + to move into the cell through the channel
which increase the inside N a + concentration. Now our previous attempts to explain
the voltage across the membrane were all based on equilibrium or steady state ar-
guments; here, we want to think about what happens in that brief moment when
the N a + ions flood into the cell. This is not a steady state analysis. Here, the best
way to think of it is that the number of plus ions in the cell has gone up. So since
the electrical field is based on minus to plus gradients, we would anticipate that the
electrical field temporarily increases. We also know from basic physics that
dV
E =−
dx
implying since the membrane starts at x0 and ends at x0 + that
where, as usual, we have labeled the voltage at the inside, V (x0 ) as Vin and the other
as Vout . Hence, since we define the membrane voltage V0m as
5.9 Excitable Cells 145
we see that
E = V0m
Thus if N a + ions come in, the electric field goes up and so does the potential across the
membrane. Hence, the initial depolarizing event further depolarizes the membrane.
This additional depolarization of the membrane increases the probability that the
sodium gates open. Hence, more sodium gates transition from resting to closed and
more N a + ions move into the cell causing further depolarization as outlined above.
We see depolarization induces further depolarization which is known as positive
feedback. Roughly speaking, the membrane voltage begins to drive towards E N a as
determined by the Nernst voltage equation. For biological cells, this is in the range
of 70 mV. Qualitatively, this is the portion of the voltage curve that is rising from rest
towards the maximum in Fig. 5.10.
Sodium Inactivation The probability that a sodium gate will move from open to
closed is independent of the membrane voltage. Hence, as soon as sodium gates
begin to open, there is a fixed probability they will then begin to move towards closed.
Thus, even as the membrane begins its rapid depolarization phase, the sodium gates
whose opening provided the trigger begin to close. This is most properly described
in terms of competing rates in which one rate is highly voltage dependent, but we
can easily see that essentially , the membrane continues to depolarize until the rate
of gate closing exceeds the rate of opening and the net flow of sodium ions is out of
the cell rather than into the cell. At this point, the membrane voltage begins to fall.
The sodium gate therefore does not remain open for long. It’s action provides a brief
spike in sodium conductance as shown in Fig. 5.12.
Potassium Channel Effects The potassium gate is also a voltage dependent channel
whose graphical abstraction is similar to that shown in Fig. 5.11. These channels
respond much slower to the membrane depolarization induced by the sodium channel
activations. As the K + channels open, K + inside the cell flows outward and thereby
begins to restore the imbalance caused by increased N a + in the cytoplasm. The
explanation for this uses the same electrical field and potential connection we invoked
earlier to show why the membrane depolarizes. This outward flow, however, moves
the membrane voltage the other way and counteracts the depolarization and tries to
move the membrane voltage back to rest potential. The K + channels stay open a
long time compared to the N a + channels. Since the sodium channels essentially pop
open and then shut again quickly, this long open time of the potassium channel means
the potassium conductance, g K falls very slowly to zero. As the potassium outward
current overpowers the diminishing sodium inward current, the potential accelerates
its drop towards rest which can be interpreted as a drive towards the Nernst potential
E K which for biological cells is around −80 mV.
Chlorine Ion Movement The rest potential is somewhere in between the sodium
and potassium Nernst potentials and the drive to reach it is also fueled by several
other effects. There is also a chlorine current which is caused by the movement of
chlorine through the membrane without gating. The movement of negative ions into
the cell is qualitatively the same as the movement of positive potassium ions out
of the cell—the membrane voltage goes down. Thus, chlorine current in the cell is
always acting to bring the cell back to rest. We see the cell would return to its rest
voltage even without the potassium channels, but the potassium channels accelerate
the movement. One good way to think about it is this: the potassium channels shorten
the length of time the membrane stays depolarizes by reducing the maximum height
and the width of the pulse we see in Fig. 5.10.
The Na+ −K + Pump There is also an active sodium–potassium pump that moves 3
sodium ions out of the cell for each 2 potassium ions that are moved in. This means
that the cell’s interior plus charge goes down by one. This means the membrane
voltage goes down. Hence, this pump acts to bring the membrane potential back to
rest also.
The Hyperpolarization Phase In Fig. 5.10, you can see that after the downward
voltage pulse crosses the rest potential line, the voltage continues to fall before it
bottoms out and slowly rises in an asymptotic fashion back up to the rest potential.
This is called the hyperpolarization phase and the length of time a cell spends in
this phase and the shape of the this phase of the curve are important to how this
potential change from this cell can be used by other cells for communication. As the
potassium channels begin to close, the K + outward current drops and the voltage
goes up towards rest.
The Refractory Period During the hyperpolarization phase, many sodium channels
are inactivated. The probability a channel will reopen simultaneously is small and
most sodium gates are closed. So for a short time, even if there is an initial depo-
larizing impulse event, only a small number of sodium channels are in a position to
move to open. However, if the magnitude of the depolarization event is increased,
more channels will open in response to it. So it is possible that with a large enough
event, a new positive feedback loop of depolarization could begin and generate a new
action potential. However, without such an event, the membrane is hyperpolarized,
the probability of opening is a function of membrane voltage and so is very low, and
hence most gates remain closed. The membrane is continuing to move towards rest
though and the closer this potential is to the rest value, the higher the probability of
5.9 Excitable Cells 147
opening for the sodium gates. Typically, this period where the cell has a hard time
initiating a new action potential is on the order of 1–2 mS. This period is called the
refractory period of the cell.
With all this said, let’s go back to the initial depolarizing event. If this event is a
small pulse of N a + current that is injected into a resting cell, there will be a small
depolarization which does not activate the sodium channels and so the ECE force
acting on the K + and Cl − ions increase. K + goes out of the cell and Cl − comes
in. This balances the inward N a + ion jet and the cell membrane voltage returns to
rest. If the initial depolarization is larger, some N a + channels open but if the K +
and Cl − net current due to the resulting ECE forces is larger than the inward N a +
current due to the jet and the sodium channels that are open, the membrane potential
still goes back to rest. However, if the depolarization is sufficiently large, the ECE
derived currents can not balance the inward N a + current due to the open sodium
gates and the explosive depolarization begins.
References
We can now begin to model a simple biological cell. We can think of a cell as having
an input line (this models the dendritic tree), a cell body (this models the soma)
and an output line (this models the axon). We could model all these elements with
cables—thin ones for the dendrite and axon and a fat one for the soma. To make our
model useful, we need to understand how current injected into the dendritic cable
propagates a change in the membrane voltage to the soma and then out across the
axon. Our simple model is very abstract and looks like that of Fig. 6.1.
Note that the dendrite in Fig. 6.1 is of length L and its position variable is w and
the soma also has length L and its position variable is w. Note that each of these
cables has two endcaps—the right and left caps on the individual cylinders—and
we eventually will have to understand the boundary conditions we need to impose
at these endcaps when current is injected into one of these cylinders. We could also
model the soma as a spherical cell, but for the moment let’s think of everything as
the cylinders you see here. So to make progress on the full model, we first need to
understand a general cable model.
Now a fiber or cable can be modeled by some sort of cylinder framework. In Fig. 6.2a,
we show the cylinder model. In our cylinder, we will first look at currents that run
out of the cylinder walls and ignore currents that run parallel or longitudinally down
the cylinder axis. We label the interesting variables as follows:
• The inner cylinder has radius a.
• L is the length of the wire.
• V is the voltage across the wall or membrane.
• Ir is the radial current flow through the cylinder. This means the current is flowing
through the walls. This is measured in amps.
• Jr is the radial current flow density which has units of amps per unit area—for
example, amps
cm2
.
• K r is the radial current per unit length—typical units would be amps
cm
.
The 2D cross-section, shown in Fig. 6.2b, further illustrates that the radial current
Jr moves out of the cylinder. Clearly, since the total surface area of our cylinder is
2πa L, we have the following conversions between the various current variables.
Ir = 2πa L Jr
Ir
Kr = = 2πa Jr
L
Now, imagine our right circular cylinder as being hollow with a very thin skin filled
with some conducting solution, as shown in Fig. 6.3a. Further, imagine the wall is
actually a bilipid layer membrane as shown in Fig. 6.3b. We now have a simple model
of a biological cable we can use for our models. This is called the annular model of
a cable. In other words, if we take a piece of dendritic or axonal fiber, we can model
it as two long concentric cylinders. The outer cylinder is filled with a fluid which
is usually considered to be the extracellular fluid outside the nerve fiber itself. The
outer cylinder walls are idealized to be extremely thin and indeed we don’t usually
think about them much. In fact, the outer cylinder is actually just a way for us to
6.1 Modeling Radial Current 151
Fig. 6.3 Cable details. a The cable cylinder model cross section. b Part of the cable bilipid mem-
brane structure
handle the fact that the dendrite or axon lives in an extracellular fluid bath. The inner
cylinder has a thin membrane wall wrapped around an inner core of fluid. This inner
fluid is the intracellular fluid and the membrane wall around it is the usual membrane
we have discussed already. The real difference here is that we are now looking at a
specific geometry for our membrane structure.
We also will think of these cables as much as possible in terms of simple circuits.
Hence, our finite piece of cable should have some sort of resistance associated with
it. We assume from standard physics that the current density per unit surface area,
Jr , is proportional to the electrical field density per length E . The proportionality
constant is called conductivity and is denoted by σe . The resulting equation is thus
Jr = σe E
1
ρ=
σe
Volts amps
This gives us the units of ohm−cm 2 or cm2 for the current density Jr which is what
we expect them to be! The parameters ρ and σe measure properties that tell us what
to do for one cm of our cable but do not require us to know the radius. Hence, these
parameters are material properties.
Now let’s look at currents that run parallel to the axis of the cable. These are called
longitudinal currents which we will denote by the symbol Ia . Now that we want to
look at currents down the fiber, we need to locate at what position we are on the
fiber. We will let the variable z denote the cable position and we will assume to cable
has length L. We show this situation in Fig. 6.4. The surface area of each endcap of
the cable cylinder is πa 2 . This implies that if we cut the cable perpendicular to its
longitudinal axis, the resulting slice will have cross-sectional area πa 2 . Our currents
are thus:
• Ia is the longitudinal current flow which has units of amps.
• Ja is the longitudinal current flow density which has units of amps per unit area—
amps
cm2
.
with the usual conversion
Ia = πa 2 Ja
Since the inside of the cable is filled with the same conducting fluid we used in our
radial current discussions, we know
Ja = σe E
and so
πa 2 E
Ia = πa 2 σe E =
ρ
d
E =−
dz
ρIa d
=−
πa 2 dz
6.3 Longitudinal Properties 153
implying
ρIa
V = (0) − (L) = L
πa 2
Now if we use Ohm’s law to relate potential, current and resistance as usual, we
would expect a relationship of the form
ρL
V = Resistance Ia = Ia
πa 2
This suggests that the term in front of Ia plays the role of a resistance. Hence, we
will define R to be the resistance of the cable by
ρL
R=
πa 2
So far, we haven’t actually thought of the cable wall as having a thickness. Now
let’s let the wall thickness be and consider the picture shown in Fig. 6.5. We let the
variable s indicate where we are at inside the membrane wall. Hence, s is a variable
which ranges from a value of a (the inner side of the membrane) to the value a +
(the outer side of the membrane). Let Ir (s) denote the radial current at s; then the
radial current density is defined by
154 6 Lumped and Distributed Cell Models
Ir (s)
Jr (s) =
2πs L
We will assume the radial current is constant; i.e. Ir is independent of s. Thus, we
have
Ir
Jr (s) = .
2πs L
Now following the arguments we used before, we assume the current density is still
proportional to the electric field density and that the electrical field density E is
constant. Thus, we have Jr (s) = σe E . Hence
Jr (s) d
E = =−
σe ds
This implies
Ir d
= −σe
2πs L ds
Integrating, we find
a+ (a+)
Ir d
= −σe
a 2πs L (a) ds
Ir a+
ln = −σe ((a + ) − (a))
2πL a
Now (a + ) is the voltage outside the cable at the end of the cell wall (Vout ) and
(a) is the voltage inside the cable at the start of the cell wall (Vin ). As usual, we
represent the potential difference Vin − Vout by Vr . Thus, using the definition of ρ,
we have
a+ 2πLσe Vr 2πL Vr
ln = =
a Ir ρIr
6.4 Current in a Cable with a Thin Wall 155
We conclude
ρIr
Vr = ln 1 +
2πL a
Recall that is the thickness of the cell wall which in general is very small compared
to the radius a. Hence the ratio of to a is usually quite small. Recall from basic
calculus that for a twice differentiable function f defined near the base point x0 that
we can replace f near x0 as follows:
1
f (x) = f (x0 ) + f (x0 )(x − x0 ) + f (c)(x − x0 )2
2
where the number c lies in the interval (x0 , x). Unfortunately, this number c depends
on the choice of x, so this equality is not very helpful in general. The straight line
L(x, x0 ) given by
is called the tangent line approximation or first order approximation to the function
f near x0 . Hence, we can say
1
f (x) = L(x, x0 ) + f (c)(x − x0 )2
2
This tells us the error we make in replacing f by its first order approximation,
e(x, x0 ), can be defined by
1
e(x, x0 ) = | f (x) − L(x, x0 )| = | f (c)|(x − x0 )2
2
Now ln(1 + x) is two times differentiable on (0, ∞) so we have the first order
approximation to ln(1 + x) near the base point 0 is given by
1
L(x, x0 ) = ln(1) + (x − 0) = x
1 + x x=0
with error
1 1
e(x, 0) = | ln(1 + x) − x| = x2
2 (1 + c)2
where c is some number between 0 and x. Even though we can’t say for certain
where c is in this interval, we can say that
1
≤1
(1 + c)2
156 6 Lumped and Distributed Cell Models
no matter what x is! Hence, the error in making the first order approximation on the
interval [0, x] is always bounded above. We have shown
1 2
e(x, 0) ≤ x
2
Now for our purposes, let’s replace ln(1 + a ) with a first order approximation on the
interval (0, a ). Then the x above is just a and we see that the error we make is
2
1
e(x, 0) ≤
2 a
If the ratio of the cell membrane to radius is small, the error we make is negligible.
For example, a biological membrane is about 70 nM thick and the cell is about 20,000
nM in radius. Hence the membrane to radius ratio is 3.5e − 3 implying the error is on
the order of 10−5 which is relatively small. Since in biological situations, this ratio is
small enough to permit a reasonable first order approximation with negligible error,
we replace ln(1 + a ) by a . Thus, we have to first order
ρIr Vr ρ
Vr = =⇒ R = =
2πL a Ir 2πLa
We know R is measured in ohms and so the resistance R of the entire cable at the
inner wall is R times the inner surface area of the cable which is 2πLa. Hence,
R = ρ which has units of ohms−cm2 . We know the wall has an inner and an outer
surface area. The outer surface area is 2πa(1 + a )L which is a bit bigger. In order to
define the resistance of a unit surface area, we need to know which surfaced area we
are talking about. So here, since we have already approximated the logarithm term
around the base point 0 (which means the inside wall as 1 + 0 corresponds to the
inside wall!) we choose to use the surface area of the inside wall. Note how there
are many approximating ideas going on here behind the scenes if you will. We must
always remember these assumptions in the models we build! The upshot of all of
this discussion is that for a cable model with a thin membrane, the resistance per unit
length, r , with units ohms
cm
, should be defined to be
R ρ
r = =
2πLa
In a uniform isolated cell, the potential difference across the membrane depends
on where you are on the cell surface. For example, we could inject current into a
cylindrical cell at position z 0 as shown in Fig. 6.7a. In fact, in the laboratory, we
6.5 The Cable Model 157
could measure the difference between V m (the membrane potential) and V0m (the
rest potential) that results from the current injection at z = 0 at various positions z
downstream and we would see potential difference curves versus position that have
the appearance of Fig. 6.6. The z = 0 curve is what we would measure at the site of
the current injection; the z = 21 and z = 2 curves are what we would measure 21 or
2 units downstream from the injection site respectively. Note the spike in potential
we see is quite localized to the point of injection and falls rapidly off as we move to
the right or left away from the site. Our simple cylindrical model gave us
ρIr
Vr =
2πLa
as the voltage across the membrane or cell wall due to a radial current Ir flowing
uniformly radially across the membrane along the entire length of cable. So far our
model do not allow us to handle dependence on position so we can’t reproduce
voltage versus position curves as shown in Fig. 6.6. We also currently can’t model
explicit time dependence in our models!
Now we wish to find a way to model V m as a function of the distance downstream
from the current injection site and the time elapsed since the injection of the current.
This model will be called the Core Conductor Model.
Let’s start by imagining our cable as a long cylinder with another cylinder inside
it. The inner cylinder has a membrane wall of some thickness small compared to
158 6 Lumped and Distributed Cell Models
Fig. 6.7 Cylindrical cell details. a Current injection. b Radial cross section
the radius of the inner cylinder. The outer cylinder simply has a skin of negligible
thickness. If we take a radial cross section as shown in Fig. 6.7b we see in this radial
cross section, let’s label the important currents and voltages as shown in Fig. 6.8a.
As you can see, we are using the following conventions:
• t is time usually measured in milli-seconds or mS.
• z is position usually measured in cm.
• (r, θ) are the usual polar coordinates we could use to label points in any given
radial cross section.
• K e (z, t) is the current per unit length across the outer cylinder due to external
sources applied in a cylindrically symmetric fashion. This will allow us to represent
current applied to the surface through external electrodes. This is usually measured
in amp
cm
• K m (z, t) is the membrane current per unit length from the inner to outer cylinder
through the membrane. This is also measure in amp cm
.
• Vi (z, t) is the potential in the inner conductor measured in milli-volts or mV.
• Vm (z, t) is the membrane potential measured in milli-volts or mV.
• Vo (z, t) is the potential in the outer conductor measured in milli-volts or mV.
We can also look at a longitudinal slice of the cable as shown in Fig. 6.8b. The
longitudinal slice allows us to see the two main currents of interest, Ii and Io as
shown in Fig. 6.9, we see
where
• Io (z, t) is the total longitudinal current flowing in the +z direction in the outer
conductor measured in amps.
• Ii (z, t) is the total longitudinal current flowing in the +z direction in the inner
conductor measured in amps.
The Core Conductor Model is built on the following assumptions:
1. The cell membrane is a cylindrical boundary separating two conductors of current
called the intracellular and extracellular solutions. We assume these solutions are
homogeneous, isotropic and obey Ohm’s Law.
2. All electrical variables have cylindrical symmetry which means the variables do
not depend on the polar coordinate variable θ.
6.5 The Cable Model 159
Fig. 6.8 Radial and longitudinal details. a Currents and voltages in the radial cross section. b A
longitudinal slice of the cable
3. A circuit theory description of currents and voltages is adequate for our model.
4. Inner and outer currents are axial or longitudinal only. Membrane currents are
radial only.
5. At any given position longitudinally (i.e. along the cylinder) the inner and outer
conductors are equipotential. Hence, potential in the inner and outer conductors
is constant radially. The only radial potential variation occurs in the membrane.
Finally, we assume the following geometric parameters:
• r0 is the resistance per unit length in the outer conductor measured in ohm
cm
.
• ri is the resistance per unit length in the inner conductor measured in ohm
cm
.
• a is the radius of the inner cylinder measured in cm.
It is also convenient to define the current per unit area variable Jm :
amp
• Jm (z, t) is the membrane current density per unit area measured in cm2
.
160 6 Lumped and Distributed Cell Models
Outer Membrane
Inner Membrane
Inner Conductor
Outer Membrane
z z + Δz
Now let’s look at a slice of the model between positions z and z + z. In Fig. 6.10,
we see an abstraction of this. The vertical lines represent the circular cross sections
through the cable at the positions z and z + z. We cut through the outer shell first
giving two horizontal lines labeled outer membrane at the bottom of the figure. Then
as we move upward, we encounter the outer conductor. We then move through the
inner cable which has a bottom membrane, an inner conductor and a top membrane.
Finally, we enter the outer conductor again and exit through the outer membrane. At
each position z, there are values of Ii , Io , Vi , Vo , K m and Vm that are shown. Between
z and z + z, we thus have a cylinder of inner and outer cable of length z.
From the z slice in Fig. 6.10, we can abstract the electrical network model we
see in Fig. 6.11: Now in the inner conductor, we have current Ii (z, t) entering the face
of the inner cylinder. At that point the inner cylinder is at voltage Vi (z, t). A distance
z away, we see current I (z + z, t) leaving the cylinder and we note the voltage
of the cylinder is now at V (z + z, t). Finally, there is a radial membrane current
coming out of the cylinder uniformly all through this piece of cable. We illustrate this
in Fig. 6.12: Now we know that the total current I through the membrane is given by
Ii (z, t) Ii (z + Δz, t)
Vi (z, t) Vi (z + Δz, t)
ri Δz Ω ri Δz Ω ri Δz Ω
a b
Km (z, t) Δz Km (z + Δz, t) Δz
ro Δz Ω ro Δz Ω ro Δz Ω
d c
Vo (z, t) Vo (z + Δz, t)
Io (z, t) Io (z + Δz, t)
Ke (z, t) Δz Ke (z + Δz, t) Δz
and at Node d, the currents going into the node should match the currents coming
out of the node:
Also, the voltage drop across the resistance ri z between Node a and Node b satisfies
Similarly, between Node d and Node c we find the voltage drop satisfies
Now from standard multivariable calculus, we know that is a function f (z, t) has a
partial derivative at the point (z, t), then the following limit exists
f (z + z, t) − f (z, t)
lim
z→0 z
and the value of this limit is denoted by the symbol ∂∂zf . Now the equations above
apply for any choice of z. Physically, we expect the voltages and currents we see
here to be smooth differentiable functions of z and t. Hence, we expect that if we let
z go to zero, we will obtain the equations:
∂ Ii
= −K m (z, t) (6.1)
∂z
∂ Io
= K m (z, t) − K e (z, t) (6.2)
∂z
∂Vi
= lim (−ri Ii (z + z, t) = −ri Ii (z, t) (6.3)
∂z z→0
∂Vo
= lim (−ro Io (z + z, t)) = −ro Io (z, t) (6.4)
∂z z→0
Vm = Vi − V0 (6.5)
We call Eqs. 6.1 and 6.2 the Core Equations. Note we can manipulate these equations
as follows: Eq. 6.4 implies that
6.5 The Cable Model 163
∂Vm
= −ri Ii + ro Io
∂z
∂ 2 Vm ∂ Ii ∂ I0
= −ri + ro = ri K m + ro K m − ro K e
∂z 2 ∂z ∂z
Thus, the core equations imply that the membrane voltage satisfies the partial differ-
ential equation
∂ 2 Vm
= (ri + ro )K m − ro K e (6.6)
∂z 2
Note that the units here do work out. The second partial derivative of Vm with respect
to z involves ratios of first order partials of Vm with respect to z. The first order terms,
by the definition of the partial derivative, have units of volt cm
; hence, the second order
volt ohm
terms have units of cm 2 . Each of the r i or r o terms have units cm
and the K m or K e
are current per length terms with units cm . Thus the products have units amp−ohm
amps
cm2
or
volt
cm
. This partial differential equation is known as the Core Conductor Equation.
Normally, we find it useful to model stuff that is happening in terms of how far things
deviate or move away from what are called nominal values. We can use this idea to
derive a new form of the Core Conductor Equation which we will call the Transient
Cable Equation. Let’s denote the rest values of voltage and current in our model by
• Vm0 is the rest value of the membrane potential.
• K m0 is the rest value of the membrane current per length density.
• K e0 is the rest value of the externally applied current per length density.
• Ii0 is the rest value of the inner current.
• Io0 is the rest value of the inner current.
• Vi0 is the rest value of the inner voltage.
• Vo0 is the rest value of the inner voltage.
It is then traditional to define the transient variables as perturbations from these rest
values using the same variables but with lower case letters:
164 6 Lumped and Distributed Cell Models
Now in our core conductor model so far, we have not modeled the membrane at all.
For this transient version, we need to think more carefully about the membrane boxes
we showed in Fig. 6.11. We will replace our empty membrane box by a parallel circuit
model. Now this box is really a chunk of membrane that is z wide. We will assume
our membrane has a constant resistance and capacitance. We know that conductance
is reciprocal resistance, so our model will consist to a two branch circuit: one branch
is contains a capacitor and the other, the conductance element. We will let cm denote
the membrane capacitance density per unit length (measured in fahrad cm
). Hence, in
our membrane box, since the box is z wide, we see the value of capacitance is
cm z. Similarly, we let gm be the conductance per unit length (measured in ohm−cm 1
)
for the membrane. The amount of conductance for the box element is thus gmz.
In Fig. 6.13, we illustrate our new membrane model. Since this is a resistance—
capacitance parallel circuit, it is traditional to call this an RC membrane model.
In Fig. 6.13, the current going into the element is K m (z, t)z and we draw the rest
voltage for the membrane as a battery of value Vm0 . What happens when the membrane
is at rest? At rest, all of the transients must be zero. At rest, there can be no capacitative
current and so all the current flows through the conductance branch. Thus applying
Ohm’s law,
On the other hand, when we are not in a rest position, we have current through both
branches. Recall that for a capacitor C, the charge q held in a capacitor due to a
6.6 The Transient Cable Equations 165
1
gm Δz
S
cm Δz F
0
Vm V
voltage V is q = C V which implies that the current through the capacitor due to a
time varying voltage is i = dq
dt
given by
∂V
i =C
∂t
From Kirchhoff’s current law, we see
∂
K m0 + km (z, t) z = gm z Vm0 + vm (z, t) + V + vm (z, t) cm z
0
∂t m
Using Eq. 6.7 and taking the indicated partial derivative, we simplify this to
∂vm
km (z, t) z = gm z vm (z, t) + cm z
∂t
Upon canceling the common z term, we find the fundamental identity
∂vm
km (z, t) = gm vm (z, t) + cm (6.8)
∂t
Now the core conductor equation in terms of our general variables is
∂ 2 Vm
= (ri + ro )K m − ro K e
∂z 2
∂2 0
Vm + vm (z, t) = (ri + ro ) K m0 + km (z, t) − ro K e0 + ke (z, t)
∂z 2
∂ 2 vm
= (ri + ro )K m0 − ro K e0 + (ri + ro )km − ro ke
∂z 2
166 6 Lumped and Distributed Cell Models
This leads to
∂ 2 vm
− (ri + ro )km + ro ke = (ri + ro )K m0 − ro K e0
∂z 2
Now at steady state, both sides of the above equation must be zero. This gives us the
identities:
∂ 2 vm
= (ri + ro )km − ro ke
∂z 2
(ri + ro )K m0 = ro K e0
∂ 2 vm ∂vm
− (ri + ro )cm − (ri + ro )gm vm = −ro ke (6.9)
∂z 2 ∂t
The Cable Eq. 6.9 can be further rewritten in terms of two new constants, the space
constant of the cable, λc , and the time constant, τm . Note, we can rewrite 6.9 as
1 ∂ 2 vm cm ∂vm ro
− − vm = − ke
(ri + ro )gm ∂z 2 gm ∂t (ri + ro )gm
Then
ro
= ro λ2c
(ri + ro )gm
6.6 The Transient Cable Equations 167
∂ 2 vm ∂vm
λ2c − τm − vm = −ro λ2c ke (6.10)
∂z 2 ∂t
The new constants τm and λc are very important to understanding how the solutions
to this equation will behave. We call τm the time constant and λc the space constant
of our cable.
Consider the ratio gcmm . Note that the units of this ratio are fahrad − ohm. Recall that
charge deposited on a capacitor of value C fahrads is q = C V where V is the voltage
across the capacitor. Hence, a dimensional analysis shows us that coulombs equal
fahrad-volts. But we also know from Ohm’s law that voltage is current times resis-
tance; hence, dimensional analysis tells us that volts equal coulomb−ohm
sec
. We conclude
that fahrad − ohm equals coulombvolt
times ohm. But a coulomb
volt
is a sec
ohm
by Ohm’s law
as discussed above. Hence, simplifying, we see the ration gcmm has unit of seconds.
Hence, this ratio is a time variable. This is why we define this constant to be the
time constant of the cable, τm . Note that τm is a constant whose value is independent
of the size of the cell; hence it is a membrane property. Also, if we let G m be the
1 2
conductance of a square centimeter of cell membrane. Then G m has units of ohm−cm .
The conductance of our z box of membrane in our model was gm z and the total
conductance of the box is also G m times the surface area of the box or G m 2πa z.
Equating expressions, we see that
gm = 2πa G m
cm = 2πa Cm
Cm
We see the time constant can thus be expressed as Gm
also.
Next, consider the dimensional analysis of the term (ri +r1o )gm . The sum of the resis-
tances per length have units ohmcm
and gm has units ohm−cm
1
. Hence, the denominator
ohm 1 −2
of this fraction has units cm times ohm−cm or cm . Hence, this ratio has units of
cm2 . This is why the square root of the ratio functions as a length parameter. We can
look at this more closely. Consider again our approximate model where we divide
the cable up into pieces of length z. We know the inner current per unit area density
168 6 Lumped and Distributed Cell Models
is Ji and it is defined by
Ii (z, t) d
Ji (z, t) = = σi Ei = −σi
πa 2 dz
where z is the position in the inner cylinder, σi is the conductivity and Ei is the
electrical field density per length of the inner solution, respectively and is the
potential at position z in the inner cylinder. It then follows that
Ii (z, t) d
=−
πa 2 σi dz
Now let’s assume the inner longitudinal current from position z to position z + z
is constant with value I (z, t). Then, integrating we obtain
z+z
Ii (z, t) d
z = − dz
πa 2 σi z dz
= (z) − (z + z).
But this change in potential from z to z+z can be approximated by the inner cylinder
voltage at z at time t, Vi (z, t). Thus, noting the resistivity of the inner solution, ρi , is
the reciprocal of the conductivity, our approximation allows us to say
ρi Ii (z, t)
z = Vi (z, t)
πa 2
This implies that resistance of this piece of cable can be modeled by
Vi (z, t) ρi z
Ri (z, t) = =
Ii (z, t) πa 2
a
=
2ρi G m
In Fig. 7.1, we see a small piece of cable as described in Chap. 6. We are injecting
current Ie into the cable via an external current source at z = 0. We assume the
current that is injected in uniformly distributed around the cable membrane. We will
begin by assuming that the cable extends to infinity both to the right and to the left of
the current injection site. This is actually easier to handle mathematically, although
you will probably find it plenty challenging! The picture we see in Fig. 7.1 is thus
just a short piece of this infinitely long cable. Now if a dendrite or axon was really
long, this would probably not be a bad model, so there is a lot of utility in examining
this case as an approximation to reality. We also assume the other end of the line
that delivers the current Ie is attached some place so far away it has no effect on our
cable. We now begin our discussion of how to solve this problem.
The time dependent cable equation is just the full cable Eq. 6.10 from Sect. 6.6.
Recall that ke is the external current per unit length. Hence, λc ke is a current which
is measured in amps. We also know that λc ro is a resistance measured in ohms.
Hence, the product ro λc times λc ke is a voltage as from Ohm’s law, resistance times
current is voltage. Thus, the right hand side of the cable equation is the voltage due
to the current injection. On the left hand side, a similar analysis shows that each term
represents a voltage.
• λ2c ∂∂zv2m is measured in cm2 times cm
2
volt
2 or volts.
∂vm
• τm ∂t is measured in seconds times secondvolt
or volts.
• vm is measured volts.
Now if we were interested only in solutions that did not depend on time, then the term
∂vm
∂t
would be zero. Also, we could write all of our variables as position dependent
only; i.e. vm (z, t) as just vm (z) and so on. In this case, the partial derivatives are not
necessary and we obtain an ordinary differential equation:
d 2 vm
λ2c − vm (z) = −ro λ2c ke (z) (7.1)
dz 2
Equation 7.1 as written does not impose any boundary or initial conditions on the
solution. Eventually, we will have to make a decision about these conditions, but
for the moment, let’s solve this general differential equation as it stands. The typical
solution to such an equation is written in two parts: the homogeneous part and the
particular part. The homogeneous part or solution is the function φh that solves
d 2 vm
λ2c − vm (z) = 0 (7.2)
dz 2
d 2 φh
λ2c − φh (z) = 0
dz 2
The particular part or solution is any function φ p that satisfies the full Eq. 7.1; i.e.
d 2φ p
λ2c − φ p (z) = −ro λ2c ke (z)
dz 2
It is implied in the above discussions that φh and φ p must be functions that have two
derivatives for all values of z that are interesting. Since this first case concerns a cable
of infinite length, this means here that φh and φ p must be twice differentiable on the
7.2 Solving the Time Independent Infinite Cable Equation 173
entire z axis. We can also clearly see that adding the homogeneous and particular
part together will always satisfy the full time dependent cable equation. Let φ denote
the general solution. Then
and φ will satisfy the time independent cable equation. If the external current ke is
continuous in z, then since the right hand side must equal the left hand side, the
continuity of the right hand side will force the left hand side to be continuous also.
This will force the solution φ we seek to be continuous in the second derivative. So
usually we are looking for solutions that are very nice: they are continuous in the
second derivative. This means that there are no corners in the second derivative of
voltage.
Since we don’t know the explicit function ke we wish to use in the non-homogeneous
equation, the common technique to use to find the particular solution is the one called
Variation of Parameters. We use the fact that the solutions to our model are linearly
independent. Here the vector space is C 2 [a, b] for some interval [a, b] and we use
the linear independence of the two solutions of the homogeneous linear second order
model to build a solution to the nonhomogeneous model. Rather than doing this in
general, we will focus on a specific model:
d2x
β2 − x(t) = f (t)
dt 2
x(0) = −1
x(5) = 4.
where β is a nonzero number and we have switched to using the independent variable
t instead of z for convenience. Our cable models without time dependence will give
us equations to solve with the independent variable being space, z, but other models
can use time, t. The homogeneous solution x h here solves
d2x
β2 − x(t) = 0
dt 2
and has the form
x h (t) = Ae− β + Be β
t t
174 7 Time Independent Solutions to Infinite Cables
Since we don’t know the explicit function f we wish to use in the nonhomogeneous
equation, a common technique to find the particular solution is the one called Varia-
tion of Parameters. In this technique, we take the homogeneous solution and replace
the constants A and B by unknown functions u 1 (t) and u 2 (t). Then we see if we
can derive conditions that the unknown functions u 1 and u 2 must satisfy in order to
work. So we start by assuming
Using the chain and product rule for differentiation, the first derivative of x thus gives
(we use the prime notation for derivatives with respect to t to clean up the notation):
1 t 1 t
x p = u 1 (t)e− β − u 1 (t) e− β + u 2 (t)e β + u 2 (t) e β
t t
β β
= u 1 (t)e− β + u 2 (t)e β
t t
1 t 1 t
−u 1 (t) e− β + u 2 (t) e β
β β
We know there are two solutions to the model, e− β and e β which are linearly inde-
t t
pendent functions. Hence, there associated Wronskian is never zero for all s. Letting
x1 (t) = e− β and x2 (t) = etβ , consider the system
t
x1 (t) x2 (t) φ(t) 0
=
x1 (t) x2 (t) ψ(t) g(t)
for any appropriately nice function g. For each fixed t, the determinant of this system
is the value of the Wronskian which is not zero. Hence, there is a unique solution
for the value of φ(t) and ψ(t) for each t. In particular, we can use this idea with
the functions φ(t) = u 1 (t) and ψ(t) = u 2 (t) so the first row gives us a condition we
must impose on our unknown functions u 1 (t) and u 2 (t). We must have
u 1 (t)e− β + u 2 (t)e β = 0
t t
1 t 1 t
x p (t) = −u 1 (t) e− β + u 2 (t) e β
β β
1 t 1 t 1 1 t
x p (t) = −u 1 (t) e− β + u 2 (t) e β + u 1 (t) 2 e− β + u 2 (t) 2 e β
t
β β β β
Now plug these derivative expressions into the nonhomogeneous equation to find
1 βt 1 − βt 1 βt 1 − βt
f (t) = β u 2 (t) e − u 1 (t) e + u 2 (t) 2 e + u 1 (t) 2 e
2
β β β β
− u 2 (t)e β + u 1 (t)e− β
t t
Now factor out the common u 1 (t) and u 2 (t) terms to find after a bit of simplifying
that
1 t 1 t
f (t) = β 2 u 2 (t) e β − u 1 (t) e− β + u 2 (t)(e β − e β ) + u 1 (t)(e− β − e− β )
t t t t
β β
f (t) 1 t 1 t
= u 2 (t) e β − u 1 (t) e− β
β2 β β
u 1 (t)e− β + u 2 (t)e β = 0
t t
1 t 1 t f (t)
−u 1 (t) e− β + u 2 (t) e β = 2
β β β
We then use Cramer’s Rule to solve for the unknown functions u 1 and u 2 . Let W
denote the matrix
t
e− β
t
eβ
W =
− β1 e− β β1 e β
t t
176 7 Time Independent Solutions to Infinite Cables
and
e− β
t
0
1 − βt f (t)
−βe β2 1
f (t)e− β
t
u 2 (t) = =
det (W ) 2β
where 0 is a convenient starting point for our integration. Hence, the particular
solution to the nonhomogeneous time independent equation is
t t
1 1
f (u) e β du e− β + f (u) e− β du e β .
u t u t
= −
2β 0 β 0
for any real constants A1 and A2 . Finally, note we can rewrite these equations as
t t
− βt 1 1
f (u) e−
t u−t u−t
x(t) = A1 e + A2 e − β f (u) e β du + β du
2β 0 2β 0
or
− e−
u−t u−t
t
− βt 1t e β β
x(t) = A1 e + A2 e − β f (u) du
β 0 2
7.2 Solving the Time Independent Infinite Cable Equation 177
w −w
In applied modeling work, the function e −e 2
arises frequently enough to be given a
name. It is called the hyperbolic sine function and is denoted by the symbol sinh(w).
Hence, we can write once more to see
1 t
u−t
x(t) = A1 e− β + A2 e β −
t t
f (u) sinh du.
β 0 β
Finally, sinh is an odd function, so we can pull the minus side inside by reversing
the argument into the sinh function. This gives
1 t
t −u
x(t) = A1 e− β + A2 e β +
t t
f (u) sinh du
β 0 β
Now let’s use the initial conditions x(0) = −1 and x(5) = 4. Hence,
−1 = x(0) = A1 + A2
− β5 15
5
5−u
4 = x(5) = A1 e + A2 e + β f (u) sinh du
β 0 β
Note that because of our assumptions, the lower and upper limit of integration always
give points in the interval [a, b] where f (s, t) is defined and so the Riemann integral
makes sense to calculate. Then, we have
v(t)
∂f
F (t) = (s, t) ds + f (v(t), t) v (t) − f (u(t), t) u (t).
u(t) ∂t
Proof The proof of this is essentially similar to the proof of the Cauchy Fundamental
Theorem of Calculus. It is found in a good book on analysis (you can ask for our
notes on these matters if you are adventuresome!).
178 7 Time Independent Solutions to Infinite Cables
The first example below has an initial condition on the derivative of the solution at
0; hence, Leibnitz’s rule will be needed.
7.2.1.1 Examples
u (t) + 9u(t) = 2t
u(0) = 1
u (3) = −1
where A and B are arbitrary constants. The nonhomogeneous solution is of the form
where this time the functions φ and ψ play the role of the functions u 1 and u 2 we
used earlier. Since the solution we seek is u(t) it is confusing to have the extra u 1
and u 2 and so we switch to the variables φ and ψ. We know the functions φ and ψ
must then satisfy
cos(3t) sin(3t) φ (t) 0
=
−3 sin(3t) 3 cos(3t) ψ (t) 2t
and
1 cos(3t) 0 2
ψ (t) = = t cos(3t)
3 −3 sin(3t) 2t 3
1 = u(0) = A
3
−1 = u (3) = −3A sin(9) + 3B cos(9) + 2u cos(9 − 3u) du
0
Hence, A = 1 and
3
−1 + 3 sin(9) − 0 2u cos(9 − 3u) du
B= .
3 cos(9)
u (t) + 9u(t) = 2t
u(0) = 1
u(4) = −1
180 7 Time Independent Solutions to Infinite Cables
Solution The model is the same as the previous example except for the boundary
conditions. We have
1 = u(0) = A
4
2
−1 = u(4) = A cos(12) + B sin(12) + u sin(12 − 3u) du.
3 0
and so
4
1 + cos(12) + 2
u sin(12 − 3u) du
B=− 3 0
.
sin(12)
7.2.1.2 Homework
u (t) + 4u(t) = 2t
u(0) = 2
u(4) = −6
expressing the particular solution in integral form. Note, if you are brave, you can
calculate this integral, but be warned it needs integration by parts.
u (t) − 4u(t) = 2t
u(0) = 2
u (0) = −1
d 2 vm
λ2c − vm (z) = −ro λ2c ke (z)
dz 2
and we solve this model using Variation of Parameters. We find the general
solution is
z
− λzc z s−z
φ(z) = A1 e + A 2 e c + r 0 λc
λ ke (s) sinh ds.
0 λc
We are interested in understanding what the membrane voltage solution should look
like in the event of a current injection at say z = 0 for a very short period of time. We
could then use this idealized solution to understand the response of the cable model
to current injections occurring over very brief time periods of various magnitudes at
various spatial locations. Now let’s specialize as follows: we assume
• The current injection ke is symmetric about 0.
• The current ke (z) is zero on (−∞, −C) ∪ (C, ∞) for some nonzero C.
• The current smoothly varies to zero at C and −C; i.e. ke is at least differentiable
on the z axis.
• The area under the curve, which is the current applied to the membrane,
C
−C ke (s)ds is I.
Given this type of current injection, we see we are looking for a solution to the
problem
⎧
⎨0 z < −C
d 2
vm
λ2c − vm = −r o λ 2
k e −C ≤z≤C
dz 2 ⎩ c
0 C<z
This amounts to solving three differential equations and then recognizing that the
total solution is the sum of the three solutions with the condition that the full solution
is smooth, i.e. continuous, at the points −C and C where the solutions must connect.
182 7 Time Independent Solutions to Infinite Cables
Now we know that membrane voltages are finite. In the first and third region we
seek a solution, we are simply solving the homogeneous equation. We know then the
solution is of the form Ae−w + Bew in both of these regions where w(z) = z/λc .
However, in the (−∞, −C) region, the finiteness of the potential means that the
Bew solution is the only one possible and in the (C, ∞) region, the only solution is
therefore of the form Ae−w . In the middle region, the solution is given by the general
solution we found from the Variation of Parameters method. Thus, for each choice
of positive C, we seek a solution of the form
⎧
⎪
⎪ Bew(z) z < −C
⎪
⎨ A e−w(z) + A ew(z)
1 2
φC (z) = r0 λc −w(z) z s
− λsc
⎪ + λc ds − r0 λc ew(z) z
⎪
⎪ 2
⎩ −w(z)
e 0 ke (s) e 2 0 ke (s) e ds −C ≤ z ≤ C
Ae C<z
Our solution and its derivative should be continuous at −C and C. Between −C and
C, we compute the derivative of the solution to be
A1 −w(z) A2 w(z)
φC (z) = − e + e
λc λc
r 0 λc r0 −w(z) z
ke (z) e−w(z) ew(z) −
s
+ e ke (s) e λc ds
2 2
0
r 0 λc r0 w(z) z
ke (z) e−w(z) ew(z) − ke (s) e− λc ds
s
− e
2 2 0
This simplifies to
A1 −w(z) A2 w(z)
φC (z) = − e + e
λc λ
z c
r0
− e−w(z) ke (s) ew(s) ds
2
z0
r0
− ew(z) ke (s) e−w(s) ds (7.3)
2 0
Now, let ω = C
λc
. Continuity in the solution at the point −C gives:
−C −C
r 0 λc ω r0 λc −ω
Be−ω = A1 eω + A2 e−ω + e ke (s) ew(s) ds − e ke (s) e−w(s) ds
2 0 2 0
7.3 Modeling Current Injections 183
This simplifies to
0 0
B −ω A1 A2 −ω r0 ω r0 −ω
e = − eω + e + e ke (s) ew(s) ds + e ke (s) e−w(s) ds
λc λc λc 2 −C 2 −C
r 0 λc
and M = 2
. We can then rewrite our continuity conditions as
r 0 λc ω 0 r0 λc −ω 0
Be−ω = A1 eω + A2 e−ω − e ke (s) ew(s) ds + e ke (s) e−w(s) ds
2 −C 2 −C
C C
r0 λc −ω r 0 λc ω
Ae−ω = A1 e−ω + A2 eω + e ke (s) ew(s) ds − e ke (s) e−w(s) ds
2 0 2 0
0
B −ω A1 A2 −ω r0 r0 −ω 0
e = − eω + e + eω ke (s) ew(s) ds + e ke (s) e−w(s) ds
λc λc λc 2 −C 2 −C
C
A −ω A1 A2 ω r0 r0 ω C
− e = − e−ω + e − e−ω ke (s) ew(s) ds − e ke (s) e−w(s) ds
λc λc λc 2 0 2 0
Multiplying the third and fourth equation by λc , we obtain our final form:
Solving the four new Eqs. (7.4) − (7.6), (7.4) + (7.6), (7.5) − (7.7) and (7.5) + (7.7),
we find
−2 A1 + 2M J1− = 0
2B − 2 A2 − 2M J2− = 0
2 A − 2 A1 − 2M J1+ = 0
−2 A2 + 2M J2+ = 0
A1 = M J1−
A2 = M J2+
A = A1 + M J1+ = M J1− + M J1+ = M(J1+ + J1− )
B = A2 + M J2− = M J2+ + M J2− = M(J2+ + J2− )
We can perform the analysis we did in the previous section for any pulse of that form.
What happens as the parameter C approaches 0? As before, we look at pulses which
have these properties for each positive C:
• The current injection keC is symmetric about 0.
• The current keC (z) is zero on (−∞, −C) ∪ (C, ∞)
• The current smoothly varies to zero at ±C so that keC is differentiable on the z axis.
• The area under the curve, which is the current applied to the membrane,
C
−C ke (s)ds is I for all C. This means that as the width of the symmetric pulse
C
goes to zero, the height of the pulse goes to infinity but in a controlled way: the
186 7 Time Independent Solutions to Infinite Cables
area under the pulses is always the same number I . So no matter what the base of
the pulse, the same amount of current is delivered to the membrane.
The solution is
⎧
Mew −C keC (s) e−w(s) ds
C
⎪
⎪ z < −C
⎨
− −w + w z
φC (z) = M(J1C e + J2C e ) + 2M keC (s) sinh s−z
λc
ds −C ≤ z ≤ C
⎪
⎪
0
⎩
Me−w −C keC (s) ew(s) ds
C
C < z.
Pick a point z 0 that is not zero. Since z 0 is not zero, there is a value of positive number
C ∗ so that z 0 is not inside the interval (−C ∗ , C ∗ ). This means that z 0 is outside of
(−C, C) for all C smaller that C ∗ . Hence, either the first part or the third part of
the definition of φC applies. We will argue the case for z 0 is positive which implies
that the third part of the definition is the one that is applicable. The case where z 0 is
negative would be handled in a similar fashion. Since we assume that z 0 is positive,
we have for all C smaller than C ∗ :
C
−w0
φC (z 0 ) = Me keC (s) ew(s) ds
−C
where w0 = z0
λc
. Next, we can prove as C goes to 0, we obtain
+ I
lim J1C =
C→0 2
7.4 Modeling Instantaneous Current Injections 187
− I
lim J1C =−
C→0 2
+ I
lim J2C =
C→0 2
− I
lim J2C =−
C→0 2
Proof It suffices to show this for just one of these four cases. We will show the first
+
one. In mathematics, if the limit as C goes to 0 of J1C exists and equals 2I , this means
that given any positive number , we can find a C ∗∗ so that if C < C ∗∗ , then
+
J − I <
1C 2
However, we know that the area under the curve is always I ; hence for any C,
C
I = keC (s)ds
−C
2
Now we know that this exponential function is continuous at 0; hence, given I
, there
is a δ so that
2
|e− λc − 1| <
s
if |s| < δ
I
Since, C goes to zero, we see that there is a positive number C ∗∗ , which we can
choose smaller than our original C ∗ , so that C ∗∗ < δ. Thus, if we integrate over
188 7 Time Independent Solutions to Infinite Cables
[0, C] for any C < C ∗∗ , all the s values inside the integral are less than δ. So we can
conclude
C
+ I 2
|J1C − |< keC (s) ds = .
2 0 I
+
This shows that the limit as C goes to 0 of J1C is 2I .
r o λc I z 0
lim φC (z 0 ) = e λc .
C→0 2
When we are at zero, since 0 is in (−C, C) for all C, we must use the middle part of
the definition of φC always. Now at 0, we see
− −0 + 0
0
s−0
φC (0) = M(J1C e + J2C e ) + 2M keC (s) sinh ds
0 λc
− +
= M(J1C + J2C )
r o λc I
lim φC (0) = M I = .
C→0 2
Combining all of the above parts, we see we have shown that as C goes to 0, the
solutions φC converge at each point z (mathematicians say this sequence of functions
converges pointwise on (−∞, ∞)) to the limiting solution φ defined by
ro λc −| z |
φ(z) = I e λc
2
7.4 Modeling Instantaneous Current Injections 189
Now if the symmetric pulse sequence was centered at z 0 with pulse width C, we
can do a similar analysis (it is yucky though and tedious!) to show that the limiting
solution would be
ro λc − |z−z0 |
φ(z) = I e λc .
2
Now as C gets small, our symmetric pulses have very narrow base but very large
magnitudes. Clearly, these pulses are not defined in the limit as C goes to 0 as the
limit process leads to a current Iδ (z) which is the limit of the base pulses we have
described:
Note, in the limit as C gets small, we can think of this process as delivering an
instantaneous current value. This idealized current thus delivers a fixed amount I at
z = 0 instantly! Effectively, this means that the value of the current density keeps
getting larger while its spatial window gets smaller. A good example (though not
quite right as this example is not continuous at ±1/n) is a current density of size
n I which on the spatial window [−1/n, 1/n]. The current for any n that is applied
is the product of the current density and the distance it is applied: n I × 1/n = I .
From a certain point of view, we can view the limiting current density as depositing
an “infinite” amount of current in zero time: crazy, but easy to remember! Hence, we
can use the definition below as a short hand reminder of what is going on:
0 z = 0
Iδ (z) =
∞z=0
In fact, since the total current deposited over the whole cable is I , and integration can
be interpreted as giving the area under a curve, we can use the integration symbol
∞
−∞ to denote that the total current applied over the cable is always I and write
∞
Iδ (z)dz = I.
−∞
Then using this notation, we see our idealized current Iδ can be written as
Iδ (z − 0) = I δ(z − 0).
and hence I δ(z − z 0 ) is a idealized pulse applied at z 0 . Note that the notion of an
idealized pulse allows us to write the infinite cable model for an idealized pulse
applied at z 0 of magnitude I in a compact form. We let the applied current density
be ke (z) = I δ(z − z 0 ) giving us the differential equation
d 2 vm
λ2c − vm (z) = −ro λ2c I δ(z − z 0 )
dz 2
d 2 vm N
λ2c − vm (z) = −r o λ 2
c Ii δ(z − z i )
dz 2 i=0
7.5 Idealized Impulse Currents 191
with solution
r 0 λc
N
z−z i
φ(z) = Ii e−| λc |
2 i=0
Note that the membrane voltage solution is a nonlinear summation of the applied
idealized current injections. For example, let’s inject current of magnitudes I at 0
and 2I at λc respectively. The solution to the current injection at 0 is vm1 and at λc ,
vm2 . Thus,
r o λc |z|
vm1 (z) = I e − λc
2
r o λc |z−λc |
vm2 (z) = 2I e− λc
2
We get a lot of information by looking at these two solutions in terms of units of
the space constant λc . If you look at Fig. 7.2, you’ll see the two membrane voltages
plotted together on the same access. Now the actual membrane voltage is, of course,
vm1 added to vm2 which we don’t show. However, you can clearly see how quickly the
peak voltages fall off as you move away from the injection site.
Note that one space constant away from an injection site z 0 , the voltage falls by
a factor of 1e or 37 %. This is familiar exponential decay behavior.
b
We often need to evaluate integrals of the form a δ(x − x0 )g(x)d x where x0 is in
the interval [a, b]. Let keC be our usual set of pulses which we use to approximate the
impulse function except this time we center the pulses at x0 . Then, we have
b C+x0
keC (x)g(x)d x = keC g(x)d x.
a C−x0
Now as long as g is continuous on [a, b], g has a minimum and maximum value on
the interval [C − x0 , C + x0 ]; call these gmC and g CM . Then we have the inequalities
C+x0 C+x0 C+x0
gmC keC (x)d x ≤ keC (x)g(x)d x ≤ g CM keC (x)d x.
C−x0 C−x0 C−x0
C+x0
But the C−x0 keC (x)d x = 1 so we have
C+x0
gmC ≤ keC (x)g(x)d x ≤ g CM .
C−x0
b
This limit is what we mean by the integral a δ(x − x0 )g(x)d x and so we have shown
b
that a δ(x − x0 )g(x)d x = g(x0 ).
∂vm
km (z, t) = gm vm (z, t) + cm
∂t
Here, we are interested in time independent solutions, so we have the simpler
equation
km (z) = gm vm (z)
7.6 The Inner and Outer Current Solutions 193
r o λc |z|
km (z) = gm I e − λc
2
From our core conductor equations, we know that
∂ Ii
= −K m (z)
∂z
we see that
∂i i
= −K m0 − km (z)
∂z
Integrating, we see
z
i i (z) = − (K m0 + km (u))du
−∞
We expect that the internal current is finite and this implies that the initial current
density K m0 must be zero as otherwise we obtain unbounded current. We thus have
∂i i
= − km (z) (7.8)
∂z
and so
z z
i i (z) − i i (−∞) = − km (u)du = − gm vm (u)du
−∞ −∞
z u
r o λc −∞ e u
λc z<0
=− gm I 0 z − λu
2 c du + c du z ≥ 0
−∞ e 0 e
λ
Also, for an impulse current applied at zero, we would expect that the inner current
vanish at both ends of the infinite cable. Hence, i i (−∞) must be zero. We conclude
u
λc e λc −∞
z
r o λc z
= λ c e λc z<0
i i (z) = − gm I
λc e λc 0−∞ − λc e− λc 0z = λc (2 − e− λc ) z ≥ 0
u u z
2
194 7 Time Independent Solutions to Infinite Cables
Now, from Sect. 6.5, Eqs. 6.1 and 6.2, we know in our time independent case
∂ Ii ∂ Io
= −K m (z), = K m (z) − K e (z)
∂z ∂z
which implies
∂i i ∂i o
+ = −K e (z) = −K e0 − ke (z)
∂z ∂z
Integrating, we have
z
∂i i z
∂i o z
du + du = − (K e0 + ke (u))du
−∞ ∂z −∞ ∂z −∞
In order for this integration to give us finite currents, we see the constant K e0 must
be zero implying
z
i i (z) − i i (−∞) + i o (z) − i o (−∞) = − ke (u)du
−∞
The argument to see this can be sketched as follows. If z is positive, for small enough
C, the impulse current keC is active on the interval [−C, C] with C less than z. For
such values of C, the integral becomes
C
keC (u)du = I
−C
7.6 The Inner and Outer Current Solutions 195
On the other hand, if z is negative, eventually the interval where keC is non zero lies
outside the region on integration and so we get the value of the integral must be zero.
Physically, since we are using an idealized injected current, we expect that the outer
current satisfies i o (−∞) is zero giving
−I z > 0
i i (z) + i o (z) =
0 z≤0
We can rewrite our current solutions more compactly by defining the signum function
sgn and the unit step function u as follows:
−1 z < 0 0 z<0
sgn(z) = , u(z) =
+1 z ≥ 0 1 z≥0
Then we have
ro I |z|
i i (z) = e− λc sgn(z) − 2u(z)
2(ri + ro )
From Sect. 6.5, Eqs. (6.3) and (6.4), we see that for our time independent case
∂Vi ∂Vo
= −ri Ii (z), = −ro Io (z)
∂z ∂z
196 7 Time Independent Solutions to Infinite Cables
∂vi ∂vo
= −ri [Ii0 + i i (z)], = −ro [Io0 + i 0 (z)]
∂z ∂z
We expect our voltages to remain bounded and so we must conclude that Ii0 and Io0
are zero, giving
z
vi (z) − vi (−∞) = −ri i i (u)du
−∞
z
vo (z) − vo (−∞) = −ro i o (u)du
−∞
To finish this step of our work, we must perform these messy integrations. They are
not hard, but are messy! After a bit of arithmetic, we find
r i r o I λc − λ|z|c z
vi (z) − vi (−∞) = e +2 u(z)
2(ri + ro ) λc
ro2 I λc − λ|z|c ri z
vo (z) − vo (−∞) = −e +2 u(z)
2(ri + ro ) r o λc
ro I λc − |z|
vi (z) − vo (z) = vi (−∞) − vo (−∞) + e λc
2
Recall that vm is precisely the last term in the equation above; hence we have
The usual convention is that the voltages at infinity vanish; hence vi (−∞) and
vo (−∞) are zero and we have the membrane voltage solution we expect:
ro λ2c gm I −|z| ri
i o (z) = − (e λc sgn(z) + 2 u(z))
2 ro
ri ro λ3c gm I −|z| z
vi (z) = − (e λc + 2 u(z))
2 λc
r 2 λ3 gm I −|z| ri z
vo (z) = − o c (− e λc + 2 u(z))
2 r o λc
vm (z) = vi (z) − vo (z)
where we assume vi and vo are zero at negative infinity. Since λ2c can be expressed
in terms of ri and ro , we have also shown that
ro λc I − |z|
vm (z) = e λc
2
ro I −|z|
i i (z) = (e λc sgn(z) − 2u(z))
2 (ri + ro )
ro I −|z| ri
i o (z) = − (e λc sgn(z) + 2 u(z))
2 (ri + ro ) ro
ri ro I −|z| z
vi (z) = − (e λc + 2 u(z))
2 (ri + ro ) λc
ro2 I −|z| ri z
vo (z) = − (− e λc + 2 u(z))
2 (ri + ro ) r o λc
7.8.1 Homework
Exercise 7.8.1 Write Matlab functions to implement all the infinite cable transient
variable solutions using as many arguments to the functions as are needed.
1. vm
2. ii
3. io
4. vi
5. vo .
Exercise 7.8.2 Generate a parametric plot of each of these variables versus the
space variable z on a reasonable size range of z for the parameters λc and Ie∗ .
1. vm
2. ii
3. io
4. vi
5. vo .
Chapter 8
Time Independent Solutions to Finite
and Half-Infinite Space Cables
Earlier, we injected an idealized pulse of current into the inner cable at z = 0 but
now we will inject into the current into the front face of the cable. Since the cable
is of radius a, this means we are injecting current into a membrane cap of surface
© Springer Science+Business Media Singapore 2016 199
J.K. Peterson, Calculus for Cognitive Scientists, Cognitive Science
and Technology, DOI 10.1007/978-981-287-880-9_8
200 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
area π a 2 . Note there is no external current source here and hence ke is zero. The
underlying cable equation is
d 2 vm
λ2c − vm = 0, z ≥ 0
dz 2
with solution
vm (z) = A e− λc , z ≥ 0
z
8.1 The Half-Infinite Cable Solution 201
for some value of A which we will determine in a moment. We know that the mem-
brane current density is given by
km (z) = gm vm (z)
and further, from Eq. 7.8, the time independent transient inner current satisfies
di i
= −km (z) = −gm vm (z)
dz
Since the cable starts at z = 0 and moves off to infinity, let’s integrate this differential
equation from z to R for progressively large values of R and see what happens in the
limit as R → ∞. We find
R R
di i
e− λc ds
s
dz = −gm A
z dz z
i i (R) − i i (z) = gm λc A e− λc − e− λc
R z
Thus,
R→∞
However, we would expect the inner current to become negligible as we move to the
end of the cable. Hence, lim R→∞ i i (R) = 0 and we have
i i (z) = gm λc Ae− λc
z
We also know that current of magnitude I is being injected into the front face of the
inner cable; hence i i (0) must be I . This tells us that
i i (0) = gm λc A = I
I
e− λc , i i (z) = I e− λc
z z
vm (z) =
gm λc
From Ohm’s Law, we know that the ratio of current to voltage is conductance. The
work above suggests that we can define the conductance of the inner cable at z = 0
by the ratio vimi (0)
(0)
. Therefore the ratio of this current to voltage at z = 0, defines an
idealized conductance for the end cap of the cable. This conductance is called the
202 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
i i (0)
G∞ = = gm λc
vm (0)
which tells us that G∞ is proportional to the 3/2 power of a. Thus, larger fibers have
larger characteristic conductances!
If a cable is many space constants long (remember the space constant is propor-
tional to the square root of a, then the half-infinite model we discuss here may be
appropriate. We will be able to show this is a reasonable thing to do after we handle
the true finite cable model. Once that is done, we will see that the solutions there
approach the half-infinite model solutions as L goes to infinity.
If the cable becomes a piece of length L as shown in Fig. 8.2, then there are now
two faces to deal with; the input face through which a current pulse of size I is
delivered into some conductance and an output face at z is L which has a output
load conductance of Ge . Ge represents either the conductance of the membrane that
caps the cable or the conductance of another cable or cell soma attached at this point.
8.2 The Finite Cable Solution: Current Initialization 203
d 2 vm
λ2c − vm (z) = 0, 0 ≤ z ≤ L
dz 2
The general solution to this homogeneous equation has been discussed before. The
solution we seek will also need two boundary conditions to be fully specified. The
general form of the membrane potential solution is
vm (z) = A1 e λc + A2 e− λc , 0 ≤ z ≤ L
z z
We will rewrite this in terms of the new functions hyperbolic sine and hyperbolic
cosine defined as follows:
e λc + e − λc e λc − e − λc
z z z z
z z
cosh = , sinh =
λc 2 λc 2
Further, since
d d
cosh(z) = sinh(z), sinh(z) = cosh(z)
dz dz
Using the simplest possible antiderivative (i.e. the integration constant is 0), upon
integrating, we find an inner current solution to be
L−z L−z
i i (z) = gm λc A1 sinh + gm λc A2 cosh
λc λc
Next, we have
L L
i i (0) = gm λc A1 sinh + gm λc A2 cosh
λc λc
0 0
i i (L) = gm λc A1 sinh + gm λc A2 cosh = A2 gm λc .
λc λc
Thus,
L Ge L
I = A1 G∞ sinh + cosh
λc G∞ λc
giving us
⎛ ⎞
I ⎜
⎜ 1 ⎟
A1 = ⎟
G∞ ⎝ Ge
⎠
sinh L
λc
+ G∞
cosh L
λc
⎛ ⎞
I Ge ⎜
⎜ 1 ⎟
A2 = 2 ⎝
⎟
⎠
G∞ Ge
sinh L
λc
+ G∞
cosh L
λc
8.2 The Finite Cable Solution: Current Initialization 205
⎛ ⎞
G∞ sinh + Ge cosh
L−z L−z
I ⎜
⎜
λc λc ⎟
⎟
i i (z) =
G∞ ⎝ ⎠
sinh λLc + GG∞e cosh λLc
sinh(u)
tanh(u) =
cosh(u)
and it is easy to show that as u goes to infinity, tanh(u) goes to 1. We can rewrite the
formula for GT (L) to be
⎛ ⎞
Ge
+ tanh λLc
⎜ G∞ ⎟
GT (L) = G∞ ⎜ ⎟
⎝ ⎠
Ge
G∞
tanh λc + 1
L
206 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
Ge
G∞
+1
lim GT (L) = G∞ Ge
= G∞
L→∞
G∞
+1
Hence, the Th‘evenin input conductance of the cable approaches the idealized
Th‘evenin input conductance of the half-infinite cable. There are several interest-
ing cases: for convenience of exposition, let’s define
L−z Ge
Z = , H= ,
λc G∞
L
L = , D = sinh(L ) + H cosh(L )
λc
I cosh(Z ) + H sinh(Z )
vm (z) =
G∞ sinh(L ) + H cosh(L )
I cosh(Z ) + H sinh(Z )
=
G∞ D
I G∞ sinh(Z ) + Ge cosh(Z )
i i (z) =
G∞ sinh(L ) + H cosh(L )
I G∞ sinh(Z ) + Ge cosh(Z )
=
G∞ D
sinh(L ) + H cosh(L )
GT (L) = G∞
cosh(L ) + H sinh(L )
Ge = 0 If the conductance of the end cap is zero, then H is zero and no current
flows through the endcap. We see
sinh(L )
GT (L) = G∞ = G∞ tanh(L )
cosh(L )
Ge = G∞ If the conductance of the end cap is G∞ , then H is one and we see the
finite cable acts like the half-infinite cable:
sinh(L ) + cosh(L )
GT (L) = G∞ = G∞
cosh(L ) + sinh(L )
Ge = ∞ If the conductance of the end cap is ∞, the end of the cable acts like it is
short-circuited, H is infinity. Divide our original conductance solution by H top
and bottom and letting K denote the reciprocal of H , we see:
8.2 The Finite Cable Solution: Current Initialization 207
K sinh(L ) + cosh(L )
GT (L) = G∞
K cosh(L ) + sinh(L )
cosh(L )
GT (L) = G∞ = G∞ coth(L )
sinh(L )
For convenience, let’s think of L as λLc and ρ as GG∞e . Then the ratio of the voltage at
the end of the cable to the voltage at the beginning can be expressed as
vm (L) 1
=
vm (0) cosh(L ) + ρ sinh(L )
This ratio measures the attenuation of the initial voltage as we move down the cable
toward the end. We can plot a series of these attenuations for a variety of values of ρ.
In Fig. 8.3, the highest ρ value is associated with the bottom most plot and the lowest
value is associated with the top plot. Note as ρ increases, there is more conductivity
through the end cap and the voltage drops faster. The top plot is for ρ is zero which is
the case of no current flow through the end cap. We can also look how the Th‘evenin
equivalent conductance varies with the value of ρ. We can easily show that
GT (L) tanh(L ) + ρ
GT∗ (L) = =
G∞ 1 + ρ tanh(L )
In Fig. 8.4, we see that the ρ is one is the plot to which the other choices approach.
When ρ is above one, the input conductance ratio curve starts above the ρ is one
curve; when ρ is below one, the ratio curve approaches from below.
We want to compare the membrane voltages we see in the infinite cable case to
the ones we see in the finite cable case. Now in the infinite cable case, I current is
deposited at z = 0 and the current injection spreads out uniformly to both sides of 0
208 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
r0 I λc −|z|
vm (z) = e λc
2
where the finite cable case is missing the division by 2 because in a sense, the current
is not allowed to spread backwards. Hence to compare solutions, we will inject 2 I
into the infinite cable at 0 and I into the finite cable. Now at z = 0, the finite cable
solution gives
In the examples below, we set G∞ , λc and r0 are one and set the cable length to 3.
Hence, since for L = 3, tanh(L ) is very close to one, we have
1+ H
vm (0) ≈ I ≈ I
H +1
So for these parameters, we should be able to compare the infinite and finite cable
solutions nicely.
MatLab code to implement the infinite cable voltage solution is given below:
It is straightforward to modify the code above to handle the finite cable case:
We are choosing to look at these solutions for a cable length of 3 with all the
other parameters set to 1 for convenience except for the cable length which will be 3
and the endcap load conductance Ge which we will vary. We are also injecting 2 Ie∗
into the infinite cable as we mentioned we would do. Note the finite cable response
attenuated more quickly than the infinite cable unless Ge is G∞ ! You can see a variety
of results in Figs. 8.5a, b and 8.6a, b.
8.2.4 Homework
Exercise 8.2.1 Write Matlab functions to implement the finite cable transient vari-
able solutions using as many arguments to the functions as are needed.
1. vm
2. i i
8.2 The Finite Cable Solution: Current Initialization 211
Fig. 8.5 Low end cap loads. a End cap load is 0.1, b End cap load is 1.0
Fig. 8.6 High end cap loads. a End cap load is 5.0, b End cap load is 50.0
Exercise 8.2.2 Generate a parametric plot of each of these variables versus the
space variable z on a reasonable size range of z for the parameters λc , Ie∗ , cable
length L and Ge . The ratio of Ge to G∞ is a very reasonable parameter to use.
1. vm
2. i i
Exercise 8.2.3 Plot GT (L) versus L and the horizontal line G∞ on the same plot
and discuss what is happening.
We can redo what we have discussed in the above using a different initial condition.
Instead of specifying initial current, we will specify initial voltage. As you might
expect, this will generate slightly different solutions. We use the same start:
212 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
L−z L−z
vm (z) = A1 cosh + A2 sinh
λc λc
L−z L−z
i i (z) = A1 G∞ sinh + A2 G∞ cosh
λc λc
Our boundary conditions are now vm (0) = V0 and i i (L) = Ge vm (L). Also, we will
use the abbreviations from before: H , Z and L but change D to
E = cosh(L ) + H sinh(L )
Hence, V0
E
= VL and from this we obtain our final expression for the solution:
V0
vm (z) = cosh(Z ) + H sinh(Z )
E
V0
i i (z) = G∞ sinh(Z ) + H cosh(Z )
E
We will find that the Th‘evenin equivalent conductance at the end cap is still the
same. We have the same calculation as before
Finally, it is easy to see that the relationship between the current and voltage initial-
ization condition is given by
V0 GT (L) = i i (0)
We can then find voltage and current equations for various interesting end cap con-
ductance loads:
Ge = 0: If the conductance of the end cap is zero, then H is zero and no current
flows through the endcap. We see
cosh(Z ) sinh(Z )
vm (z) = V0 , i i (z) = V0 G∞ , GT (L) = G∞ tanh(L ).
cosh(L ) cosh(L )
Ge = G∞ : If the conductance of the end cap is G∞ , then H is one and we see the
finite cable acts like the half-infinite cable:
cosh(Z ) + sinh(Z ) −z
vm (z) = V0 = V0 e λc ,
cosh(L ) + sinh(L )
sinh(Z ) + cosh(Z ) −z
i i (z) = V0 G∞ = V0 G∞ e λc
cosh(L ) + sinh(L )
GT (L) = G∞ .
Ge = ∞: If the conductance of the end cap is ∞, the end of the cable acts like it
is short-circuited, H is infinity. We see
sinh(Z ) cosh(Z )
vm (z) = V0 , i i (z) = V0 G∞ , GT (L) = G∞ coth(L )
sinh(L ) sinh(L )
8.3.1 Homework
Exercise 8.3.1 Write Matlab functions to implement vm , i i and GT (L) using as many
arguments to the functions as are needed. The arguments will be L, λc , z, V0 , G∞
and Ge .
(a) Compute vm at z = 0.6 and 1.0. Compute vm for the infinite cable model too
at these points.
2. Let Ge = 2.0
(a) Compute vm at z = 0.6 and 1.0. Compute vm for the infinite cable model too
at these points.
3. Let Ge = 50.0
(a) Compute vm at z = 0.6 and 1.0. Compute vm for the infinite cable model too
at these points.
4. Discuss the results.
We can have two types of current injection. The first is injected through the outer
membrane and is modeled by the pulses ke . We know the outer cylinder is a theoretical
abstraction and so there is really no such physical membrane. The second is injected
into the front face of the cable in either a finite or half-infinite case. This current is
modeled as an initialization of the inner current i i . So consider the model we see in
Fig. 8.7. The differential equation we would solve here would be
d 2 vm
λ2c − vm = −ro λ2c I0 δ(z − z 0 ) − ro λ2c I1 δ(z − z 1 ), 0 ≤ z ≤ L
dz 2
i i (0) = I
i i (L) = Ge vm (L) (8.1)
Here current I is injected into the front face and two impulse currents are injected
into the outer cylinder. If we are thinking of this as a model of an axon, we could
throw away the external sources and think of the current I injected into the front face
as the current that arises from membrane voltage changes that propagate forward
from the dendrite and soma system. Hence, the front face current I is a lumped sum
approximation of the entire dendrite and soma subsystem response. On the other
hand, if we are modeling a dendrite, we could think of the front face current I as
a lumped sum model of the synaptic voltages that have propagated forward up to
that point from the the rest of the dendrite system we are not modeling. The external
current sources are then currents induced by synaptic interactions or currents flowing
through pores in the membrane. Of course, voltage modulated gates would be handled
differently!
Since our differential equation system is linear, to solve a problem like (8.1),
we can simply add together the solutions to individual problems. This is called
8.4 Synaptic Currents 215
superposition of solutions and it is a very important tool in our work. Hence, to solve
(8.1) we solve
d 2 vm
λ2c − vm = 0, 0 ≤ z ≤ L
dz 2
i i (0) = I
i i (L) = Ge vm (L) (8.2)
and
d 2 vm
λ2c − vm = −ro λ2c I0 δ(z − z 0 ), 0 ≤ z ≤ L
dz 2
i i (0) = 0
i i (L) = Ge vm (L) (8.3)
and
d 2 vm
λ2c − vm = −ro λ2c I1 δ(z − z 1 ), 0 ≤ z ≤ L
dz 2
i i (0) = 0
i i (L) = Ge vm (L) (8.4)
216 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
and add the solutions together. Since we already know the solution to (8.2), it suffices
to solve (8.3).
d 2 vm
λ2c − vm = −ro λ2c I0 keC (z − z 0 ), 0 ≤ z ≤ L
dz 2
i i (0) = 0
i i (L) = Ge vm (L) (8.5)
where the family {kec } of impulses are modeled similar to what we have done before:
each is zero off [z 0 − C, z 0 + C], symmetric around z 0 and the area under the curve
is 1 for all C. So the only difference here is that our pulse family always delivers
a constant 1 amp of current and we control the magnitude of the delivered current
by the multiplier I0 . This way we can do the argument just once and know that our
results hold for different magnitudes I1 and so on. We assume for now that the site of
current injection is z 0 which is in (0, L). The case of z 0 being 0 or L will then require
only a slight modification of our arguments which we will only sketch leaving the
details to the reader. As usual, each current pulse delivers I0 amps of current even
though the base of the pulse is growing smaller and smaller. Physically, we expect,
like in the infinite cable problem, that the voltage acts like a decaying exponential
on either side of z 0 . To see this is indeed the idealized solution we obtain when we
let C go to 0, we resort to the following model:
⎧ z−z 0
⎪
⎨ A1 e z−zλc ,
C
0 ≤ z ≤ z0 − C
z−z 0
vmC (z) = αC e λc + β C e− λc + φCp (z),
0
z0 − C ≤ z ≤ z0 + C
⎪
⎩ C − z−z 0
A 2 e λc , z0 + C ≤ z ≤ L
The parts of the model before z 0 − C and after z 0 + C are modeled with exponential
decay, while the part where the pulse is active is modeled with the full general
solution to the problem having the form φh (z)+φCp (z), where φCh is the homogeneous
solution to the problem and φCp is the particular solution obtained from the variations
of parameters technique for a pulse keC . Since the pulse keC is smooth, we expect the
voltage solution to be smooth also; hence our solution and its derivative must be
continuous at the points z 0 − C and z 0 + C. This will give us four equations in four
unknowns we can solve for the constants AC1 , AC2 , αC and β C . Recall the auxiliary
equation for this differential equation is
λ2c r 2 − 1 = 0
8.4 Synaptic Currents 217
with roots 1
λc
and − λ1c . The homogeneous solution is then
z−z 0 z−z 0
φh (z) = B1 e λc + B2 e− λc
dU1 r o λc I 0 C z−z 0
=− ke (z − z 0 )e− λc
dz 2
dU2 r o λc I 0 C z−z 0
= ke (z − z 0 )e λc
dz 2
giving
z−z 0 z−z 0
φCp (z) = U1 (z) e λc + U2 (z) e− λc
z
r 0 λc I 0 s−z 0 z−z 0
+ − keC (s − z 0 ) e− λc ds e λc
2 z
z0
r 0 λc I 0 s−z 0 z−z 0
+ ke (s − z 0 ) e
C λ c ds e− λc
2 z0
When we modeled current injections before in Sect. 7.3, we forced continuity in the
solution and the derivative of the solution to find the unknown constants. To do this,
we need the derivative terms which are given below:
⎧ z − z0
⎪
⎪ C
⎪ A
⎪
⎪
⎪
1
e λc , 0 ≤ z ≤ z0 − C
⎪
⎪ λc
⎪
⎨ z − z0 z − z0
dvmC C
= α e λc − β e λc + dφ p ,
C C −
⎪ z0 − C ≤ z ≤ z0 + C
dz ⎪
⎪ λc λc dz
⎪
⎪ z − z0
⎪
⎪
⎪
⎪
C −
⎩ − A 2 e λc , z0 + C ≤ z ≤ L
λc
Computing (Eq. 8.7 + Eq. 8.8), (Eq. 8.7 − Eq. 8.8), (Eq. 8.9 and Eq. 8.9) and (Eq. 8.9
− Eq. 8.9), we find
dφCp
2 AC1 e−C − 2αC e−C = φCp (z 0 − C) + λc (z 0 − C)
dz
dφCp
−2β C eC = φCp (z 0 − C) − λc (z 0 − C)
dz
dφCp
−2αC eC = φCp (z 0 + C) + λc (z 0 + C)
dz
dφCp
2 AC2 e−C − 2β C e−C = φCp (z 0 + C) − λc (z 0 + C)
dz
dφCp
2 AC1 e−C = 2αC e−C + φCp (z 0 − C) + λc (z 0 − C)
dz
dφCp
= − φCp (z 0 + C) + λc (z 0 + C) e−2C + φCp (z 0 − C)
dz
C
dφ p
+ λc (z 0 − C)
dz
dφCp
2 AC2 e−C = 2Dn e−C + φCp (z 0 + C) − λc (z 0 + C)
dz
dφCp
= − φ p (z 0 − C) − λc
n
(z 0 + C) e−2C + φCp (z 0 + C)
dz
dφCp
− λc (z 0 + C)
dz
or
1 C dφCp
AC1 = − φ (z 0 + C) + λc (z 0 + C) e−C
2 p dz
1 C dφCp
+ φ (z 0 − C) + λc (z 0 − C) eC
2 p dz
1 C dφCp
AC2 = − φ (z 0 − C) − λc (z 0 + C) e−C
2 p dz
1 C dφCp
+ φ (z 0 + C) − λc (z 0 + C) eC
2 p dz
220 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
and so, using arguments very similar to those presented in Lemma 7.4.1, we can
show
1
lim φCp (z 0 + C) = −r0 λc I0 sinh(0)
C→0 2
=0
Finally, since
dφCp z
z−s
(z) = −r0 λc I0 keC (z − z 0 ) sinh(0) − r0 I0 keC (s − z 0 )cosh ds
dz z0 λc
we see
z0 + C
dφCp z−s
(z 0 + C) = −r0 I0 keC (s − z 0 )cosh ds
dz z0 λc
which gives
dφCp 1 r 0 I 0 λc
lim (z 0 + C) = −r0 I0 λc cosh(0) = − .
C→0 dz 2 2
and similarly
dφCp I0 r 0 I 0 λc
lim (z 0 − C) = r0 I0 λc cosh(0) = .
C→0 dz 2 2
r 0 λc I 0
A1 = lim AC1 =
C→0 2
r 0 λ c I0
A2 = lim AC2 =
C→0 2
8.4 Synaptic Currents 221
which is essentially our usual idealized impulse solution from the infinite cable
model
r0 λc I0 − |z−z0 |
vm (z) = e λc , 0 ≤ z ≤ L
2
Note the values of αC and β C are not important for the limiting solution.
Since
di i
= −gm vm
dz
and for the second boundary condition, i i (L) = Ge vm (L), we use the last part of the
definition of vm to give us, for a new integration constant ζ C ,
z−z 0
i i (z) = G∞ AC2 e− λc + ζC
and so
L−z 0 L−z 0
G∞ An2 e− λc + ζ C = Ge AC2 e− λc
or
L−z 0
ζ C = AC2 e− λc (Ge − G∞ )
222 8 Time Independent Solutions to Finite and Half-Infinite Space Cables
Hence, from the above, we see that the limiting inner current solutions satisfy
r 0 λc I 0 − z 0
γ = lim γ C = G∞ e λc
C→0 2
r0 λc I0 − L−z0
ζ = lim ζ C = (Ge − G∞ ) e λc
C→0 2
r0 λc I0 z−z0 r 0 λc I 0 − z 0
i i (z) = −G∞ e λc + G∞ e λc
2 2
and for z above z 0 ,
r0 λc I0 − z−z0 r0 λc I0 − L−z0
i i (z) = G∞ e λc + (Ge − G∞ ) e λc
2 2
We can now see the membrane voltage solution for the stated problem
d 2 vm
λ2c − vm = 0, 0 ≤ z ≤ L
dz 2
i i (0) = I
i i (L) = Ge vm (L)
in Fig. 8.8. Note here there are no impulses applied. If we add the two impulses at
z 0 and z 1 as described by the differential equations (8.3) and (8.1), the solution to
the full problem for somewhat weak impulses at two points on the cable can be seen
in Fig. 8.9. For another choice of impulse strengths, we see the summed solution
in Fig. 8.10. For ease of comparison, we can plot the solutions for no impulses,
two impulse of low strength and two impulses of higher strength simultaneously in
Fig. 8.11.
8.5 Implications
Even though we have still not looked into the case of time dependent solutions, we
can still say a lot about the nature of the solutions we see in the time independent
case.
8.5 Implications 223
• The space constant λc tells us how far we must be from the site of input current to
see significant attenuation of the resulting potential. Thus, if λc >> 1, the cable’s
membrane potential is close to position independent.
• An electrode used to input current or measure voltage can be thought of as infini-
tesimal in tip size if the tip size is very small compared to λc .
• Our underlying cable equation is a linear PDE. Hence, the superposition principle
applies and we can use it to handle arbitrary arrangements of current sources.
• We already know that
a 1 √
λc ≈ ≈ a
2ρi G m 2ρi G m
We have been discussing the equation whose solutions describe the voltage on a
dendritic cable. Recall the general model is
∂2 ∂
β2 −−α = 0, for 0 ≤ x ≤ L, t ≥ 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
∂
(L, t) = 0,
∂x
(x, 0) = f (x).
for positive constants α and β. The domain is the usual half infinite [0, L] × [0, ∞)
where the spatial part of the domain corresponds to the length of the dendritic cable.
The boundary conditions ux (0, t) = 0 and ux (L, t) = 0 are called Neumann Bound-
ary conditions. The conditions u(0, t) = 0 and u(L, t) = 0 are known as Dirichlet
Boundary conditions. The ballstick neuron model we solve in Chap. 11 uses a differ-
ent set of boundary conditions from these because the cable end cap membrane must
interact with the cell body membrane. We discuss this solution later. The solution to
a model such as this is a function (x, t) which is sufficiently smooth to have partial
derivatives with respect to the needed variables continuous for all the orders required.
For these problems, the highest order we need is the second order partials. One way
to find the solution is to assume we can separate the variables so that we can write
(x, t) = u(x)w(t). If we make this separation assumption, we will find solutions
that must be written as what are called infinite series and to solve the boundary con-
ditions, we will have to be able to express boundary functions as series expansions.
Hence, we will have to introduce some new ideas in order to understand these things.
Let’s motivate what we need to do by applying the separation of variables technique
to the cable equation. This will shows the ideas we need to use in a specific example.
Then we will step back and go over the new mathematical ideas of series and then
return to the cable model and finish finding the solution. In Chap. 10 we apply the
method to other linear PDE models.
We assume a solution of the form (x, t) = u(x) w(t) and compute the needed
partials. This leads to a the new equation
d2u dw
β2 w(t) − u(x)w(t) − αu(x) = 0.
dx 2 dt
Rewriting, we find for all x and t, we must have
2
2d u dw
w(t) β 2
− u(x) = αu(x) .
dx dt
Rewriting, we have
2
β 2 ddxu2 − u(x) α dw
= dt , 0 ≤ x <≤ L, t > 0.
u(x) w(t)
The only way this can be true is if both the left and right hand side are equal to the
separation constant . This leads to the decoupled Eqs. 9.1 and 9.2.
dw
α = w(t), t > 0, (9.1)
dt
d2u
β 2 2 = (1 + ) u(x), 0 ≤ x ≤ L, (9.2)
dx
We also have boundary conditions. Our assumption leads to the following boundary
conditions in x:
du
(0) w(t) = 0, t > 0,
dx
du
(L) w(t) = 0, t > 0.
dx
9.1 The Separation of Variables Method 231
du
(0) = 0, (9.3)
dx
du
(L) = 0. (9.4)
dx
Equations 9.1–9.4 give us the boundary value problem in u(x) we need to solve.
Then, we can find w.
9.1.1.1 Case I: 1 + = ω 2 , ω = 0
ω2
u − u=0
β2
u (0) = 0,
u (L) = 0.
with characteristic equation r 2 − ωβ 2 = 0 with the real roots ± √ωD . The general
2
which tells us
ω ω ω ω
u (x) = A sinh x + B cosh x
β β β β
u (0) = 0 = B
ω
u (L) = 0 = A sinh L
β
Hence, B = 0 and A sinh L ωβ = 0. Since sinh is never zero when ω is not zero, we
see A = 0 also. Hence, the only u solution is the trivial one and we can reject this
case.
u = 0
u (0) = 0,
u (L) = 0.
with characteristic equation r 2 = 0 with the double root r = 0. Hence, the general
solution is now
u(x) = A + B x
Applying the boundary conditions, u(0) = 0 and u(L) = 0. Hence, since u (x) = B,
we have
u (0) = 0 = B
u (L) = 0 = BL
Hence, B = 0 but the value of A can’t be determined. Hence, any arbitrary constant
which is not zero is a valid non zero solution. Choosing A = 1, let u0 (x) = 1 be our
chosen nonzero solution for this case. We now need to solve for w in this case. Since
= −1, the model to solve is
dw 1
= − w(t), 0 < t,
dt α
w(L) = 0.
9.1 The Separation of Variables Method 233
The general solution is w(t) = Ce− α t for any value of C. Choose C = 1 and we set
1
w0 (y) = e− α t .
1
Hence, the product φ0 (x, t) = u0 (x) w0 (t) solves the boundary conditions. That is
φ0 (x, t) = e− α t .
1
is a solution.
ω2
u + u=0
β2
u (0) = 0,
u (L) = 0.
and hence
ω ω ω ω
u (x) = −A sin x + B cos x
β β β β
u (0) = 0 = B
ω
u (L) = 0 = A sin L
β
Hence, B = 0 and A sin L ωβ = 0. Thus, we can determine a unique value of A
only if sin L ωβ = 0. If ω = nπβ
L
, we can solve for A and find A = 0, but otherwise,
A can’t be determined. So the only solutions are the trivial or zero solutions unless
ωL = nπβ. Letting ωn = nπβ L
, we find a non zero solution for each nonzero value of
A of the form
ωn nπ
un (x) = A cos x = A cos x .
β L
234 9 A Primer on Series Solutions
solve
dw (1 + ωn2 )
=− w(t), t ≥ 0.
dt α
The general solution is
1+ωn2 1+n2 π 2 β 2
w(t) = Bn e− α t
= Bn e− αL 2
t
n2 π 2 β 2
wn (t) = e− αL 2
t
will solve the model with the x boundary conditions and any finite sum of the form,
for arbitrary constants An
N
N
N (x, t) = An φn (x, t) = An un (x) wn (t)
n=1 n=1
N
nπ 1+n2 π 2 β 2
= An cos x e− αL2 t
n=1
L
Adding in the 1 + = 0 case, we find the most general finite term solution has the
form
N
N
N (x, t) = A0 φ0 (x, t) + An φn (x, t) = A0 u0 (x)w0 (t) + An un (x) wn (t)
n=1 n=1
N
nπ 1+n2 π 2 β 2
= A0 e− α t + x e− αL2 t .
1
An cos
n=1
L
∞
∞
(x, t) = A0 φ0 (x, t) + An φn (x, t) = A0 u0 (x)w0 (t) + An un (x) wn (t)
n=1 n=1
∞
nπ 1+n2 π 2 β 2
= A0 e− α t + x e− αL2 t .
1
An cos
n=1
L
This is the form that will let us solve the remaining boundary condition. These
solutions are written in what is called infinite series form we need to back up and
discuss carefully what we mean by letting N → ∞.
9.1.1.4 Homework
Exercise 9.1.1 Use separation of variables to find the general infinite series solution
to the cable equation with Dirichlet boundary data given below.
∂2 ∂
β2 −−α = 0, for 0 ≤ x ≤ L, t ≥ 0,
∂x 2 ∂t
(0, t) = 0,
(L, t) = 0,
(x, 0) = f (x).
In your earlier calculus courses, you learned about limits and convergence to a limit
in certain situations. For example, we know if a function f is continuous at the point
x0 in its domain, then we can say
which is short hand for saying the limit of f (x) as x approaches x0 exists and that the
value of the limit is f (x0 ). More precisely, we can use a different language to express
this: the − δ form. We would say the limit of f (x) as x approaches x0 exists if there
is a number A so that given any positive tolerance there is a positive radius δ so that
236 9 A Primer on Series Solutions
This seems like a hard statement to understand, but it simply says in very precise
language that as x gets close to x0 , the corresponding function values f (x) get close to
A also. There are all kinds of ways to make this statement seem even more forbidding.
For example, saying it the way we did above, assumes the function f is defined on
all the x values within δ of x0 . So we could adjust our statement to say
but usually, we know that this statement is dependent on x being in the domain of
f without saying and so we write the statement in the more relaxed form. Now, to
finish with the idea of continuity, we then have to assume the value of A is the same as
f (x0 ). If we restricted our attention to x values moving towards x0 only from the left,
we could call this the left hand limit as x goes to x0 and denote it by limx→x0− f (x).
Similarly, If we restricted our attention to x values moving towards x0 only from
the right, we could call this the right hand limit as x goes to x0 and denote it by
limx→x0+ f (x). If you think about it a bit, the limit only exists if and only if the two
one sided limits both exist and match the value A.
A couple of standard examples will help you understand this. Let the function f
be defined like this:
2
t , 0 ≤ t < 2,
f (t) =
−t 2 , 2 ≤ t ≤ 4
Then, it is easy to see limx→2− f (x) = 4 and limx→2+ f (x) = −4 and since the right
and left hand limits don’t match, f is not continuous at t = 2. If you graph this
function, you can see what this means visually: the graph of f has a jump at the point
t = 2. We can redefine f so that the right and left hand limits match but f is still not
continuous at t = 2 as follows. Let f be defined as
⎧ 2
⎨ t , 0 ≤ t < 2,
f (t) = 10, t = 2,
⎩ 2
t , 2 < t ≤ 4
This function f has both the right and left hand limits equal to 4, so the limit of f
as t approaches 2 does exist. However, the limit value 4 does not match the function
value f (2) = 10 and so this function is not continuous at t = 2. Of course, this lack
of continuity is there simply because we defined the function badly at t = 2. Since
this lack of continuity can easily be removed by just redefining f as
⎧ 2
⎨ t , 0 ≤ t < 2,
f (t) = 4, t = 2,
⎩ 2
t , 2 < t ≤ 4
9.2 Infinite Series 237
i.e., f (t) = t 2 on [0, 4], we call this a removeable discontinuity. A more sophisticated
example is the function g(t) = sin(t) t
which is undefined at t = 0. It is well-known
that the limit as t → 0 of g(t) is 1. Hence, we can define g so that is it continuous
for all t as follows:
sin(t)
, t = 0,
g(t) = t
1, t = 0.
In a similar way, if f has a derivative at x0 in its domain, it means that the limit of
the slopes of the lines through the pairs (x0 , f (x0 )) and (x, f (x)) exists and equals
some number B. More formally, we say f is differentiable at x0 if there is a number
B so that as x approaches x0 the slopes f (x)−f
x−x0
(x0 )
approach the value B. In our more
technical − δ language, if a positive tolerance is chosen, then there is a positive
δ so that
f (x)−f (x0 )
|x − x0 | < δ =⇒ x−x0
− B < .
The value B is usually denoted by the symbol f (x0 ) and the right and left hand
limits are then denoted by (f )+ (x0 ) and (f )− (x0 ), respectively. It is possible for the
derivative f to exist on an interval, but fail to be continuous at some point in the
interval. Consider this function f
⎧
⎨
t 2 sin 1
, t = 0,
f (t) = t
⎩
1, t=0
The function limt→0 f (t) = 0 and so we have removed the discontinuity f would
normally have at t = 0 by defining it to have that value at 0. Then f is continuous at
0 and we have for t = 0 that
1 1
f (t) = 2t sin − 2 cos .
t t
Then, we find
t 2 sin 1
t
−0
f (0) = lim
t
t→0
1
= lim t sin
t→0 t
238 9 A Primer on Series Solutions
Now make a change of variable and let y = 1/t. Then the above limit changes to
sin(y)
f (0) = lim
y→∞ y
which we clearly see is 0 as the numerator is bounded between −1 and 1 yet the
denominator grows without bound. Hence, f (0) exists and equals 0. However, the
limit as t approaches 0 from either direction gives
1 1
lim 2t sin − 2 cos
t→0 t t
which does not exist as the second term −2 cos 1
t
oscillates between −2 and 2 in
any circle (−r, r) around 0 no matter how small r is chosen. Hence, the limit can not
exist. Hence, since the limit does not exist, the definition of continuity for f fails.
We would need the limit to exist and for the value of the limit to match the value of
the function. So here, we have f exists for all t but f fails to be continuous at t = 0.
We see strange things can happen with functions!
9.2.2 Sequences
{c1 , c2 , c3 , . . .}
The numbers in this list do not have to have any pattern at all such as the sequence
of sine values using radians for the argument:
{c1 = 1, c2 = 2, c3 = 3, . . . , cn = n, . . .}
which can be written using the formula cn = n1 . As n grows without bound, i.e. as
n → ∞, we can see that cn → 0. Next, note the sequence
1 1
c1 = 2, c2 = 1 + , c3 = 1 + , . . .
2 3
Less precisely, this means that the difference between the numbers cn and the limiting
value A is arbitrarily small once n is large enough. Now, for a simple sequence of real
numbers, there are special types of lack of convergence which we call divergence.
The sequence (cn ) might never stop growing, the example is cn = n which moves
to ∞ as n → ∞; the sequence (cn ) has limit −∞, the example is cn = −n; and the
sequence oscillates between a finite number of fixed choices. One example of this is
cn = (−1)n which flips between −1 and 1 and so thereis no fixed number A it can
have as a limiting value. Another example is cn = sin nπ3
which moves between
the values {sin π3 , 0, sin 2π
3
} none of which can be the limiting value A.
If you add up positive numbers, it is common sense to realize the partial sums you
get never go down in value. Hence, if (an ) is some sequence of positive numbers,
then the partial sums sn = ni=1 ai are always going up in value. If we allow some of
the terms to be zero, then it is possible for these sums to plateau until a new positive
term is added in, so if we look at the partial sums of non negative terms, we would
say they are non decreasing to reflect the fact that the partial sums might plateau as
we said. The behavior of these partial sums is fairly easy to predict. The partial sums
240 9 A Primer on Series Solutions
either never stop growing or they grow towards some upper bound. Let’s look at the
growth towards an upper bound idea first. Take the open interval (0, 2). Notice that if
x is in (0, 2), x is always bounded above by 2. Further, it is easy to see that although
other numbers such as 3, 2.5, 2.1 and so forth are also upper bounds for this interval,
2 is the smallest or least such upper bound. We call such a least upper bound, the
supremum of this set. We can be more formal with these ideas but this is enough
for us here. For another example, consider the function tanh(x) which has the two
horizontal asymptotes −1 and 1. We know for any real number x, tanh(x) is always
above −1 and below 1. So the supremum of the set {tanh(x) : −∞ < x < ∞} is 1. A
little thought shows the number −1 is the greatest possible lower bound. We call such
a number the infimum of the set. Now, the big idea here is that a supremum is not the
same as a maximum. Look at the example of the interval (0, 2). The value 2 is not in
the interval, so we can’t say that there is a maximum value of x in this interval. We can
say that 2 is the supremum of the values of x from this interval though, even though
there is no maximum value. In the second example, 1 is the supremum of the set of
tanh(x) values but there is no value of x where tanh(x) = 1. Hence, the value of 1 can
not be achieved using any value of x. So again, it is true 1 is the supremum of the set
of possible values tanh(x) even though a maximum value is not achieved. Let’s look
at a third example using the function values −x 2 . The values {−x 2 : −∞ < x < ∞}
have a supremum value of 0 and this supremum value is achieved at the point 0;
hence, we know this set of values does have a maximum value.
Let’s be a bit more precise and prove a small result. Suppose (an ) is a sequence of
non negative terms and let (Sn ) be its corresponding sequence of partial sums. Since
the partial sums are always non decreasing in this case, we can see that the sequence
of partial sums either increases to ∞ or it has a finite supremum, S. If it increases
to ∞, we say the sequence of partial sums diverges to ∞. We can prove that if the
sequence of partial sums has a finite supremum S, the Sn → S is the formal way we
defined earlier.
To do that, pick a positive tolerance . Is it possible that every partial sum Sn lies
below or equals the supremum minus this tolerance, S − ? Suppose that was true.
Then, we would have the inequality Sn ≤ S − for n. But that would say that the
value S − was an upper bound also. However, when we defined the supremum of
a set of numbers, we noted that the supremum is the least such upper bound. So,
since S is the least upper bound value, we also have the inequality S ≤ S − ! But
this makes no sense as S can not be less than itself. So we must conclude that our
assumption is wrong. All the values Sn can’t be below or equal S − . There has to
be at least one value, Sn , so that we have the inequalities S − < Sn ≤ S.
Now we can show the partial sums of a sequence of non negative terms must
converge to its supremum value as long as the supremum is finite. Pick any positive
tolerance . By the argument above, there is at least one SN satisfying S− < SN ≤ S.
However, the partial sums are always non decreasing, so we can say more. Since
SN ≤ Sn for all n > N, we have S − < SN ≤ Sn ≤ S for all n > N. Now just
rearrange this a bit and we see
n > N =⇒ 0 ≤ S − Sn < .
9.2 Infinite Series 241
This is precisely how we defined the convergence of a sequence. We can say now
Sn = ni=1 an → S when the supremum S is finite. We use a special notation for this
limiting value S. We write S = ∞ i=n0 ai to denote the supremum or limiting value of
the sequence of partial sums when the underlying sequence is {an0 , an0 + 1, . . . , }.
This is called an infinite series of real numbers and this compact notation is very
useful. Another way of writing the convergence statement then is as
∞ n
n > N =⇒ 0 ≤ ai − ai < .
i=1 i=1
N
nπ
UN (x) = an sin x .
n=1
L
and
N
nπ
VN (x) = b0 + bn cos x .
n=1
L
and
are the partial sums formed from the sequences of cosine and sine numbers. However,
the underlying sequences can be negative, so these are not sequences of non negative
terms like we previously discussed. These sequences of partial sums may or may
not have a finite supremum value. Nevertheless, we still
represent the supremum
∞
using the same notation: i.e. the supremum of Ui (x0 ) and the supremum of
∞ i=1
Vi (x0 ) can be written as ∞ a
n=1 n sin nπ
L
x and b0 + ∞
b
n=1 n cos nπ
L
x .
i=0
Let’s consider the finite sequence
This sequence of real numbers converges to a possibly different number for each x0 ;
hence, let’s call this possible limit S(x0 ). Now the limit may not exist, of course. We
will write limn→ Un (x0 ) = S(x0 ) when the limit exists. If the limit does not exist for
some value of x0 , we will understand that the value S(x0 ) is not defined in some way.
Note, from our discussion above, this could mean the limiting value flips between
a finite set of possibilities, the limit approaches ∞ or the limit approaches −∞. In
any case, the value S(x0 ) is not defined as a finite value. We would say this precisely
as follows: given any positive tolerance , there is a positive integer N so that
n
n > N =⇒ ai sin iπ
L
− S(x0 ) < .
i=1
n
iπ
lim ai sin = S(x0 ).
n−>∞
i=1
L
As before, this symbol is called an infinite series and we see we get a potentially
different series at each point x0 . The error term S(x0 ) − Un (x0 ) is then written as
n ∞
iπ iπ
S(x0 ) − ai sin x0 = ai sin x0 ,
i=1
L i=n+1
L
which you must remember is just a short hand for this error. Now that we have an
infinite series notation defined, we note the term Un (x0 ), which is the sum of n terms,
9.2 Infinite Series 243
∞ iπ
is also called the nth partial sum of the series i=1 ai sin x
L 0
. Note we can define
the convergence at a point x0 for the partial sums of the cos functions in a similar
manner.
∞
iπ iπ
S(x) = b0 + an sin x + bn cos x
i=1
L L
for any numbers an and bn . Of course, there is no guarantee that this series will
converge at any x! If we start with a function f which is continuous on the interval
[0, L], we can define the trigonometric series associated with f as follows
1
S(x) = < f,1 >
L
∞
2 iπ iπ 2 iπ iπ
+ f (x), sin x sin x + f (x), cos x cos x .
L L L L L L
i=1
This series is called the Fourier Series for f and the coefficients in the Fourier series
for f are called the Fourier coefficients of f . Since these coefficients are based on
inner products with the normalized sin and cos functions, we could call these the
normalized Fourier coefficients. Let’s be clear about this and a bit more specific. The
nth Fourier sin coefficient, n ≥ 1, of f is as follows:
L
2 iπ
an (f ) = f (x) sin x dx
L 0 L
N
nπ 1+n2 π 2 β 2
− α1 t
A0 e + An cos x e− αL2 t .
n=1
L
are like Fourier series although in terms of two variables. We will show these series
converge pointwise for x in [0, L] and all t. We can show that we can take the partial
derivative of this series solutions term by term to obtain
N
nπ nπ 1+n2 π 2 β 2
−An sin x e− αL2 t .
n=1
L L
This series evaluated at x = 0 and x = L gives 0 and hence the Neumann conditions
are satisfied. Hence, the solution (x, t) given by
N
nπ 1+n2 π 2 β 2
(x, t) = A0 e − α1 t
+ An cos x e− αL2 t .
n=1
L
for the arbitrary sequence of constants (An ) is a well-behaved solution on our domain.
The remaining boundary condition is
and
∞
nπ
(x, 0) = A0 + An cos x .
n=1
L
with
1 L
B0 = f (x),
L 0
2 L nπ
Bn = f (x) cos x dx.
L 0 L
Then, setting these series equal, we find that the solution is given by An = Bn for all
n ≥ 0.
9.3.1 Homework
Solve the following cable models using separation of variables. Recall from Sect. 7.5.1
that we can calculate the Fourier series coefficients for a delta function of the form
Hδ(x − x0 ) easily to obtain
1 L 1
B0 = Hδ(x − x0 ) dx =
L 0 L
2 L iπ 2 iπ
Bn = Hδ(x − x0 ) sin x dx = sin x0 , n ≥ 1.
L 0 L L L
Exercise 9.3.1
∂2 ∂
0.0009 − − 0.006 = 0, for 0 ≤ x ≤ 10, t > 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
∂
(10, t) = 0,
∂x
(x, 0) = f (x).
where f (x) = 100δ(x − 3), the pulse of magnitude 100 applied instantaneously at
position x = 3.
Exercise 9.3.2
∂2 ∂
0.25 − − 0.0008 = 0, for 0 ≤ x ≤ 100, t > 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
246 9 A Primer on Series Solutions
∂
(100, t) = 0,
∂x
(x, 0) = f (x).
where f (x) = 200δ(x − 4), the pulse of magnitude 100 applied instantaneously at
position x = 4.
Exercise 9.3.3
∂2 ∂
0.25 − − 0.0008 = 0, for 0 ≤ x ≤ 100, t > 0,
∂x 2 ∂t
(0, t) = 0,
(10, t) = 0,
(x, 0) = f (x).
where f (x) = 300δ(x − 3), the pulse of magnitude 200 applied instantaneously at
position x = 3.5.
Exercise 9.3.4
∂2 ∂
0.125 − − 0.004 = 0, for 0 ≤ x ≤ 15, t > 0,
∂x 2 ∂t
(0, t) = 0,
(15, t) = 0,
(x, 0) = f (x).
where f (x) = 500δ(x − 8), the pulse of magnitude 300 applied instantaneously at
position x = 9.5.
Now our interest is the cable equation which we have derived using ideas from
biology and physics. For the cable equation, we think of the dendritic cylinder as
having end caps made of the same membrane as its walls. For boundary conditions,
we will impose what are called zero-rate end cap potentials–this means that each end
cap is at equipotential: hence the rate of change of the potential vm with respect to the
space variable λ is zero at both ends. Thus, we look the solution to the homogeneous
full transient cable equation
∂ 2 vm (z, t) ∂vm
λ2C = vm (z, t) + τM , 0 ≤ z ≤ , t ≥ 0, (9.5)
∂z2 ∂t
∂vm (0, t)
= 0, (9.6)
∂z
9.4 The Membrane Voltage Cable Equation 247
∂vm (, t)
= 0, (9.7)
∂z
vm (z, 0) = f (z), 0 ≤ z ≤ . (9.8)
This is the general cable equation with β = λC and α = τ . For convenience, we can
replace Eqs. 9.5–9.8 with a normalized form using the transformations
t z
τ = , λ= , L= ,
τM λC λC
v̂m = vm (λC λ, τM τ ).
∂ 2 v̂m ∂ v̂m
= v̂m + , 0 ≤ λ ≤ L, τ ≥ 0 (9.9)
∂λ2 ∂τ
∂ v̂m (0, τ )
=0 (9.10)
∂λ
∂ v̂m (L, τ )
= 0, (9.11)
∂λ
v̂m (λ, 0) = fˆ (z), 0 ≤ λ ≤ L. (9.12)
where fˆ = f (λC λ). This is the general cable equation with β = 1 and α = 1. As
usual, we assume a solution of the form v̂m (λ, τ ) = u(λ) w(τ ). We have already
solved this in Sect. 7.2.1 so we can just state the results now. The solution is
∞
nπ 1+n2 π 2
v̂m (λ, τ ) = A0 e −τ
+ An cos λ e− L2 τ .
n=1
L
for the arbitrary sequence of constants (An ). The constants An are then chosen to be
the Fourier coefficients of fˆ . The Fourier series for f is given by
∞
nπ
f (x) = B0 + Bn cos x
n=1
L
with
1 L
B0 = f (x)dx,
L 0
2 L nπ
Bn = f (x) cos x dx.
L 0 L
The solution is given by choosing An = Bn for all n ≥ 0. We now need to look at the
convergence of Fourier series as our solutions require it to make sense!
248 9 A Primer on Series Solutions
To prove that Fourier series converge pointwise for the kind of data functions f we
want to use, requires a lot more work. So let’s get started. Let’s go back and look at
the sin and cos functions we have been using. They have many special properties.
[0,
We will now look at some common sequences of functions on the domain L] that
are very useful in solving models: the sequences of functions are sin iπL x for
integers i ≥ 1 and cos iπL x for integers i ≥ 0. The second sequence is often
written {1, cos πL x , cos 2π
L
x , . . .}. Here L is a positive number which often is
the length of a cable or spatial boundary.
Let’s look carefully at the interval [0, L]. Using the definition of inner product on
C[0, L], by direct integration, we find for i = j
L
iπ jπ iπ jπ
sin x , sin x = sin x sin x dx
L L 0 L L
πx
Now use the substitution, y = L
to rewrite this as
iπ jπ L π
sin x , sin x = sin(iy) sin(jy)dy
L L π 0
imply
1
sin(iy) sin(jy) = cos((i − j)y) − cos((i + j)y) .
2
9.5 Fourier Series Components 249
L
, i=j
< ui , uj > = 2
0, i = j.
j
Now define the new functions ûn by L2 un . Then, < ûi , ûj >= δi and the sequence
of functions (ûn ) are all mutually orthogonal. Next, define the length of a function f
by the symbol ||f || where
L
||f || = f 2 (t)dt.
0
Let’s look carefully at on the interval [0, L]. Using the definition of inner product on
C[0, L], by direct integration, we find for i = j with both i and j at least 1, that
L
iπ jπ iπ jπ
cos x , cos x = cos x cos x dx
L L 0 L L
πx
Again use the substitution, y = L
to rewrite this as
iπ jπ L π
cos x , cos x = cos(iy) cos(jy)dy
L L π 0
imply
1
cos(iy) cos(jy) = cos((i + j)y) + cos((i − j)y) .
2
L
jπ jπ
1, cos x = cos x dx
L 0 L
π
L
= cos(jy)dy
π 0
9.5 Fourier Series Components 251
π
L sin(jy)
=
π j 0
= 0.
jπ
Thus, the functions 1 and cos L
x for any j ≥ 1 are also orthogonal. On the other
hand, if i = j, we have for i ≥ 1,
π
iπ iπ L
cos x , cos x = cos(iy) cos(iy)dy
L L π 0
π
L 1 + cos(2iy)
= dy
π 0 2
v0 (x) = 1
nπ
vn (x) = cos x , n ≥ 1,
L
n
n
0≤<f − < f , ûi > ûi , f − < f , ûj > ûj >
i=1 j=1
n
n
n
= < f , f > −2 (< f , ûi >)2 + < f , ûi >< f , ûj > < ûi , ûj >
i=1 i=1 j=1
n
n
= < f , f > −2 (< f , ûi >)2 + (< f , ûi >)2
i=1 i=1
n
= < f,f > − (< f , ûi >)2 ,
i=1
j
where we use the fact that the < ûi , ûj >= δi . Hence, we conclude that for
n
i=1 (< f , ûi >) ≤ ||f ||2 . A similar argument shows that for all n,
2
all n,
n
i=0 (< f , v̂i >) ≤ ||f || . The numbers < f , ûi > and < f , v̂i > are called
2 2
the ith Fourier sine and ith Fourier cosine coefficients of f , respectively. Note this
is similar to the Fourier coefficients defined earlier but we are writing them in terms
of the normalized sin and cos functions. In fact, in the context of the sums, they are
the same; i.e.
2 2 2
< f , ûi > ûi = f , ui ui = < f , ui > ui
L L L
is the same term in both summations. We can do a similar expansion for the cos
functions. So depending on where you read about these things, you could see them
defined either way. Thus, we can rewrite the finite sums here in terms of the original
sin and cos functions. We have
n n
2 iπ iπ
< f , ûi > ûi = f (x), sin x sin x
i=1 i=1
L L L
9.5 Fourier Series Components 253
and
n n
1 2 iπ iπ
< f , v̂i > v̂i = < f (x), 1 > 1 f (x), cos x cos x .
i=0
L i=1
L L L
We will now show the nth Fourier sine and cosine coefficients must go to zero. From
the previous section, we know that ni=1 | < f , ûi > |2 ≤ ||f ||2 and ni=0 | <
f , v̂i > |2 ≤ ||f ||2 which tells us that the series ∞i=1 | < f , ûi > | ≤ ||f || and
2 2
∞
i=0 | < f , v̂i > | ≤ ||f || . Hence, since these series of non negative terms are
2 2
bounded above, they must converge. Pick any positive tolerance . Let’s focus on the
sin series first.
Since this series converges to say SS, there is a positive integer N so that n >
N =⇒ |Sn − SS| < 2 , where Sn is the usual partial sum. Thus, we can say for any
n > N + 1, we have
From the definition of partial sums, we know Sn − Sn−1 = (< f , ûn >)2 . Hence, we
know n > N =⇒ (< f , ûn >)2 < . But this implies limn→∞ < f , ûn >= 0 which
is the result we wanted to show. It is clear this is the same as
2 L nπ
lim f (x) sin x = 0.
n→∞ L 0 L
254 9 A Primer on Series Solutions
Now, a similar argument will show that limn→∞ < f , v̂n >= 0 or equivalently
L
2 nπ
lim f (x) cos x = 0.
n→∞ L 0 L
The Fourier series associated to the continuous function f on [0, L] is the series
1
S(x) = < f,1 >
L
∞
2 iπ iπ 2 iπ iπ
+ f (x), sin x sin x + f (x), cos x cos x .
i=1
L L L L L L
We will sneak up on the analysis of this series by looking instead at the Fourier
series of f on the interval [0, 2L]. The sin and cos functions we have discussed
were labeled un and vn respectively.
in Sects. 9.5.1.1 and 9.5.1.2 On the interval
[0, L], their lengths were L2 for each un and vn for n ≥ 1 and L1 for v0 . We used
these lengths to define the normalized functions ûn and v̂n which formed mutually
orthogonal sequences. On the interval [0, 2L] the situation is virtually the same. The
only difference is that on [0, 2L], we still have
nπ
un (x) = sin x ,n ≥ 1
L
v0 (x) = 1
nπ
vn (x) = cos x ,n ≥ 1
L
but now, although we still have orthogonality, the lengths change. We find
L, i = j
< ui , uj > =
0, i = j.
⎧ 1
⎨ 2L , i = j = 1,
< vi , vj > = L, i = j, i ≥ 1
⎩
0, i = j.
The argument given in Sect. 9.5.1.4 still holds with just obvious changes. So these
Fourier coefficients go to zero as n → ∞ also. This series on [0, 2L] does not
necessarily converge to the value f (x) at each point in [0, 2L]; in fact, it is known
that there are continuous functions whose Fourier series does not converge at all. Still,
the functions of greatest interest to us are typically functions that have continuous
derivatives except at a finite number of points and for those sorts of functions, S(x)
and f (x) usually match. We are going to prove this in the work below. Consider the
difference between a typical partial sum SN (x) and our possible target f (x).
1
|SN (x) − f (x)| = < f,1 >
2L
N
1 iπ iπ
+ f (x), sin x sin x
i=1
L L L
1 iπ iπ
+ f (x), cos x cos x − f (x)
L L L
L
1
= f (t) dt
2L 0
N
1 2L iπ iπ
+ f (t) sin t sin x
i=1
L 0 L L
iπ iπ
+ cos t cos x dt − f (x)
L L
Now, sin(u) sin(v) + cos(u) cos(v) = cos(u − v) and hence we can rewrite the above
as follows:
2L N
1 1 2L iπ
|SN (x) − f (x)| = f (t) dt + f (t) cos (t − x) dt − f (x)
2L 0 i=1
L 0 L
1
N
1 2L iπ
= f (t) + cos (t − x) dt − f (x)
L 0 2 i=1
L
256 9 A Primer on Series Solutions
and so
N
1 iπ π
+ cos (t − x) sin (t − x)
2 L 2L
i=1
N
1 π 1 π 1 π
= sin (t − x) + sin i + (t − x) − sin i − (t − x)
2 2L 2 L 2 L
i=1
1 π 1 3π 1 π
= sin (t − x) + sin (t − x) − sin (t − x)
2 2L 2 2L 2 2L
1 5π 1 3π
+ sin (t − x) − sin (t − x)
2 2L 2 2L
1 7π 1 5π
+ sin (t − x) − sin (t − x)
2 2L 2 2L
...
1 (2N + 1)π 1 (2N − 1)π
+ sin (t − x) − sin (t − x)
2 2L 2 2L
1 1 π
= sin N + (t − x)
2 2 L
We have found
π
1
sin N+ 1
(t
− x)
1
N 2 2 L
iπ
+ cos (t − x) = (9.13)
2 L π
i=1 sin 2L (t − x)
Note the argument t − x is immaterial and for any y, the identity can also be written
as
1 π
1
sin N + 2 L y
1
N 2
iπ
+ cos y = (9.14)
2 L π
i=1 sin 2L y
9.6 The Convergence of Fourier Series 257
Now, we use this to rewrite SN (x). We can then use this identity to find
1 2L 1
sin N + 21 πL (t − x)
SN (x) = f (t) 2
π dt
L 0 sin 2L (t − x)
Now, switch the integration variable y back to t to obtain the form we want:
1
1 2L−x sin N + 21 πL t
SN (x) = f (t + x) 2
π dt.
L −x sin 2L t
We can rewrite this even more. All of the individual sin terms are periodic over the
interval [0, 2L]. We extend the function f to be periodic also by defining
and defining what happens at the endpoints 0, ±2L, ±4L and so on using one sided
limits. Since the original f is continuous on [0, 2L], we know f (0+ ) and f (2L − ) both
exists and match f (0) and f (2L), respectively. Because these two values need not
be the same, the periodic extension will always have a potential discontinuity at the
point 2nL for all integers n. We will define the periodic extension at these points as
which has a discontinuity at L, then the periodic extension will have discontinuities
at each multiple 2nL as fˆ (2L − ) = 0, f (0+ ) = H and f (2nL) is the average value.
2L−x 2L
However, the value of the integral −x and 0 are still the same. Hence, SN (x)
can be written as
1
1 2L ˆ sin N + 21 πL t
SN (x) = f (t + x) 2
π dt.
L 0 sin 2L t
258 9 A Primer on Series Solutions
9.6.2 Rewriting SN − F
It would be nice if we could pull the f (x) at the end of this expression into the integral
sign. This is how we can do that. Consider
1
2L 1
N
iπ
1 1
N
L
iπ
2L
+ cos (t) dt = t+ sin (t)
L 0 2 L L 2 iπ L 0
i=1 i=1
N
1 L iπ iπ
= L+ sin (2L) − sin (0) .
L iπ L L
i=1
= 1.
f (x) = f (x) × 1
1 2L 1
N
iπ
= + cos (t) f (x) dt
L 0 2 i=1
L
f (x) = f (x) × 1
1 2L 21 sin N + 21 πL t
= π f (x) dt
L 0 sin 2L t
Using the periodic extension fˆ , the equation above is still valid. Hence, SN (x)−f (x) =
SN (x) − fˆ (x) and we find
9.6.3 Convergence
It is straightforward to shown that the sequence of functions wN (x) = sin N +
1 π
2 L
t are mutually orthogonal with length L. Hence, the functions ŵN (x) =
1
w (x) have length one and are orthogonal. Hence, we already know that if H is
L N
continuous on [0, 2L], then the Fourier coefficients < H, ŵN >→ 0 using arguments
just like we did in Sect. 9.5.1.4. For our purposes, we will only look at two kinds of
functions f : the first is differentiable at x and the second has f has right and left sided
derivatives at x.
9.6.3.1 f Is Differentiable
On the interval [0, 2L], we can see that H(t) is continuous at every point except
possible t = 0. At t = 0, continuity of H comes down to whether or not H has a
removeable discontinuity at 0. First, note
fˆ (t + x) − fˆ (x)
lim H(t) = lim = f (x)
t→0 t→ t
260 9 A Primer on Series Solutions
Now we assume f is differentiable to the left of x and to the right of f . This would
include the case where f has a jump discontinuity at x as well as the case where
f has a corner there. Hence (f (x))+ and (f (x))− exist and are finite numbers. We
can handle this case by going back to our estimates and replacing f (x) by the new
function 21 (f (x + ) + f (x − )) where f (x + ) is the right hand value and f (x − ) is the left
hand value of the jump, respectively. Then, note
L
1
N N L
1 iπ 1 1 L iπ
+ cos (t) dt = t+ sin (t)
L 0 2 L L 2 iπ L 0
i=1 i=1
1 L L
N
iπ iπ
= + sin (L) − sin (0) .
L 2 iπ L L
i=1
1
= .
2
and
1
2L 1
N
iπ
1 1
N
L
iπ
2L
+ cos (t) dt = t+ sin (t)
L L 2 L L 2 iπ L L
i=1 i=1
N
1 L L iπ iπ
= + sin (2L) − sin (L) .
L 2 iπ L L
i=1
1
= .
2
and
1
f (x − ) = 2f (x − ) ×
2
2L
1
N
2 iπ
= + cos (t) f (x + ) dt
LL 2 i=1
L
2L 1
2 sin N + 21 πL t
= 2
π
f (x − )dt
L L sin 2L t
Combining, we obtain
L 1
1 π
1 1 ˆf (t + x) − fˆ (x + ) 2 sin N + 2 L t
|SN (x) − (f (x + ) + f (x − ))| ≤ π dt
2 L 0 sin 2L t
1
1 π
1 2L ˆ 2 sin N + 2 L t
+ f (t + x) − fˆ (x − ) π dt .
L L sin 2L t
Using the triangle inequality and using the same overestimates as before, we find the
series will converge as long as
L ˆ
1 f (t + x) − fˆ (x + ) 1 π
lim sin N+ t dt = 0,
t→0+ 2L 0 t 2 L
and
L ˆ
1 f (t + x) − fˆ (x + ) 1 π
lim sin N + t dt = 0,
t→(2L)− 2L 0 t 2 L
The integrand in the first estimate is continuous on [0, L] if the integrand has a
removeable discontinuity at t = 0. This is true as when t → 0+ , the limiting value is
(f (x))+ . Hence, using the arguments of Sect. 9.5.1.4, these terms go to 0 in the limit
262 9 A Primer on Series Solutions
Let f be defined only on the interval [0, L]. Extend f to be an odd function fo on
[0, 2L] as follows:
f (x), 0 ≤ x ≤ L,
fo (x) =
−f (2L − x), L < x ≤ 2L.
Then extend fo periodically as usual to fˆo . The Fourier coefficient for the sin terms
are then
2L
1 iπ 1 L iπ 1 2L iπ
fo (t) sin t dt = f (t) sin t dt + (−f (2L − t)) sin t dt.
L 0 L L 0 L L L L
But iπ
L
(2L − y) = 2iπ − iπ
L
y and since sin term 2π periodic, we have
L
1 iπ 1 0 iπ
(−f (y)) sin (2L − y) dy = (−f (y)) sin (−y) (−dy)
L 0 L L L L
1 L iπ
= f (y) sin (y) dy.
L 0 L
The terms corresponding to the cos parts will all then be zero. The argument is
straightforward.
2L
1 iπ 1 L iπ 1 2L iπ
fo (t) cos t dt = f (t) cos t dt + (−f (2L − t)) cos t dt.
L 0 L L 0 L L L L
9.7 Fourier Sine Series 263
which is the negative of the first integral. So all of these coefficients are zero. The
2L
last one is 0 fo (t)dt = 0 because f0 is odd on this interval. Thus, all the cos based
terms in the Fourier series vanish. The Fourier series on the interval [0, 2L] of the
odd extension fo becomes the standard Fourier sine series on the interval [0, L] of
the function f .
∞
∞
2 iπ iπ
< f , ûi > ûi = f (x), sin x sin x .
i=1 i=1
L L L
We know now from Sect. 9.6.3 this converges to f (x) at each point x where f is
differentiable and converges to the average 21 (f (x + ) + f (x − )) at each point x where
f has one sided finite derivatives. Note because the sin functions are always 0 at the
endpoints 0 and L, this series must converge to 0 at those points.
Let f be defined only on the interval [0, L]. Extend f to be an even function fe on
[0, 2L] as follows:
f (x), 0 ≤ x ≤ L,
fe (x) =
f (2L − x), L < x ≤ 2L.
Then extend fe periodically as usual to fˆe . The Fourier coefficient for the sin terms
are now
2L
1 iπ 1 L iπ 1 2L iπ
fe (t) sin t dt = f (t) sin t dt + f (2L − t) sin t dt.
L 0 L L 0 L L L L
264 9 A Primer on Series Solutions
However, sin is an odd function and thus the second integral is the negative of the
first and these coefficients vanish. Next, consider the first Fourier cos coefficient.
This is
2L L
1 1 1 2L
fe (t)dt = f (t)dt + f (2L − t)dt
2L 0 2L 0 L L
L 0
1 1 1 L
= f (t)dt + f (y)(−dy) = f (t)dt.
2L 0 L L L 0
This is the same as the first integral. Thus, the Fourier series on the interval [0, 2L]
of the even extension fe becomes the standard Fourier cosine series on the interval
[0, L] of the function f
∞
∞
1 2 iπ iπ
< f , v̂i > v̂i = < f (x), 1 > + f (x), cos x cos x .
i=0
L i=1
L L L
We know from Sect. 9.6.3 this series converges to f (x) at each point x where f is
differentiable and converges to the average 21 (f (x + ) + f (x − )) at each point x where
f has one sided finite derivatives.
9.9 MatLab Implementation 265
We will need to approximate Fourier series expansions for arbitrary functions f when
we solve the cable equation. All of these approximations require that we find inner
products of the form < f , un > for some function un which is a sin or cos term.
In Chap. 2, we discussed Newton–Cotes methods for integration and in Sect. 2.5,
we went over the Graham-Schmidt Orthogonalization method that takes linearly
independent vectors/functions {f1 , . . . , fN } and outputs orthogonal linearly indepen-
dent vectors of length one, {g1 , . . . , gN }. A standard test to see if our numerical
inner product calculations are sufficiently accurate is to compute the N × N matrix
d = (< gi , gj >) which should be the essentially the N × N identify matrix as the
off diagonal entries should all be zero. However, if the inner product computations
are inaccurate, off diagonal values need not be zero and the GSO method will fail.
So we begin with a search for a better inner product.
The errors we get when we use the Newton-Cotes formulae can be unacceptable.
Hence, we will handle our inner product calculations using a Riemann sum approx-
imation to the needed integral. This is not very sophisticated, but it works well and
is easy to program. The function innerproduct to do this is shown below. This
b
code approximates a f (t)g(t)dt using a Riemann sum with N terms formed from a
uniform partition based on the subinterval length b−a
N
. This performs well in practice
for us.
d e l x = ( b−a ) /N;
x = l i n s p a c e ( a , b ,N+1) ;
c = 0;
f o r i =1:N
c = c+ h ( x ( i ) ) ∗ d e l x ;
end
end
We can check how accurate we are with these inner product calculation by using
them to do a Graham-Schmidt orthogonalization on the functions 1, t, t 2 , . . . , t N on
the interval [a, b]. The code to do this is in the function GrahamSchmidtTwo.
This function returns the new orthogonal of length one functions gi and also prints
out the matrix with terms < gi , gj > which should be an identity. The input NIP is
266 9 A Primer on Series Solutions
the number of terms to use in the Riemann sum approximations to the inner product
and N is size of the number of functions we perform GSO on.
10 n f = s q r t ( i n n e r p r o d u c t ( f { 1 } , f { 1 } , a , b , NIP ) ) ;
g {1} = @( x ) f {1}( x ) / n f ;
d = z e r o s (N+1 ,N+1) ;
f o r k =2:N+1
%compute n e x t o r t h o g o n a l p i e c e
15 p h i = @( x ) 0 ;
f o r j = 1 : k−1
c = i n n e r p r o d u c t ( f {k } , g{ j } , a , b , NIP ) ;
p h i = @( x ) ( p h i ( x )+c ∗g{ j } ( x ) ) ;
end
20 p s i = @( x ) ( f {k } ( x ) − p h i ( x ) ) ;
n f = s q r t ( i n n e r p r o d u c t ( p s i , p s i , a , b , NIP ) ) ;
g{k} = @( x ) ( p s i ( x ) / n f ) ;
end
25 f o r i =1:N+1
f o r j =1:N+1
d ( i , j ) = i n n e r p r o d u c t ( g{ i } , g{ j } , a , b , NIP ) ;
end
end
30 d
end
This computes the GSO of the functions 1, t, t 2 on the interval [0, 2] using Riemann
sum approximations with 5000 points. The matrix < gi , gj > which is calculated is
This is the 3×3 identify that we expect. Next, we do GSO on the functions 1, t, . . . , t 6 .
9.9 MatLab Implementation 267
This also generates the identity matrix we expect for < gi , gj >.
To compute the first N terms of the Fourier Cosine series of afunction f on the
interval [0, L], we first need a way to encode all the functions cos L x . We do this
nπ
π
This generates handles to the functions 1, cos L x , cos 2π
L
x and so forth ending
with cos Nπ
L
x . A similar function encodes the corresponding sin functions we need
for the first N terms of a Fourier Sine series. The function is called SetUpSines
with code
and
Then, we can check the accuracy of the inner product calculations by computing the
matrix d = (< fi , fj >). We do this with the new function CheckOrtho. We input
the function f and interval [a, b] endpoints a and b and the number of terms to use
in the Riemann sum approximation of the inner product, NIP.
f o r i =1:N
10 f o r j =1:N
d ( i , j ) = i n n e r p r o d u c t ( f { i } , f { j } , a , b , NIP ) ;
end
end
d
15 end
9.9 MatLab Implementation 269
Let’s try it with the cos functions. We use a small number of terms for the Riemann
sums, NIP = 50 and compute < gi , gj > for the first 7 functions.
We do not get the identity matrix as we expect some of the off diagonal values are
too large.
3 1 . 0 e+00 2 . 8 e −02 −5.5 e −17 2 . 8 e −02 −1.2 e −16 2 . 8 e −02 −4.5 e −17
2 . 8 e −02
2 . 8 e −02 1 . 0 e+00 4 . 0 e −02 −1.2 e −16 4 . 0 e −02 4 . 8 e −17 4 . 0 e −02
1 . 1 e −16
−5.5 e −17 4 . 0 e −02 1 . 0 e+00 4 . 0 e −02 −6.2 e −17 4 . 0 e −02 −2.0 e −16
4 . 0 e −02
2 . 8 e −02 −1.2 e −16 4 . 0 e −02 1 . 0 e+00 4 . 0 e −02 −5.5 e −17 4 . 0 e −02
−6.9 e −18
−1.1 e −16 4 . 0 e −02 −6.2 e −17 4 . 0 e −02 1 . 0 e+00 4 . 0 e −02 −9.7 e −17
4 . 0 e −02
8 2 . 8 e −02 4 . 8 e −17 4 . 0 e −02 −5.5 e −17 4 . 0 e −02 1 . 0 e+00 4 . 0 e −02
2 . 8 e −17
−4.5 e −17 4 . 0 e −02 −2.0 e −16 4 . 0 e −02 −9.7 e −17 4 . 0 e −02 1 . 0 e+00
4 . 0 e −02
2 . 8 e −02 1 . 1 e −16 4 . 0 e −02 −6.9 e −18 4 . 0 e −02 2 . 8 e −17 4 . 0 e −02
1 . 0 e+00
1 . 0 e+00 7 . 1 e −03 −6.1 e −17 7 . 1 e −03 −7.1 e −17 7 . 1 e −03 −3.9 e −17
7 . 1 e −03
7 . 1 e −03 1 . 0 e+00 1 . 0 e −02 −5.5 e −17 1 . 0 e −02 −1.1 e −16 1 . 0 e −02
−3.8 e −17
5 6 . 1 e −17 1 . 0 e −02 1 . 0 e+00 1 . 0 e −02 −7.8 e −17 1 . 0 e −02 −1.6 e −16
1 . 0 e −02
7 . 1 e −03 −5.5 e −17 1 . 0 e −02 1 . 0 e+00 1 . 0 e −02 −2.7 e −16 1 . 0 e −02
−3.3 e −17
7 . 1 e −17 1 . 0 e −02 −7.8 e −17 1 . 0 e −02 1 . 0 e+00 1 . 0 e −02 −1.0 e −16
1 . 0 e −02
7 . 1 e −03 −1.2 e −16 1 . 0 e −02 −2.6 e −16 1 . 0 e −02 1 . 0 e+00 1 . 0 e −02
2 . 1 e −17
3 . 9 e −17 1 . 0 e −02 −1.6 e −16 1 . 0 e −02 −1.0 e −16 1 . 0 e −02 1 . 0 e+00
1 . 0 e −02
10 7 . 1 e −03 −3.8 e −17 1 . 0 e −02 −3.3 e −17 1 . 0 e −02 2 . 1 e −17 1 . 0 e −02
1 . 0 e+00
270 9 A Primer on Series Solutions
9.9.1.1 Homework
Exercise 9.9.1 Find the GSO of the functions f1 (t) = t 2 , f2 (t) = cos(2t) and f3 (t) =
4t 3 on the interval [−1, 2] using the implementations given in this section for various
values of NIP. Check to see the matrix d is the diagonal.
Exercise 9.9.2 Find the GSO of the functions f1 (t) = 1, f2 (t) = t and f3 (t) = t 2
on the interval [−1, 1] using the implementations given in this section for various
values of NIP. Check to see the matrix d is the diagonal.
Exercise 9.9.3 Find the GSO of the functions f1 (t) = 1, f2 (t) = t and f3 (t) = t 2
on the interval [−1, 4] using the implementations given in this section for various
values of NIP. Check to see the matrix d is the diagonal.
We can then calculate the first N + 1 terms of a Fourier series or the first N
terms of a Fourier Sine series using the functions FourierCosineApprox and
FourierSineApprox, respectively. Let’s look at the Fourier Cosine approxima-
tion first. This function returns a handle to the function p which is the approximation
N
p(x) = < f , gi > gi (x)
n=0
where gi (x) = cos iπ
L
x . It also returns the Fourier cosine coefficients A1 = 1
L
<
f , g0 > through AN+1 = L2 < f , gN >. We must choose how many points to use in
our Riemann sum inner product estimates – this is the input variable N. The other
inputs are the function handle f and the length L. We also plot our approximation
and the original function together so we can see how we did.
9.9 MatLab Implementation 271
% g e t t h e f i r s t N+1 F o u r i e r c o s a p p r o x i m a t i o n s
10 g = S e t U p C o s i n e s ( L ,N) ;
% g e t Fourier Cosine C o e f f i c i e n t s
A = z e r o s (N+1 ,1) ;
A( 1 ) = i n n e r p r o d u c t ( f , g { 1 } , 0 , L ,M) /L ;
15 f o r i =2:N+1
A( i ) = 2∗ i n n e r p r o d u c t ( f , g{ i } , 0 , L ,M) /L ;
end
% g e t Nth F o u r i e r C o s i n e A p p r o x i m a t i o n
20 p = @( x ) 0 ;
f o r i =1:N+1
p = @( x ) ( p ( x ) + A( i ) ∗g{ i } ( x ) ) ;
end
25 x = linspace (0 ,L,101) ;
f o r i =1:101
y( i ) = f (x( i ) ) ;
end
yp = p ( x ) ;
30
figure
s = [ ’ Fourier Cosine A p p r o x i m a t i o n with ’ , i n t 2 s t r (N+1) , ’ term ( s ) ’ ] ;
p l o t ( x , y , x , yp ) ;
x l a b e l ( ’x axis ’ ) ;
35 y l a b e l ( ’y axis ’ ) ;
title (s) ;
end
We will test our approximations on two standard functions: the sawtooth curve
and the square wave. To define these functions, we will use an auxiliary function
splitfunc which defines a new function z on the interval [0, L] as follows
f (x) 0 ≤ x < L2 ,
z(x) =
g(x) L2 ≤ x ≤ L
The arguments to splitfunc are the functions f and g, the value of x for we wish
to find the output z and the value of L.
It is easy then to define a sawtooth and a square wave with the following code. The
square wave, Sq has value H on [0, L2 ) and value 0 on [ L2 , L]. In general, the sawtooth
curve, Saw, is the straight line connecting the point (0, 0) to ( L2 , H) on the interval
[0, L2 ] and the line connecting ( L2 , H) to (L, 0) on the interval ( L2 , L). Thus,
H 0 ≤ x < L2 ,
Sq(x) =
0 L2 ≤ x ≤ L
and
2
Hx 0 ≤ x < L2 ,
Saw(x) = L
2H − L Hx L2 ≤ x ≤ L
2
20 end
9.9.2.1 Homework
Exercise 9.9.4 Write the functions needed to generate a periodic square wave on
the intervals [0, L] ∪ [L, 2L] ∪ [2L, 3L] ∪ . . . ∪ [N − 1)L, NL] of height H. Generate
the need graphs also.
Exercise 9.9.5 Write the functions needed to generate a periodic square wave on
the intervals [0, L] ∪ [L, 2L] ∪ [2L, 3L] ∪ . . . ∪ [N − 1)L, NL] with the high and low
value reversed; i.e., the square wave is 0 on the front part and H on the back part of
each chunk of length L. Generate the need graphs also.
Exercise 9.9.6 Write the functions needed to generate a periodic sawtooth wave on
the intervals [0, L] ∪ [L, 2L] ∪ [2L, 3L] ∪ . . . ∪ [N − 1)L, NL]. Generate the need
graphs also.
Exercise 9.9.7 Write the functions needed to generate a periodic sawtooth - square
wave on multiple intervals of length [0, 2L] where the first [0, L] is the sawtooth and
the second [L, 2L] is the square. Generate the need graphs also.
We can then test the Fourier Cosine Approximation code. This code generates the
plot you see in Fig. 9.1.
We can then do the same thing and approximate the square wave with the command
274 9 A Primer on Series Solutions
Fig. 9.1 Six term Fourier cosine series approximation to a sawtooth: NIP = 100
Listing 9.20: The Fourier cosine approximation to a square wave with 6 terms
[ Acos , p c o s ] = F o u r i e r C o s i n e A p p r o x ( Sq , 1 0 , 1 0 0 , 5 ) ;
Note these approximations are done using only 100 terms in the Riemann sum approx-
imations to the inner product. This generates the relatively poor approximation shown
in Fig. 9.2.
We do better if we increase the number of terms to 11.
Fig. 9.2 Six term Fourier cosine series approximation to a square wave: NIP = 100
9.9 MatLab Implementation 275
Fig. 9.3 Eleven term Fourier cosine series approximation to a square wave: NIP = 100
Listing 9.21: Fourier cosine approximation to the square wave with 11 terms
[ Acos , p c o s ] = F o u r i e r C o s i n e A p p r o x ( Sq , 1 0 , 1 0 0 , 1 0 ) ;
This generates the improvement we see in Fig. 9.3. The code for FourierSine-
Approx is next. It is quite similar to the cosine approximation code and so we will
say little about it. It returns the Fourier sine coefficients as A with A1 = L2 < f , g1 >
through AN = L < f , gN > where gi (x) = sin iπL x . It also returns the handle to
2
N
p(x) = < f , gi ) > gi (x).
n=1
% g e t Fourier Sine C o e f f i c i e n t s
A = z e r o s (N, 1 ) ;
f o r i =1:N
15 A( i ) = 2∗ i n n e r p r o d u c t ( f , g{ i } , 0 , L ,M) /L ;
end
% g e t Nth F o u r i e r S i n e A p p r o x i m a t i o n
p = @( x ) 0 ;
20 f o r i =1:N
p = @( x ) ( p ( x ) + A( i ) ∗g{ i } ( x ) ) ;
end
x = linspace (0 ,L,101) ;
25 f o r i =1:101
y( i ) = f (x( i ) ) ;
end
yp = p ( x ) ;
30 figure
s = [ ’ Fourier Sine A p p r o x i m a t i o n with ’ , i n t 2 s t r (N) , ’ term ( s ) ’ ] ;
p l o t ( x , y , x , yp ) ;
x l a b e l ( ’x axis ’ ) ;
y l a b e l ( ’y axis ’ ) ;
35 title (s) ;
p r i n t −dpng ’ F o u r i e r S i n e A p p r o x . png ’ ;
end
Let’s test the approximation code on the square wave. using 22 terms. The sin approx-
imations are not going to like the starting value at 10 as you can see in Fig. 9.4. The
approximation is generated with the command
We could do similar experiments with the sawtooth function. Note, we are not using
many terms in the inner product calculations. If we boost the number of terms, NIP,
to 500, we would obtain potentially better approximations. We will leave that up to
you.
9.9.3.1 Homework
Exercise 9.9.8 Generate the Fourier Cosine Approximation with varying number
of terms and different values of NIP for the periodic square wave. Draw figures as
needed.
Exercise 9.9.9 Generate the Fourier Sine Approximation with varying number of
terms and different values of NIP for the periodic square wave. Draw figures as
needed.
Exercise 9.9.10 Generate the Fourier Cosine Approximation with varying number
of terms and different values of NIP for the periodic sawtooth wave. Draw figures
as needed.
9.9 MatLab Implementation 277
Fig. 9.4 Twenty two term Fourier sine series approximation to a square wave: NIP = 100
Exercise 9.9.11 Generate the Fourier Sine Approximation with varying number of
terms and different values of NIP for the periodic sawtooth wave. Draw figures as
needed.
Exercise 9.9.12 Generate the Fourier Cosine Approximation with varying number
of terms and different values of NIP for the periodic sawtooth-square wave. Draw
figures as needed.
Exercise 9.9.13 Generate the Fourier Sine Approximation with varying number of
terms and different values of NIP for the periodic sawtooth-square wave. Draw
figures as needed.
Exercise 9.9.14 Generate the Fourier Sine Approximation with varying number of
terms and different values of NIP for pulses applied at various locations. Draw
figures as needed.
Exercise 9.9.15 Generate the Fourier Cosine Approximation with varying number
of terms and different values of NIP for pulses applied at various locations. Draw
figures as needed.
We can use our code to approximate Fourier cosine and sine series to approximate
the separation of variables solution to the cable equation with Neumann conditions.
Recall the cable model is
278 9 A Primer on Series Solutions
∂2 ∂
β2 −−α = 0, for 0 ≤ x ≤ L, t ≥ 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
∂
(L, t) = 0,
∂x
(x, 0) = f (x).
with solution
∞
∞
(x, t) = A0 φ0 (x, t) + An φn (x, t) = A0 u0 (x)w0 (t) + An un (x) wn (t)
n=1 n=1
N
nπ 1+n2 π 2 β 2
= A0 e − α1 t
+ An cos x e− αL2 t .
n=1
L
We can now write code to find an approximation to this infinite series solution. The
function will be called CableNeumannApprox as we have Neumann boundary
conditions here. We can’t solve the problem over infinite time, so we will develop
the approximation for a fixed time interval [0, T ] for some positive T . We need to
input the values of α and β, the data function f, the number of terms to use in our
Riemann sum approximations to inner products, M, and finally, the number of terms
of the infinite series to use, N. The full definition of the function is then
We then get the Fourier Cosine approximations we need and setup the inline functions
as usual which store the various cos functions we need in a cell data structure.
4 % Get C os i ne F u n c t i o n s
u = S e t U p C o s i n e s ( L ,N) ;
9.9 MatLab Implementation 279
end
% Get C o s i n e F u n c t i o n s
u = S e t U p C o s i n e s ( L ,N) ;
30 % Get t h e e x p o n e n t i a l f u n c t i o n s
v = c e l l (N+1 ,1) ;
v{1} = @( t ) exp (− t / a l p h a ) ;
f o r i = 2 :N+1
c = ( 1 + i ˆ2∗ p i ˆ2∗ b e t a ˆ 2 ) / ( a l p h a ∗L ˆ 2 ) ;
35 v{ i } = @( t ) exp (− c ∗ t ) ;
end
45 %
% draw s u r f a c e f o r g r i d [ 0 , L ] x [ 0 , T ]
% s e t up x and y s t u f f
x = linspace (0 ,L,101) ;
t i m e = l i n s p a c e ( 0 , T, 1 0 1 ) ;
50 % s e t up g r i d o f x and y p a i r s ( x ( i ) , t ( j ) )
[ X, Time ] = m e s h g r i d ( x , t i m e ) ;
% s e t up s u r f a c e
Z = p (X, Time ) ;
55 %p l o t s u r f a c e
figure
mesh (X, Time , Z , ’ EdgeColor ’ , ’ black ’ ) ;
x l a b e l ( ’x axis ’ ) ;
y l a b e l ( ’t axis ’ ) ;
60 z l a b e l ( ’ Cable Solution ’ ) ;
t i t l e ( ’ Cable Dirichlet Solution on Rectangle ’ ) ;
p r i n t −dpng ’ C a b l e D i r i c h l e t . png ’ ;
end
9.9 MatLab Implementation 281
It is interesting to look at solutions to various pulses that are applied on the cable.
A rectangular pulse centered at x0 of width r and height H on the interval [0, L] has
the form
⎧
⎨ 0, 0 ≤ x ≤ x0 − r,
J(x) = H, x0 − r < x < x0 + r,
⎩
0, x0 + r ≤ x ≤ L
It is easy to approximate the solution to the cable equation with a data pulse of height
100 at location 1 of width 0.2. We’ll use 200 terms in our Riemann sum inner product
approximations, α = 0.5 and β = 0.025. Hence, we are using 20 terms here.
9.9.4.1 Homework
Exercise 9.9.16 Approximate the solution to the cable equation with Neumann data
on [0, 6] × [0, T ] for an appropriate value of T for α = 0.3 and β = 0.8 for a variety
of pulses applied to the cable at time 0.
Exercise 9.9.17 Approximate the solution to the cable equation with Neumann data
on [0, 4] × [0, T ] for an appropriate value of T for α = 1.3 and β = 0.08 for a
variety of pulses applied to the cable at time 0.
Exercise 9.9.18 Approximate the solution to the cable equation with Neumann data
on [0, 10] × [0, T ] for an appropriate value of T for α = 0.03 and β = 0.04 for a
variety of pulses applied to the cable at time 0.
282 9 A Primer on Series Solutions
Fig. 9.5 Twenty term Fourier series approximation to the cable equation with pulse data and
Neumann boundary conditions
∂2 ∂
β2 −−α = 0, for 0 ≤ x ≤ L, t ≥ 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
∂
(L, t) = 0,
∂x
9.10 Convergence Analysis for the Cable Equation 283
(x, 0) = f (x)
where since the Fourier series for the boundary data function f is given by
∞
nπ
f (x) = B0 + Bn cos x
n=1
L
we have
1 L
B0 = f (x),
L 0
L
2 nπ
Bn = f (x) cos x dx.
L 0 L
We have found this series solution by essentially assuming all of our series manip-
ulations are justified. We also assume the data function f does have a Fourier series
expansion. However, we haven’t shown the series solution actually satisfies the cable
equation and we haven’t been clear about the properties the data function f should
have to make this work. So in this chapter, we are going to work our way through
the material we need to answer these questions carefully. Now be warned, there is a
lot of reasoning in here. Many of you might prefer to just do the manipulations and
call it a day, but we assure you that your understanding of what you are doing and
your ability to create and solve models will be enhanced by this next journey. So roll
up your sleeves and let’s get started!
So far we have talked about series of functions that converge pointwise to another
function. A stronger type of convergence is called uniform convergence and a
weaker one is called least squares or L 2 convergence. Let’s state the definition
of pointwise convergence more precisely.
U(t) = limn→∞ un (t). In more precise terms, given a positive , there is a positive
integer N (depending on t and ) so that
Example 9.10.1 The sequence un (t) = t n on the interval [0, 1], converges pointwise
to
0 0≤t<1
U(t) =
1 t = 1.
Example 9.10.2 The series built from the sequence un (t) = t n on the interval
(−1, 1), has the partial sums Sn (t) = 1 + t + t 2 + . . . + t n . A well know identity
n+1
tells us that Sn (t) = 1−t
1−t
. Hence, it is easy to show that Sn converges pointwise to
S(t) = 1−t on (−1, 1).
1
Let {un } be a sequence of functions defined on the interval [a, b] and let {Sn } be the
usual sequence of partial sums that this sequence determines. We say Sn converges
uniformly to the function S on [a, b] if given a positive , there is a positive integer
N (depending on only) so that
ptws
Comment 9.10.1 We often denote these convergences as Sn −→S (pointwise),
unif L 2
Sn −→S (uniform) and Sn −→S (Least Squares),
Proof Let > 0 be given. Then since un converges uniformly to U on [a, b], there
is a positive integer N so that
n > N =⇒ |un (t) − U(t)| < , for all t ∈ [a, b].
3
Pick any two points t and consider for another s the difference U(t) − U(s). We see
2
|U(t) − U(s)| < + |un (s) − un (s)|.
3
To finish the argument, note we can fix n to be any integer larger than N and this
inequality holds. For this n, since un is continuous, there is a δ > 0 so that |un (s) −
un (t)| < 3 when |t − s| < δ. Using this we have
286 9 A Primer on Series Solutions
Note that uniform and least squares convergence gives us a way to decide how
many terms we want to use so that we are close to the limit function S in some way
on the entire interval [a, b] but pointwise convergence does not let us get that sort of
information. Hence, it would be nice if we could understand when our Fourier series
do more than converge pointwise.
1
S(x) = < f,1 >
L
∞
2 iπ iπ 2 iπ iπ
+ f (x), sin x sin x + f (x), cos x cos x .
i=1
L L L L L L
and using b0 = 1
L
< f , 1 >, bn = 2
L
f (x), cos iπ
L
x and an = 2
L
f (x), sin iπ
L
x
as usual, we can write
∞
iπ iπ
S(x) = b0 + ai sin x + bi cos x .
i=1
L L
Now if we assume f exists in [0, 2L], we know the Fourier series of f converges to
f pointwise at each point and we have
∞
iπ iπ
f (x) = b0 + ai sin x + bi cos x .
i=1
L L
n
iπ iπ
0 ≤ < f − b0 − ai sin x + bi cos x ,
i=1
L L
n
iπ jπ
f − b0 − aj sin x + bj cos x >
j=1
L L
As usual, we let ui (x) = sin iπ
L
x and vi (x) = cos iπ
L
x with v0 (x) = 1. Then, we
can rewrite this as
n
n
0 ≤ < f − b0 v0 (x) − (ai ui (x) + bi vi ), f − b0 v0 (x) − (aj uj (x) + bj vj (x)) >
i=1 j=1
n
0 ≤ ||f − b0 v0 (x) − (ai ui (x) + bi vi (x))||2 =< f , f > −2b0 < f , v0 > +b02 < v0 , v0 >
i=1
n
n
n
n
−2 ai < f , ui > −2 bi < f , vi > + ai2 < ui , ui > + bi2 < vi , vi >
i=1 i=0 i=1 i=1
j j
because all the cross terms such as < v0 , ui >= 0, < v0 , vi >= δ0 < ui , uj >= δi
j
and < vi , vj >= δi . Hence, since < f , vi >= bi and < f , ui >= ai we have
n
n
n
0 ≤ ||f − b0 v0 (x) − (ai ui (x) + bi vi )||2 = < f , f > −b02 − ai2 − bi2
i=1 i=1 i=1
We conclude that
n
b02 + (ai2 + bi2 ) ≤ ||f ||2
i=1
∞
This tells us that the series of positive terms, b02 + i=1 (ai
2
+ bi2 ) converges.
x where f (x) is continuous. However, we can calculate the Fourier series without
those assumptions. Let the Fourier series of f be T (x). Then
1
T (x) = < f , 1 >
2L
∞
1 iπ iπ 1 iπ iπ
+ f (x), sin x sin x + f (x), cos x cos x .
L L L L L L
i=1
1 1
< f , 1 > = (f (2L) − f (0)) = 0
2L 2L
1 iπ 1 iπ iπ
f (x), cos x = f (2L) − f (0) + ai = ai
L L L L L
1 iπ iπ
f (x), sin x = − bi
L L L
9.10 Convergence Analysis for the Cable Equation 289
∞
πi iπ πi iπ
T (x) = − bi sin x + ai cos x .
i=1
L L L L
This is the same result we would have found if we differentiated the Fourier series
for f term by term. So we conclude that the Fourier series of f can be found be
differentiating the Fourier series for f term by term.
We can apply the derivation we did above for f to the series expansion for f we have
just found. We find
n
b̂02 + (âi2 + b̂i2 ) ≤ ||f ||2
i=1
π2 2 2
n
i (ai + bi2 ) ≤ ||f ||2
L 2 i=1
We are almost at the point where we can see circumstances where the Fourier series
expansion of f converges uniformly to f on the interval [0, 2L]. We need a few more
technical tools. From earlier calculus courses, we know what the Cauchy–Schwartz
inequality is for vectors in 2 . If the vectors X and Y had components [a1 , a2 ] and
[b1 , b2 ] , respectively, we have
2 2
2
|ai ||bi | ≤ 2
ai bi2
i=1 i=1 i=1
where we have written the dot product and the vector lengths in summation notation.
We suspect we can prove this result for vectors in n and also for Riemann integrable
functions. Here is the result for sequences.
Theorem 9.10.2 (Cauchy–Schwartz Inequalites)
If X and Y in n have components [a1 , . . . , an ] and [b1 , . . . , bn ] , respectively, we
have
290 9 A Primer on Series Solutions
N N
N
|ai ||bi | ≤ 2
ai bi2
i=1 i=1 i=1
∞ ∞
Further, if the series i=1 ai2 and i=1 bi2 both converge, we can say
∞ ∞ ∞
|ai ||bi | ≤ ai2 bi2
i=1 i=1 i=1
Proof These statements are fairly easy to prove. We know that for any two numbers
α and β that (|α| − |β|)2 ≥ 0. Hence, we can say
1 2 1 2
|α||β| ≤ α + β .
2 2
N
Now let’sconsider two vectors
X and Y in with components labeled as usual.
N N
Let u = i=1 ai and v =
2
i=1 bi . Now if α = u and β = v , we see for any
2 ai bi
index i, we have
ai bi 1 1
| || | ≤ 2 ai2 + 2 bi2 .
u v 2u 2v
Now sum this inequality over all the components to get
1 1 2 1 2
N N N
|ai ||bi | ≤ 2 ai + 2 b .
uv i=1 2u i=1 2v i=1 i
N N
But since u = i=1 ai2 and v = i=1 bi2 , this becomes
1
N
1 1
|ai ||bi | ≤ 2 u2 + 2 v 2 = 1
uv i=1 2u 2v
∞ ∞
where now we let u = a
i=1 i
2
and v = i=1 bi2 . The partial sums are less the
the sum of the series in each case, so we have
∞ ∞
N
|ai ||bi | ≤ uv = ai2 bi2 .
i=1 i=1 i=1
∞
of nonnegative terms i=1 |ai ||bi | are
But this says the partial sumsof the series
∞ 2 ∞ 2
bounded above by the bound i=1 ai i=1 bi . Hence the supremum on these
partial sums which is the sum of this series also satisfies this bound. We conclude
∞ ∞ ∞
|ai ||bi | ≤ uv = 2
ai bi2 .
i=1 i=1 i=1
Proof Again, this statements is fairly easy to prove. We know that for any two
numbers α and β that
1 2 1 2
|α||β| ≤ α + β .
2 2
b
Now if f and g are continuous on the interval [a, b], we let u = f 2 (x)dx and
a
b 2 |f (x)| |g(x)|
v= a g (x)dx. Then, letting α = u and β = v , we have
|f (x)| |g(x)| 1 1
≤ 2 f 2 (x) 2 g 2 (x).
u v 2u 2v
or
uv 2 uv
|f (x)| |g(x)| ≤ f (x) 2 g 2 (x).
2u2 2v
292 9 A Primer on Series Solutions
We also need some tests to determine if our Fourier series converge uniformly.
Theorem 9.10.4 (Tests for Uniform Convergence)
Assume we have a sequence of functions (fi ) on the interval [a, b].
1. If there is a sequence of constants (Ki ) so that ∞ i=1 Ki converges and |fi (x)| ≤ Ki
on [a, b] for each index i, then ∞ i=1 f i (x) converges uniformly to a limit function
S(x) on [a, b].
2. Assume the series ∞ i=1 fi (x) converges pointwise to S(x) on [a, b]. Further,
assume there is a sequence of constants (Ki ) so that ∞ 2
i=1 Ki converges. Then if
m
2
m > n =⇒ |Sm (x) − Sn (x)| ≤ Ki
i=n+1
∞
then i=1 fi (x) converges uniformly to a limit function S(x) on [a, b].
Proof There are two separate arguments here.
1. Since we always know
∞
∞
fi (x) ≤ Ki ,
i=1 i=1
we know the series converges pointwise at each x in [a, b]. Let the sum of this
series be the function S(x). Consider the difference of two partial sums, Sn (x) and
Sm (x) where m > n. Then, we have
m
|Sm (x) − Sn (x)| = fi (x)
i=n+1
m
≤ |fi (x)|
i=n+1
m
≤ Ki ,
i=n+1
9.10 Convergence Analysis for the Cable Equation 293
Since we know the series ∞ i=1 Ki converges to some value K, given a positive
tolerance we know there is a positive integer N so that
n
1
n > N =⇒ K − Ki < .
i=1
4
m
m
n
Ki = Ki − Ki
i=n+1 i=1 i=1
n
m
= K− Ki − K − Ki
i=1 i=1
1 1 1
< + = .
4 4 2
Thus, going back to our original inequality for |Sm (x) − Sn (x), we see there is a
positive integer N so that if m and n exceed N, we have for all x in [a, b], that
m
|Sm (x) − Sn (x)| = fi (x)
i=n+1
m
≤ |fi (x)|
i=n+1
m
≤ Ki
i=n+1
1
<
2
Since this is true for all m > N, take the limit on m on both sides. Since all the terms
here are continuous, we can say limm |Sm (x) − Sn (x)| = | limm Sm (x) − Sn (x)|.
But we know limm Sm (x) = S(x) and so we can say for all x that
1
≤ <
2
But this says Sn converges uniformly to S on [a, b].
294 9 A Primer on Series Solutions
2. In the second case, we assume the series converges pointwise to S. We know that
m
2
m > n =⇒ |Sm (x) − Sn (x)| ≤ Ki .
i=n+1
n
2
m > n =⇒ Ki2 <
i=n+1
4
Combining, we see
n
2
m > n =⇒ |Sm (x) − Sn (x)| ≤ Ki <
i=n+1
2
Now let’s get back to the question of the uniform convergence of the Fourier series
for f . We assume f is continuous and periodic on [0, 2L] and that f exists at all but
finitely many points. Hence, we know the Fourier series of f exists and converges to
f (x). From our earlier arguments, if f has Fourier series
∞
iπ iπ
f (x) = b0 + ai sin x + bi cos x .
i=1
L L
π2 2 2
n
i (ai + bi2 ) ≤ ||f ||2 .
L 2 i=1
n n n n
iπ iπ iπ iπ
b0 1 + (ai sin x + (bi cos x = (ai sin x + (bi cos x
L L L L
i=1 i=1 i=1 i=0
n n
1 iπ 1 iπ
= (i ai sin x + (i bi cos x .
i L i L
i=1 i=0
Let Tn denote the nth partial sum here. Then, the difference of the nth and mth partial
sum for m > n gives
m m
1 iπ 1 iπ
Tm (x) − Tn (x) = (i ai sin x + (i bi cos x .
i=n1
i L i=n+1
i L
m m
1 iπ 1 iπ
Tm (x) − Tn (x) ≤ (i |ai | sin x + (i bi cos x
i=n+1
i L i=n+1
i L
m m 2
1 iπ
≤ i2 |ai |2 sin x
i=n+1 i=n+1
i2 L
m m 2
1 iπ
+ i2 |bi |2 cos x
i=n+1 i=n+1
i2 L
m m m m
1 1
≤ i2 |ai |2 + i 2 |b |2
i
i=n+1 i=n+1
i2 i=n+1 i=n+1
i2
Hence,
m
m
iπ m
iπ 2L||f || 1
Tm (x) − Tn (x) ≤ (ai sin x + (bi cos x ≤ .
i=n+1
L i=n+1
L π i=n+1
i2
We can then apply Theorem 9.10.4 to conclude the Fourier series of f converges
uniformly to f under these circumstances! Let’s summarize this result.
296 9 A Primer on Series Solutions
The arguments above also apply to the Fourier sin and Fourier cosine series we have
discussed. In those cases, we have a function f defined only on [0, L]. If we extend
f as an odd function periodically to [0, 2L], the Fourier series for this extension is
given by
∞
iπ
Ai sin x
i=1
L
where
L
2 iπ
Ai = f (x) sin x dx.
L 0 L
where
1 L
B0 = f (x)dx
L 0
2 L iπ
Bi = f (x) cos x dx.
L 0 L
From our previous discussions about uniform convergence, we know that is f (0) −
f (2L) and f exists on [0, 2L] with at most a finite number of points where f does
not exist but the right and left hand derivatives do, then the Fourier series for f on
[0, 2L] converges uniformly to f . For the odd extension to f to [0, 2L], if we require
f be continuous on [0, L], then since at x = 0 and x = L, the Fourier sine series
gives
9.10 Convergence Analysis for the Cable Equation 297
∞
iπ
Ai sin 0 =0
i=1
L
∞
iπ
Ai sin L =0
i=1
L
we see f (0) = f (L) = 0. Hence, f satisfies the periodic requirement that f (0) = f (L).
Hence, we suspect that the derived series
∞
iπ iπ
Ai cos x
i=1
L L
is actually the same as f . Let’s check this out by direct calculation. We have (remem-
ber the inner products here are on the interval [0, L] now)
n n
iπ iπ jπ jπ
f − Ai cos x ,< f − Aj cos x
i=1
L L j=1
L L
n
iπ iπ
= < f , f > −2 Ai f , cos x
i=1
L L
n n
iπ jπ iπ jπ
+ Ai Aj cos x , cos x
i=1 j=1
L L L L
n
iπ iπ
= −2 Ai f , cos x
i=1
L L
i2 π 2
n
iπ iπ
+ A2
cos x , cos x .
i=1
L2 i L L
Thus,
n
n n
iπ iπ jπ jπ i2 π 2 2
f − Ai cos x ,< f − Aj cos x = −2 A
i=1
L L j=1
L L i=1
2L i
n
i2 π 2 L
+ A2i
i=1
L2 2
n 2 2
i π 2
=− A .
i=1
2L i
n
i2 π 2
A2i ≤ ||f ||2 .
i=1
2L
For the even extension to f to [0, 2L], we will require that f (x) be continuous at
x = 0 and x = L. Hence, we must have the Fourier cosine series gives
∞
∞
iπ
B0 + Bi cos 0 = B0 + Bi = f (0)
i=1
L i=1
∞ ∞
iπ
B0 + Bi cos L = B0 + Bi (−1)n = f (L).
i=1
L i=1
n
iπ iπ
=< f , f > +2 Bi f , sin x
i=1
L L
n n
iπ jπ iπ jπ
+ Ai Aj sin x , sin x
i=1 j=1
L L L L
n
iπ iπ
=2 Ai f , sin x
i=1
L L
i2 π 2
n
iπ iπ
+ 2
A sin x , sin x .
i=1
L2 i L L
Thus,
n n n
iπ iπ jπ jπ i2 π 2 2
f + Bi cos x ,< f + Bj cos x = −2 B
i=1
L L j=1
L L i=1
2L i
n
i2 π 2 L
+ Bi2
i=1
L2 2
n 2 2
i π 2
=− B .
i=1
2L i
n
i2 π 2
Bi2 ≤ ||f ||2 .
i=1
2L
300 9 A Primer on Series Solutions
∂2 ∂
β2 −−α = 0, for 0 ≤ x ≤ L, t ≥ 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
∂
(L, t) = 0,
∂x
(x, 0) = f (x).
where since the Fourier series for the boundary data function f is given by
∞
nπ
f (x) = B0 + Bn cos x
n=1
L
we have
1 L
B0 = f (x),
L 0
L
2 nπ
Bn = f (x) cos x dx.
L 0 L
Proof The arguments to show these results are valid are straightforward.
• For convenience, let’s assume n0 = 1 and c = 1. Our arguments will not change
much if these constants are different from those values. Pick a positive integer
N. Let PN be the partition of the interval [1, N] into pieces of length 1. Then the
Riemann sum for evaluation points which are chosen to be the right hand endpoints
of each of the subintervals created by the partition underestimates the area under
the curve y = t12 on the interval [1, N]. We have
N N
1 1 1
2
× 1 < 2
dt = 1 − ≤ 1.
i=2
i 1 t N
N N
−i
e ×1< e−t dt = 1 − e−N ≤ 1.
i=2 0
N N
ie−i × 1 < te−t dt.
i=2 0
N
The integral 0 te−t dt can be integrated by parts to show its value is always
bounded by a constant C. Hence, this series is always bounded by C and so it
must converge.
• We assume the usual partition PN . The function n2 e−n has a maximum at n = 2
and after that it decays to 0. So from n = 2 on, it is a decreasing function. Then the
Riemann sum for evaluation points which are chosen to be the right hand endpoints
of each of the subintervals created by the partition underestimates the area under
the curve y = te−t on the interval [1, N]. We have
N N
i2 e−i × 1 < t 2 e−t dt.
i=2 0
302 9 A Primer on Series Solutions
N
The integral 0 t 2 e−t dt can also be integrated by parts to show its value is always
bounded by a constant D. Hence, this series is always bounded by D and so it must
converge.
Comment 9.10.2 We can also show that series of the form n e−n , n ne−n , and
2 2
2 −n2
nn e etc. converge although it is easier to use a test we have not discussed
called the Ratio Test to do this.
n
n x
n
fi (x) = fi (a) + fi (t) dt
i=1 i=1 a i=1
Since we assume ni=1 fi (t) converges uniformly to v(t) on [a, b], for a given > 0,
there is a positive integer N so that
n
n > N =⇒ v(t) − fi (t) < .
i=1
2(b − a)
x n
x
So we can conclude that a i=1 fi (t) dt converges to a v(t)dt for all x. Letting
n go to infinity, we therefore have
9.10 Convergence Analysis for the Cable Equation 303
n n x n
x
fi (x) = fi (a) + fi (t) dt =⇒ S(x) = S(a) + a v(t)dt
i=1 i=1 a i=1
Applying the Fundamental Theorem of Calculus, we see S (x) = v(x) for all x.
Before we get our hands dirty with the ugly details, let’s set all the parameters here
to the value of 1 to make life easier. Hence, we have L = 1, α = 1 and π β = 1. The
solution is then
∞
(x, t) = B0 e−t + Bn cos(nπx) e−(1+n )t .
2
n=1
e−(1+n )t
≤ e−n t .
2 2
Using Theorem 9.10.6, we note the series on the right hand side converges. We can
then apply Theorem 9.10.4 to see the series on the left hand side converges uniformly
to (x, t) on the interval [0, 1] as long as t > 0. Since each of the individual functions
in the series on the left hand side is continuous and convergence is uniform, we can
use Theorem 9.10.1 to see the limit function for the left hand side series is continuous
304 9 A Primer on Series Solutions
on [0, 1] for each t > 0. Hence, the function (x, t) is continuous on the domain
[0, 1] × [t, ∞) for any positive t. At t = 0, the series for (x, t) becomes
∞
B0 + Bn cos(nπx).
n=1
which is the Fourier cosine series for f on [0, 1]. Now from our previous work with
the Fourier cosine series, we know this series converges uniformly to f (x) as long
as f is continuous on [0, 1] with a derivative that exists for all but a finite number of
points. Hence, we see
∞
lim |(x, t) = lim B0 e−t + Bn cos(nπx) e−(1+n )t
2
t→0 t→0
n=1
= f (x) = (x, 0).
So we know (x, t) is continuous on [0, L] × [0, ∞). Now let’s look at the partial
derivatives. If we take the partial derivative with respect to t of the series for (x, t)
term by term, we find the function Dt (x, t) given by
∞
Dt (x, t) = −B0 e−t − Bn (1 + n2 ) cos(nπx) e−(1+n )t
2
n=1
Applying Theorem 9.10.6, we see the series on the right hand side converges for any
t > 0. Then, using Theorem 9.10.4, we see the series for Dt (x, t) converges uniformly.
Since it is built from continuous functions, we know limit function is continuous for
t > 0 because the convergence is uniform. Finally, applying Theorem 9.10.7, we see
the series for ∂
∂t
is the same as the series Dt (x, t) we found by differentiating term
by term. The formal partial derivatives of the cable series solution with respect to x
are then
∞
Bn nπ sin(nπx) e−(1+n )t
2
Dx (x, t) = −
n=1
∞
Bn n2 π 2 cos(nπx) e−(1+n )t
2
Dxx (x, t) = −
n=1
Now we can estimate the Bn coefficients as usual with the constant C as before.
Hence, |Bn | ≤ C for all n ≥ 0. Also, again, we have
9.10 Convergence Analysis for the Cable Equation 305
e−(1+n )t
≤ e−n t .
2 2
The series for the two partial derivatives with respect to x satisfies
∞
∞
|Bn |nπ| sin(nπx)| e−(1+n )t
Cnπ e−n
2 2
≤ t
n=1 n=1
and
∞
∞
|Bn |n2 π 2 | sin(nπx)| e−(1+n )t
Cn2 π 2 e−n
2 2
≤ t
n=1 n=1
Applying Theorem 9.10.6, we see both of the series on the right hand side converge
for any t > 0. Then, using Theorem 9.10.4, we see the series for Dx (x, t) and Dxx (x, t)
converge uniformly. Since these series are built from continuous functions, we then
know the limit function is continuous for t > 0 since the convergence is uniform.
Finally, applying Theorem 9.10.7, we see the series for ∂ ∂x
is the same as the series
Dx (x, t) we find by differentiating term by term. Further, the series for ∂∂x2 is the
2
same as the series Dxx (x, t) we also find by differentiating term by term. Hence, on
[0, 1] × (0, ∞) we can compute
∞ ∞
∂2 ∂
Bn n2 π 2 cos(nπx) e−(1+n )t − B0 e−t − Bn cos(nπx) e−(1+n )t
2 2
−− =−
∂x 2 ∂t
n=1 n=1
∞
+ B0 e−t + Bn (1 + n2 π 2 ) cos(nπx) e−(1+n
2 )t
n=1
= 0.
So that we see our series solution satisfies the partial differential equation. To check
the boundary conditions, because of continuity, we can see
∞
∂ −(1+n2 )t
(0, t) = − Bn nπ sin(nπx) e =0
∂x n=1 x=0
∞
∂
Bn nπ sin(nπx) e−(1+n )t
2
(1, t) = − = 0.
∂x n=1 x=1
(x, 0) = f (x).
Note, we can show that higher order partial derivatives of are also continuous even
though we have only limited smoothness in the data function f . Hence, the solutions
of the cable equation smooth irregularities in the data.
306 9 A Primer on Series Solutions
Now we can estimate the Bn coefficients as before by the same constant C. Hence,
|Bn | ≤ C for all n ≥ 0. Further, we now have
L 2 +n2 π 2 β 2 n2 π 2 β 2
e− αL 2
t
≤ e− αL 2
t
.
Using Theorem 9.10.6, we note the series on the right hand side converges. We can
then apply Theorem 9.10.4 to see the series on the left hand side converges uniformly
to (x, t) on the interval [0, L] as long as t > 0. Since each of the individual functions
in the series on the left hand side is continuous and convergence is uniform, we can
use Theorem 9.10.1 to see the limit function for the left hand side series is continuous
on [0, L] for each t > 0. Hence, the function (x, t) is continuous on the domain
[0, L] × [t, ∞) for any positive t. At t = 0, the series for (x, t) becomes
∞
nπ
B0 + Bn cos x .
n=1
L
which is the Fourier cosine series for f on [0, L]. Now from our previous work with
the Fourier cosine series, we know this series converges uniformly to f (x) as long
as f is continuous on [0, L] with a derivative that exists for all but a finite number of
points. Hence, we see
∞
− α1 t nπ 2 2 2 2
− L +nαL2π β t
lim |(x, t) = lim B0 e + Bn cos x e
t→0 t→0
n=1
L
= f (x) = (x, 0).
So we know (x, t) is continuous on [0, L] × [0, ∞). Now let’s look at the partial
derivatives. If we take the partial derivative with respect to x of the series for (x, t)
term by term, we find the function Dt (x, t) given by
9.10 Convergence Analysis for the Cable Equation 307
∞
1 − 1 t L 2 + n2 π 2 β 2 nπ L 2 +n2 π 2 β 2
Dt (x, t) = −B0 e α − Bn cos x e− αL2 t
α n=1
αL 2 L
Applying Theorem 9.10.6, we again see the series on the right hand side converges
for any t > 0. Then, using Theorem 9.10.4, we see the series for D1 (x, t) con-
verges uniformly. Since it is built from continuous functions, we know limit func-
tion is continuous for t > 0 because the convergence is uniform. Finally, applying
Theorem 9.10.7, we see the series for ∂∂t
is the same as the series Dt (x, t) we found
by differentiating term by term.
The formal partial derivatives of the cable series solution with respect to x are
analyzed in a similar manner. We have
∞
nπ nπ L 2 +n2 π 2 β 2
Dx (x, t) = − sin
Bn x e− αL2 t
n=1
L L
∞
n2 π 2 nπ L 2 +n2 π 2 β 2
Dxx (x, t) = − Bn 2 cos x e− αL2 t
n=1
L L
Now we can estimate the Bn coefficients by C and the exponential term again as
L 2 +n2 π 2 β 2 n2 π 2 β 2
e− αL 2
t
≤ e− αL 2
t
.
Then series terms for the two partial derivatives with respect to x satisfy
∞
∞
nπ nπ L 2 +n2 π 2 β 2 nπ − n2 π22β2 t
|Bn | sin x e− αL2 t ≤ C e αL
n=1
L L n=1
L
and
∞
∞
n2 π 2 nπ 2 2 2 2
− L +nαL2π β t nπ − n2 π22β2 t
|Bn | 2 cos x e ≤ C e αL .
n=1
L L n=1
L
Applying Theorems 9.10.4 and 9.10.6, we see the series for Dx (x, t) and Dxx (x, t)
converge uniformly for t > 0. Since these series are built from continuous functions,
we then know the limit function is continuous for t > 0 Since the convergence is
uniform, these limit functions are also continuous. Finally, applying Theorem 9.10.7,
we see the series for ∂ and the series for ∂∂x2 are the same as the series Dx (x, t) and
2
∂x
308 9 A Primer on Series Solutions
Dxx (x, t) that we find by differentiating term by term. It is then an easy calculation
to see that the series solution satisfies the cable equation with the given boundary
conditions.
Comment 9.10.3 The arguments we presented in this chapter are quite similar to
the ones we would use to analyze the smoothness qualities of the solutions to other
linear partial differential equations with boundary conditions. We didn’t want to go
through all of them in this text as we don’t think there is a lot of value in repeating
these arguments over and over. Just remember that to get solutions with this kind of
smoothness requires that the series we formally compute converge uniformly. If we
did not have that information, our series solutions would not have this amount of
smoothness. But that is another story!
Reference
J. Peterson, in Calculus for Cognitive Scientists: Higher Order Models and Their Analysis. Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd., Singapore, 2015 in press)
Chapter 10
Linear Partial Differential Equations
∂2 ∂2
− c2 2 =0
∂t 2 ∂x
(x, 0) = f (x), for 0 ≤ x ≤ L
∂
(x, 0) = g(x), for 0 ≤ x ≤ L
∂t
(0, t) = 0, for 0 ≤ t
(L, t) = 0, for 0 ≤ t
for some positive constant c. The solution of this equation approximates the motion
of a nice string with no external forces applied. The domain here is the infinite
rectangle [0, L] × [0, ∞).
Laplace’s Equation: The solution (x, y) of this equation is a time independent
solution to a problem such as the distribution of heat on a membrane stretch over
the domain given that various heat sources are applied to the boundary. Here, the
domain is the finite square [0, L]×[0, L]. In the problem below, three of the edges
of the square are clamped to 0 and the remaining one must follow the heat profile
given by the function f (x).
∂2 ∂2
+ =0
∂x 2 ∂y2
∂
(0, y) = 0, for 0 ≤ y ≤ L
∂x
∂
(L, y) = 0, for 0 ≤ y ≤ L
∂x
(x, L) = 0, for 0 ≤ x ≤ L
(x, 0) = f (x), for 0 ≤ x ≤ L
The Heat/Diffusion Equation: The solution of this equation, (x, t), is the time
dependent value of heat or temperature of a one dimensional bar which is having
a heat source applied to it initially. It can also model a substance moving through
a domain using diffusion with diffusion constant D as discussed in Chap. 5. The
domain is again half infinite: [0, L] × [0, ∞).
∂ ∂2
−D =0
∂t ∂x 2
(0, t) = 0, for 0 < t
(L, t) = 0, for 0 < t
(x, 0) = f (x), for 0 < x < L
This equation is very relevant to our needs. Indeed, in Peterson (2015), we derive
this equation using a random walk model and learn how to interpret the diffusion
constant D in terms of the space constant λC and the time constant τM . However,
we will not discuss that here.
As we know from Chap. 9, one way to find the solution to these models is to assume
we can separate the variables and write (x, t) = u(x)w(t) or (x, y) = u(x)w(y). If
we make this separation assumption, we find solutions that must be written as infinite
series and to solve the boundary conditions, we must express boundary functions as
series expansions.
∂2 ∂2
− c2 2 = 0
∂t 2 ∂x
(x, 0) = f (x), for 0 ≤ x ≤ L
∂
(x, 0) = g(x), for 0 ≤ x ≤ L
∂t
10.1 The Separation of Variables Method Revisited 311
(0, t) = 0, for 0 ≤ t
(L, t) = 0, for 0 ≤ t
for some positive constant c. We assume a solution of the form (x, t) = u(x) w(t)
and compute the needed partials for Wave Equation. This leads to a the new equation
d2w 2
2 d u
u(x) − c w(t) = 0.
dt 2 dx 2
Rewriting, we find for all x and t, we must have
d2w 2
2 d u
u(x) = c w(t).
dt 2 dx 2
Now put all the u quantities on the left hand side and all the w ones on the right hand
side. This gives
d2 w 2
dt 2
c2 ddxu2
= , 0 ≤ x ≤ L, t ≥ 0.
w(t) u(x)
The only way this can be true is if both the left and right hand side are always
a constant. This common constant value we will denote by and it is called the
separation of variables constant for this model. This leads to the decoupled equa-
tions 10.1 and 10.2.
d2w
= w(t), t ≥ 0, (10.1)
dt 2
c2 d 2 u
= u(x), 0 ≤ x ≤ L. (10.2)
dx 2
We also have boundary conditions. Our assumption leads to the following boundary
conditions in x:
u(0) w(t) = 0, t ≥ 0,
u(L) w(t) = 0, t ≥ 0.
u(0) = 0, (10.3)
u(L) = 0. (10.4)
Equations 10.1–10.4 give us the boundary value problem in u(x) we need to solve.
We also have to solve a system for the variable w(t).
312 10 Linear Partial Differential Equations
Let’s look at the model in x and for convenience, let u denote the second derivative
with respect to x. The model is then
c2 u − u = 0
u(0) = 0,
u(L) = 0.
We are looking for nonzero solutions, so any choice of separation constant that
leads to a zero solution will be rejected. Hence, our job is to find the values of that
give rise to nonzero solutions.
Case I: = ω 2 , ω = 0: The model to solve is
ω2
u − u=0
c2
u(0) = 0,
u(L) = 0.
with characteristic equation r 2 − ωc2 = 0 with the real roots ± ωc . The general solution
2
u(0) = 0 = A
ω
u(L) = 0 = B sinh L
c
Hence, A = 0 and B sinh L ωc = 0. Since sinh is never zero when ω is not zero,
we see B = 0 also. Hence, the only u solution is the trivial one and we can reject
this case. There is no need to look at the corresponding w solutions as we construct
the solution to the wave equation from the products u(x)w(t). Hence, if u(x) = 0
always, the product is also zero.
Case II: = 0: The model to solve is now
u = 0
u(0) = 0,
u(L) = 0.
10.1 The Separation of Variables Method Revisited 313
with characteristic equation r 2 = 0 with the double root r = 0. Hence, the general
solution is now
u(x) = A + B x
u(0) = 0 = A
u(L) = 0 = BL
Hence, A = 0 and B = 0 and the u solutions are trivial. We reject this case as well.
Case III: = −ω 2 , ω = 0:
ω2
c2 u + u=0
c2
u(0) = 0,
u(L) = 0.
u(0) = 0 = A
ω
u(L) = 0 = B sin L
c
Hence, A = 0 and B sin L ωc = 0. We now see an interesting result. We can
determine a unique value of B only if sin L ωc = 0. Since ω = 0 by assumption, if
ω
c
L = nπ for any integer n = 0, we find the value of B can not be determined as we
have the equation 0 = B × 0. If ω = nπcL
, we can solve for B and find B = 0. So the
only solutions are the trivial or zero solutions unless ωL = nπc. Letting ωn = nπc L
,
we find a a non zero solution for each nonzero value of B of the form
ωn nπ
un (x) = B sin x = B sin x .
c L
d2w
+ ωn2 w(t) = 0, t ≥ 0.
dt 2
The general solution is
as we will get a different time solution for each choice of ωn . Hence, any product
will solve the model with the x boundary conditions. In fact, any finite sum of the
form, for arbitrary constants Cn and Dn
N
N
N (x, t) = φn (x, t) = un (x) wn (t)
n=1 n=1
N
nπ nπc nπc
= sin x Cn cos t + Dn sin t
n=1
L L L
Using what we know about Fourier series and series in general from Chap. 9, we can
show the series of the form
∞
nπ nπc nπc
sin x An cos t + Bn sin t
n=1
L L L
converge pointwise for x in [0, L] and all t. We haven’t gone through all the details
of this argument yet but we will. Hence, we will form the solution (x, t) given by
∞
∞
(x, t) = φn (x, t) = un (x) wn (t)
n=1 n=1
10.1 The Separation of Variables Method Revisited 315
∞
nπ nπc nπc
= sin x Cn cos t + Dn sin t
n=1
L L L
for the arbitrary sequences of constants (Cn ) and (Dn ). We can show we can find the
partial derivatives of this series pointwise by differentiating term by term. Hence,
∞
∂ ∂w
(x, t) = un (x)
∂t n=1
∂t
∞
nπ nπc nπc nπc nπc
= sin x −Cn sin t + Dn cos t .
n=1
L L L L L
which we can then use to solve the boundary conditions with data functions.
and
∞
∂ nπ nπc
(x, 0) = sin x Dn .
∂t n=1
L L
The theory of Fourier series tells us that any piecewise differentiable function h can
be written as the series
316 10 Linear Partial Differential Equations
∞
nπ
h(x) = An sin x
n=1
L
Since this is a Fourier series, the series converges pointwise. For now, apply these
ideas to the functions f and g to write
∞
nπ
f (x) = An sin x
n=1
L
∞
nπ
g(x) = Bn sin x
n=1
L
with
2 L nπ
An = f (x) sin x dx
L 0 L
2 L nπ
Bn = g(x) sin x dx
L 0 L
Writing these series on the left hand side only we find after some term by term
manipulations
∞
nπ
Cn − An sin x =0
n=1
L
∞
nπc nπ
Dn − Bn sin x =0
n=1
L L
Since these series converge pointwise, the only way they can equal 0 for all x is if
the individual terms equal zero. Hence, for each n, we must have
10.1 The Separation of Variables Method Revisited 317
nπ
Cn − An sin x =0
L
nπ
Dn nπc − Bn sin x = 0.
L
Since this is true for all x, the coefficients must equal zero and so we find that the
solution is given by Cn = An and Dn = Bnπc nL
for all n ≥ 1. The ideas here are really
quite general so we can apply them quite easily to the other models. The technique
we use above is called coefficient matching.
10.1.1.4 Summary
10.1.1.5 Homework
Exercise 10.1.1
∂2 ∂2
− 25 =0
∂t 2 ∂x 2
(x, 0) = 0.1x 2 , for 0 ≤ x ≤ 10
∂
(x, 0) = 0, for 0 ≤ x ≤ 10
∂t
318 10 Linear Partial Differential Equations
(0, t) = 0, for 0 ≤ t
(10, t) = 0, for 0 ≤ t
Exercise 10.1.2
∂2 ∂2
− 4 =0
∂t 2 ∂x 2
(x, 0) = 0, for 0 ≤ x ≤ 5
∂
(x, 0) = 0.05x 2 , for 0 ≤ x ≤ 5
∂t
(0, t) = 0, for 0 ≤ t
(5, t) = 0, for 0 ≤ t
∂2 ∂2
+ =0
∂x 2 ∂y2
∂
(0, y) = 0, for 0 ≤ y ≤ L
∂x
∂
(L, y) = 0, for 0 ≤ y ≤ L
∂x
(x, L) = 0, for 0 ≤ x ≤ L
(x, 0) = f (x), for 0 ≤ x ≤ L
We assume a solution of the form (x, y) = u(x) w(y) and compute the needed
partials for Laplace’s Equation. This leads to a the new equation
d2w d2u
u(x) + 2 w(y) = 0.
dy2 dx
d2w d2u
u(x) 2
= − 2 w(y).
dy dx
Now put all the u quantities on the left hand side and all the w ones on the right hand
side. This gives
d2 w d2 u
dy2 dx 2
− = , 0 ≤ x, y ≤ L.
w(y) u(x)
10.1 The Separation of Variables Method Revisited 319
The only way this can be true is if both the left and right hand side are always
a constant. This common constant value is called the separation of variables
constant for this model. This leads to the decoupled equations 10.5 and 10.6.
d2w
= − w(y), 0 ≤ y ≤ L, (10.5)
dy2
d2u
= u(x), 0 ≤ x ≤ L. (10.6)
dx 2
We also have boundary conditions. Our assumption leads to the following boundary
conditions in x:
du
(0) w(y) = 0, for 0 ≤ y ≤ L,
dx
du
(L) w(y) = 0, for 0 ≤ y ≤ L,
dx
u(x) w(L) = 0, for 0 ≤ x ≤ L.
Since these equations must hold for all y for the first two and all x for the last, this
forces
du
(0) = 0, (10.7)
dx
du
(L) = 0, (10.8)
dx
w(L) = 0. (10.9)
Equations 10.5–10.8 give us the boundary value problem in u(x) we need to solve.
We also have to solve a system for the variable w(y) with condition 10.9.
u − u = 0
u (0) = 0,
u (L) = 0.
We are looking for nonzero solutions, so any choice of separation constant that
leads to a zero solution will be rejected. Hence, our job is to find the values of that
give rise to nonzero solutions.
320 10 Linear Partial Differential Equations
u − ω 2 u = 0
u (0) = 0,
u (L) = 0.
with characteristic equation r 2 − ω 2 = 0 with the real roots ±ω. The general solution
of this second order model is given by
with
u (0) = 0 = B
u (L) = 0 = Aω sinh(Lω)
Hence, B = 0 and A sinh(Lω) = 0. Since sinh is never zero when ω is not zero, we
see A = 0 also. Hence, the only u solution is the trivial one and we can reject this
case. Again, there is no need to look at the corresponding w solutions as we construct
the solution to Laplace’s equation from the products u(x)w(y). Hence, if u(x) = 0
always, the product is also zero.
Case II: = 0: The model to solve is now
u = 0
u (0) = 0,
u (L) = 0.
with characteristic equation r 2 = 0 with the double root r = 0. Hence, the general
solution is now
u(x) = A + B x
with u (x) = B. Applying the boundary conditions, u (0) = 0 and u (L) = 0. Hence,
u (0) = 0 = B
u (L) = 0 = B
nonzero solution for this case. We now need to solve for w in this case. The model
to solve is
d2w
= 0, 0 ≤ y ≤ L,
dy2
w(L) = 0.
The general solution is w(y) = A + By and applying the boundary condition, we find
w(L) = A + BL = 0. Hence, solving for B, we find B = − AL . The corresponding
family of solutions for w in this case is
A y
w(y) = A − y = A 1 −
L L
L−y
=A
L
L−y
w0 (y) = .
L
Hence, the product 0 (x, y) = u0 (x) w0 (y) solves the boundary conditions. That is
L−y
0 (x, y) =
L
is a solution.
Case III: = −ω 2 , ω = 0:
u + ω 2 u = 0
u (0) = 0,
u (L) = 0.
with
u (0) = 0 = B
u (L) = 0 = A sin(Lω)
It is only necessary to use all integers n ≥ 1 as cos is an even function and so the
solutions for negative integers are the same of the solutions for positive integers. For
convenience, let’s choose all the constants A = 1. Then we have an infinite family
of nonzero solutions un (x) = cos( nπL
x) and an infinite family of separation constants
n = −ωn2 = − nLπ2 . We can then solve the w equation. We must solve
2 2
d2w
− ωn2 w(y) = 0, 0 ≥ y ≥ L,
dy2
wn (L) = 0.
Neither cosh or sinh are zero here, so we can solve for D in terms of C to find
cosh(ωn L)
D = −C .
sinh(ωn L)
cosh(ωn L)
wn (y) = C cosh(ωn y) − C sinh(ωn y)
sinh(ωn L)
10.1 The Separation of Variables Method Revisited 323
cosh(ωn y) sinh(ωn L) − cosh(ωn L) sinh(ωn y)
=C
sinh(ωn L)
C
Finally, the term sinh(ωn L)
is arbitrary as C is arbitrary. Choosing the arbitrary constant
to be 1 always, we obtain a family of solutions of the form
wn (y) = sinh ωn (L − y)
will solve the model with the x boundary conditions. In fact, any finite sum of the
form, for arbitrary constants An
N
N
N (x, y) = An φn (x, y) = An un (x) wn (y)
n=1 n=1
N
nπ nπ
= An cos x sinh (L − y)
n=1
L L
converge pointwise for x, y in [0, L]. Hence, we will form the solution (x, y)
given by
∞
∞
(x, y) = An φn (x, y) = An un (x) wn (y)
n=0 n=0
324 10 Linear Partial Differential Equations
∞
L−y nπ nπ
= A0 + An cos x sinh (L − y)
L n=1
L L
with
1 L
B0 = f (x)dx
L 0
2 L nπ
Bn = f (x) cos x dx, n ≥ 1
L 0 L
10.1.2.4 Summary
• Convert the model into two ordinary differential equation (ODE) models. These
two models are connected by a separation constant .
• The u(x) problems is a boundary value problem (BVP) with parameter . We
must find nontrivial, i.e. non zero, solutions to it. We find there are infinitely many
such solutions for a sequence of values. This requires we study this model for
the cases = ω 2 , = 0 and = −ω 2 for any ω = 0. This requires knowledge
of how to solve such ODE models.
• Once the BVP is solved, it tells us the sequence of separation constants we can
use to solve the other ODE model. This gives us one nontrivial solution family for
each of these separation constant values, φn .
• We form the family of series solutions ∞ n=1 φn and express the boundary function
data given by f as a Fourier series.
• Then equate the series solution at the boundary which has function data to the
series for the boundary data and match coefficients to find the correct solution to
the model.
10.1.2.5 Homework
Exercise 10.1.3
∂2 ∂2
+ =0
∂x 2 ∂y2
∂
(0, y) = 0, for 0 ≤ y ≤ 10
∂x
∂
(7, y) = 0, for 0 ≤ y ≤ 10
∂x
(x, 10) = 0, for 0 ≤ x ≤ 7
(x, 0) = 1.2x 4 , for 0 ≤ x ≤ 7.
Exercise 10.1.4
∂2 ∂2
+ =0
∂x 2 ∂y2
∂
(0, y) = 0, for 0 ≤ y ≤ 2
∂x
∂
(5, y) = 0, for 0 ≤ y ≤ 2
∂x
(x, 2) = 0, for 0 ≤ x ≤ 5
(x, 0) = 1.2x 2 , for 0 ≤ x ≤ 5.
326 10 Linear Partial Differential Equations
∂ ∂2
−D =0
∂t ∂x 2
(0, t) = 0, for 0 < t
(L, t) = 0, for 0 < t
(x, 0) = f (x), for 0 < x < L
for some positive constant D which in the case of diffusion is called the diffusion
constant. We again assume a solution of the form (x, t) = u(x) w(t) and compute
the needed partials. This leads to a the new equation
dw d2u
u(x) − D 2 w(t) = 0.
dt dx
Rewriting, we find for all x and t, we must have
dw d2u
u(x) = D 2 w(t).
dt dx
Rewriting, we have
2
dw
D ddxu2
dt
= , 0 ≤ x <≤ L, t > 0.
w(t) u(x)
As usual, the only way this is true is if both the left and right hand side equal the
separation constant for this model. This leads to the decoupled equations 10.10
and 10.11.
dw
= w(t), t > 0, (10.10)
dt
d2u
D 2 = u(x), 0 ≤ x ≤ L, (10.11)
dx
We also have boundary conditions. Our assumption leads to the following boundary
conditions in x:
u(0) = 0, (10.12)
u(L) = 0. (10.13)
Equations 10.10–10.13 give us the boundary value problem in u(x) we need to solve.
Once we have the u solution, we can solve the system for the variable w(t).
D u − u = 0
u(0) = 0,
u(L) = 0.
We are looking for nonzero solutions, so any choice of separation constant that
leads to a zero solution will be rejected. Hence, our job is to find the values of that
give rise to nonzero solutions.
Case I: = ω 2 , ω = 0: The model to solve is
ω2
u − u=0
D
u(0) = 0,
u(L) = 0.
with characteristic equation r 2 − ωD = 0 with the real roots ± √ωD . The general
2
u(0) = 0 = A
ω
u(L) = 0 = B sinh L √
D
Hence, A = 0 and B sinh L √ωD = 0. Since sinh is never zero when ω is not zero,
we see B = 0 also. Hence, the only u solution is the trivial one and we can reject this
case.
328 10 Linear Partial Differential Equations
u = 0
u(0) = 0,
u(L) = 0.
with characteristic equation r 2 = 0 with the double root r = 0. Hence, the general
solution is now
u(x) = A + B x
u(0) = 0 = A
u(L) = 0 = BL
Hence, A = 0 and B = 0 and the u solutions are trivial. We reject this case as well.
Case III: = −ω 2 , ω = 0:
ω2
u + u=0
D
u(0) = 0,
u(L) = 0.
u(0) = 0 = A
ω
u(L) = 0 = B sin L √
D
Hence, A = 0 and B sin L √ωD = 0. Thus, we can determine a unique value of B
ω
only if sin L D = 0. If ω = nπc
√
L
, we can solve for B and find B = 0, but otherwise,
B can’t be determined. So the only solutions are the trivial or zero solutions unless
√ √
ωL = nπ D. Letting ωn = nπL D , we find a a non zero solution for each nonzero
value of B of the form
10.1 The Separation of Variables Method Revisited 329
ωn nπ
un (x) = B sin √ x = B sin x .
D L
constants n = −ωn2 = − n Lπ2 D . We can then solve the w equation. We must solve
2 2
dw
= −ωn2 w(t), t ≥ 0.
dt
The general solution is
n2 π 2 D
w(t) = Bn e−ωn t = Bn e−
2 t
L2
as we will get a different time solution for each choice of ωn . Choosing the constants
Bn = 1, we obtain the wn functions
n2 π 2 D
wn (t) = e− L2
t
will solve the model with the x boundary conditions and any finite sum of the form,
for arbitrary constants An
N
N
N (x, t) = φn (x, t) = un (x) wn (t)
n=1 n=1
N
nπ n2 π 2 D
= sin x e− L2 t
n=1
L
converge pointwise for x in [0, L] and all t. Hence, form the solution (x, t) as
∞
∞
(x, t) = φn (x, t) = un (x) wn (t)
n=1 n=1
∞
nπ n2 π 2 D
= sin x e− L2 t
n=1
L
with
L
2 nπ
Bn = f (x) sin x dx
L 0 L
Then, setting these series equal, we find that the solution is given by An = Bn for all
n ≥ 1.
10.1 The Separation of Variables Method Revisited 331
10.1.3.4 Homework
Exercise 10.1.5
∂ ∂2
− 10 =0
∂t ∂x 2
(0, t) = 0, for 0 < t
(8, t) = 0, for 0 < t
(x, 0) = 10e−0.002t , for 0 < x < 8.
Exercise 10.1.6
∂ ∂2
−4 =0
∂t ∂x 2
(0, t) = 0, for 0 < t
(12, t) = 0, for 0 < t
(x, 0) = 0.05 cos(t 2 ), for 0 < x < 12.
Using the Fourier approximation tools we built in Chap. 9, we can now write appli-
cation code that will approximate the separation of variables solutions to linear PDE.
We will show code for one particular set of boundary conditions for each problem.
We will write functions to solve models with Dirichlet boundary conditions (i.e. the
solution is set to 0 on two boundaries) and those with Dirichlet boundary conditions
(a partial of the solution is set to 0 on two boundaries).
In order to write the approximation code for the wave equation solutions, we first
must solve the model using separation of variables.
∂2 2∂
2
− c =0
∂t 2 ∂x 2
(x, 0) = f (x), for 0 ≤ x ≤ L
332 10 Linear Partial Differential Equations
∂
(x, 0) = 0, for 0 ≤ x ≤ L
∂t
(0, t) = 0, for 0 ≤ t
(L, t) = 0, for 0 ≤ t
c2 u − n u = 0, for 0 ≤ x ≤ L
u(0) = 0,
u(L) = 0.
w − n w = 0, for t ≥ 0,
w (0) = 0.
2
where the separation constants are n = − nπc L
for n = 1, 2, . . .. The boundary
conditions on x lead to the solutions un (x) = sin nπ
L
x and w n (t) = cos nπc
L
t .
The infinite series solution is then
∞
nπ nπc
(x, t) = An sin x cos t .
n=1
L L
will still rotate, but with a significant time delay. In this function, we approximate
the series as follows: First, we get the first N Fourier sine series coefficients.
Listing 10.1: Get Fourier sine coefficients
% Get F o u r i e r S i n e Approximation t o f f o r N term s
[ A, fN ] = F o u r i e r S i n e A p p r o x ( f , L1 ,M,N) ;
Then, we set up function handles for all of the needed sin functions.
Listing 10.2: Setup sine functions
% Get S i n e F u n c t i o n s
u = S e t U p S i n e s ( L1 ,N) ;
We then construct the cos function handles we will use in the approximation.
Listing 10.3: Setup cosine functions
% Get t h e c o s f u n c t i o n s
v = c e l l (N, 1 ) ;
3 f o r i = 1 :N
v{ i } = @( t ) c o s ( i ∗ p i ∗ c ∗ t /L1 ) ;
end
Finally, we define the surface function p(x, t) as the partial sum of the first N terms.
Listing 10.4: Construct the approximate solution
% Construct the approximate s o l u t i o n
% g e t Nth F o u r i e r S i n e Appro ximati on
p = @( x , t ) 0 ;
f o r i =1:N
5 p = @( x , t ) ( p ( x , t ) + A( i ) ∗u{ i } ( x ) . ∗ v{ i } ( t ) ) ;
end
Once p(x, t) is defined, we can plot the approximate surface. We set up a mesh of
(x, t) points and calculate all the needed surface values for all the mesh points using
the code below.
Listing 10.5: Setup plot domain
%
% draw s u r f a c e f o r g r i d [ 0 , L1 ] x [ 0 , L2 ]
% s e t up x and y s t u f f
4 x = l i n s p a c e ( 0 , L1 , nx ) ;
t = l i n s p a c e ( 0 , L2 , nt ) ;
% s e t up g r i d o f x and y p a i r s ( x ( i ) , t ( j ) )
[ X, T ] = m e s h g r i d ( x , t ) ;
% s e t up s u r f a c e
9 Z = p (X, T) ;
334 10 Linear Partial Differential Equations
We then plot the surface using the mesh command setting labels and so forth as
usual.
% Get S i n e F u n c t i o n s
37 u = S e t U p S i n e s ( L1 ,N) ;
% Get t h e c o s f u n c t i o n s
v = c e l l (N, 1 ) ;
f o r i = 1 :N
42 v{ i } = @( t ) c o s ( i ∗ p i ∗ c ∗ t /L1 ) ;
end
52 % draw s u r f a c e f o r g r i d [ 0 , L1 ] x [ 0 , L2 ]
% s e t up x and y s t u f f
x = l i n s p a c e ( 0 , L1 , nx ) ;
t = l i n s p a c e ( 0 , L2 , n t ) ;
% s e t up g r i d o f x and y p a i r s ( x ( i ) , t ( j ) )
57 [ X, T ] = m e s h g r i d ( x , t ) ;
% s e t up s u r f a c e
Z = p (X, T) ;
%p l o t s u r f a c e
62 figure
mesh (X, T , Z , ’ EdgeColor ’ , ’ black ’ ) ;
x l a b e l ( ’x axis ’ ) ;
y l a b e l ( ’y axis ’ ) ;
z l a b e l ( ’ Wave Solution ’ ) ;
67 t i t l e ( ’ Wave Dirichlet Solution on Rectangle ’ ) ;
p r i n t −dpng ’ W a v e D i r i c h l e t . png ’ ;
end
The surface approximation can be seen in Fig. 10.1. Note even though the number
of points in our mesh is low, the surface plot is reasonably good.
We can check to see if the boundary conditions are satisfied by adding a few
lines of code. To the function WaveDirichletApprox, we can calculate the
Fig. 10.1 5 term Fourier series approximation to the wave equation with sawtooth wave data and
Dirichlet boundary conditions
336 10 Linear Partial Differential Equations
approximations to ∂ ∂x
and ∂
∂t
and return them as the functions pd1 and pd2. The
first line of the function becomes
% Get t h e c o s f u n c t i o n s
v = c e l l (N, 1 ) ;
f o r i = 1 :N
14 v{ i } = @( t ) c o s ( i ∗ p i ∗ c ∗ t /L1 ) ;
end
% Get t h e c o s d e r i v a t i v e f u n c t i o n s
vp = c e l l (N, 1 ) ;
19 f o r i = 1 :N
vp { i } = @( t ) −(( i ∗ p i ∗ c ) /L1 ) ∗ s i n ( i ∗ p i ∗ c ∗ t /L1 ) ;
end
29 % C o n s t r u c t t h e a p p r o x i m a t e s o l u t i o n f o r pd1 :
% p a r t i a l o f p w r t argument 1
pd1 = @( x , t ) 0 ;
f o r i =1:N
pd1 = @( x , t ) ( pd1 ( x , t ) + A( i ) ∗up{ i } ( x ) . ∗ v{ i } ( t ) ) ;
34 end
% C o n s t r u c t t h e a p p r o x i m a t e s o l u t i o n f o r pd2 :
% p a r t i a l o f p w r t argument 2
pd2 = @( x , t ) 0 ;
39 f o r i =1:N
pd2 = @( x , t ) ( pd2 ( x , t ) + A( i ) ∗u{ i } ( x ) . ∗ vp { i } ( t ) ) ;
end
The rest of the code is the same and so we do not show it. You can alter the code
to add these checks easily if you want. When we run the code using the sawtooth
function like before, we use
10.2 Fourier Series Approximate Methods 337
Listing 10.11: The wave solution with dirichlet BC using saw data
[ p , pd1 , pd2 ] = WaveDirichletApprox ( saw , c , 5 0 0 , 5 , 2 1 , 4 1 , 5 , 2 0 ) ;
and we test the boundary conditions by constructing functions which we can plot
to see if we obtain the requested boundary behavior. We define functions bottom,
bottomprime, right and left for these checks. We will leave it to you to verify
that we are indeed satisfying the boundary conditions. Note since the approximations
are built from functions that satisfy the x boundary conditions, the left and right
functions are guaranteed to work.
A Wave equation with Neumann boundary conditions has the following form:
∂2 ∂2
− c2 2 =0
∂t 2 ∂x
(x, 0) = f (x), for 0 ≤ x ≤ L
∂
(x, 0) = 0, for 0 ≤ x ≤ L
∂t
∂
(0, t) = 0, for 0 ≤ t
∂x
∂
(L, t) = 0, for 0 ≤ t
∂x
Applying separation of variables, we let (x, t) = u(x)w(t) and find
c2 u − n u = 0, for 0 ≤ x ≤ L
338 10 Linear Partial Differential Equations
u (0) = 0,
u (L) = 0.
w − n w = 0, for t ≥ 0,
w (0) = 0.
2
where the separation constants are again n = − nπc L
for n = 0, 1, . . .. The
boundary conditions on x lead to the solutions un (x) = cos nπL
x and wn (t) =
cos nπc
L
t . The infinite series solution is then
∞
nπ nπc
(x, t) = A0 + An cos x cos t .
n=1
L L
The call to SetUpCosines also returns N + 1 cos functions rather than N handles.
We also set up N + 1 cos functions of time as well.
10.2 Fourier Series Approximate Methods 339
5 % Get t h e c o s f u n c t i o n s
v = c e l l (N+1 ,1) ;
v {1} = @( t ) 1 ;
f o r i = 2 :N+1
v{ i } = @( t ) c o s ( ( i −1) ∗ p i ∗ c ∗ t /L1 ) ;
10 end
% Get C o s i n e F u n c t i o n s
340 10 Linear Partial Differential Equations
40 % r e t u r n s u {1} = 1 , u {2} = c o s ( p i x /L ) e t c
u = S e t U p C o s i n e s ( L1 ,N) ;
% Get t h e c o s f u n c t i o n s
v = c e l l (N+1 ,1) ;
45 v{1} = @( t ) 1 ;
f o r i = 2 :N+1
v{ i } = @( t ) c o s ( ( i −1)∗ p i ∗ c ∗ t /L1 ) ;
end
75 end
Using a sawtooth curve as the data f , we generate the approximation solution with a
few lines of code.
and we add lines similar to what we did before to handle the partial derivative
approximations.
10.2 Fourier Series Approximate Methods 341
Fig. 10.2 5 term Fourier series approximation to the wave equation with sawtooth wave data and
Neumann boundary conditions
% Get t h e c o s f u n c t i o n s
v = c e l l (N+1 ,1) ;
14 v {1} = @( t ) 1 ;
f o r i = 2 :N+1
v{ i } = @( t ) c o s ( ( i −1) ∗ p i ∗ c ∗ t /L1 ) ;
end
19 % Get t h e c o s d e r i v a t i v e f u n c t i o n s
vp = c e l l (N+1 ,1) ;
vp {1} = @( t ) 0 ;
f o r i = 2 :N+1
vp { i } = @( t ) −(( i ∗ p i ∗ c ) /L1 ) ∗ s i n ( i ∗ p i ∗ c ∗ t /L1 ) ;
24 end
34 pd1 = @( x , t ) 0 ;
f o r i =1:N+1
pd1 = @( x , t ) ( pd1 ( x , t ) + A( i ) ∗up{ i } ( x ) . ∗ v{ i } ( t ) ) ;
end
39 % C o n s t r u c t t h e a p p r o x i m a t e s o l u t i o n f o r pd2 :
% p a r t i a l o f p w r t argument 2
pd2 = @( x , t ) 0 ;
f o r i =1:N+1
pd2 = @( x , t ) ( pd2 ( x , t ) + A( i ) ∗u{ i } ( x ) . ∗ vp { i } ( t ) ) ;
44 end
You can alter the code to add these checks easily if you want. When we run the code
using the sawtooth function like before, we use
and we test the boundary conditions by constructing functions which we can plot to
see if we obtain the requested boundary behavior. We define the functions bottom,
bottomprime, right and left for these checks as we did for the Dirichlet data
and perform the check as usual.
Now let’s look at approximations to Laplace’s equation on the rectangle [0, L1] ×
[0, L2].
∂2 ∂2
+ =0
∂x 2 ∂y2
(0, y) = 0, for 0 ≤ y ≤ L1
(L1, y) = 0, for 0 ≤ y ≤ L2
(x, L2) = 0, for 0 ≤ x ≤ L1
(x, 0) = f (x), for 0 ≤ x ≤ L1
10.2 Fourier Series Approximate Methods 343
∞
nπ nπ
(x, y) = An sin x sinh (L2 − y) .
n=1
L1 L1
We have added the arguments nx and ny that are the number of x and y points to use
in the surface plot of the approximate solution. The code to build the approximation
is similar. First, we get the Fourier sine coefficients of the boundary data function
f and then we create the handles to the component sin and sinh functions. Finally,
when we construct the function p which
is the approximate solution, we scale the
nπL2
individual terms by the needed sinh L1
terms.
5 % Get S i n e F u n c t i o n s
u = S e t U p S i n e s ( L1 ,N) ;
% Get t h e s i n h f u n c t i o n s
v = c e l l (N, 1 ) ;
10 f o r i = 1 :N
v{ i } = @( y ) s i n h ( i ∗ p i ∗ ( L2−y ) /L1 ) ;
end
% Get t h e s i n h f u n c t i o n s
31 v = c e l l (N, 1 ) ;
f o r i = 1 :N
v{ i } = @( y ) s i n h ( i ∗ p i ∗ ( L2−y ) /L1 ) ;
end
%
% draw s u r f a c e f o r g r i d [ 0 , L1 ] x [ 0 , L2 ]
% s e t up x and y s t u f f
46 x = l i n s p a c e ( 0 , L1 , nx ) ;
y = l i n s p a c e ( 0 , L2 , ny ) ;
% s e t up g r i d o f x and y p a i r s ( x ( i ) , y ( j ) )
[ X,Y] = m e s h g r i d ( x , y ) ;
% s e t up s u r f a c e
51 Z = p (X,Y) ;
%p l o t s u r f a c e
figure
mesh (X, Y, Z , ’ EdgeColor ’ , ’ black ’ ) ;
56 x l a b e l ( ’x axis ’ ) ;
y l a b e l ( ’y axis ’ ) ;
z l a b e l ( ’ Laplace Solution ’ ) ;
t i t l e ( ’ Laplace Dirichlet Solution on Rectangle ’ ) ;
p r i n t −dpng ’ L a p l a c e D i r i c h l e t . png ’ ;
61
end
Let’s look at how we use this function. We construct a square wave data function and
then solve Laplace’s equation on the rectangle.
Fig. 10.3 10 term Fourier series approximation to Laplace’s equation with square wave data and
Dirichlet boundary conditions
The returned function p(x, y) is the approximation to our model with the generated
surface shown in Fig. 10.3.
We can do a better job by using more terms as is shown next. This time we use 20
terms. The resulting surface plot is better as is seen in Fig. 10.4.
Fig. 10.4 20 term Fourier series approximation to Laplace’s equation with square wave data and
Dirichlet boundary conditions
10.2 Fourier Series Approximate Methods 347
∂2 ∂2
+ =0
∂x 2 ∂y2
∂
(0, y) = 0, for 0 ≤ y ≤ L
∂x
∂
(L, y) = 0, for 0 ≤ y ≤ L
∂x
(x, L) = 0, for 0 ≤ x ≤ L
(x, 0) = f (x), for 0 ≤ x ≤ L
∞
L2 − y nπ nπ
(x, y) = A0 + An cos x sinh (L2 − y) .
L2 n=1
L1 L1
∞
nπ
= f (x) = B0 + Bn cos x ,
n=1
L1
L1
where B0 = 1
L1
and for n ≥ 1, Bn = 2
L1 0 f (s) cos nπ
L1
s ds. This tells us we
choose the constants A0 = B0 and for n ≥ 1, (An ) so that An = Bn . The
nπL2
sinh L1
% Get C o s i n e F u n c t i o n s
u = S e t U p C o s i n e s ( L1 ,N) ;
29
% Get t h e y f u n c t i o n s
v = c e l l (N+1 ,1) ;
v{1} = @( y ) 1 − y / L2 ;
f o r i = 2 :N+1
34 v{ i } = @( y ) s i n h ( ( i −1)∗ p i ∗ ( L2−y ) /L1 ) ;
end
39 c = A( 1 ) ;
p = @( x , y ) c ;
for i =2:N+1
d = s i n h ( ( i −1)∗ p i ∗L2/L1 ) ;
p = @( x , y ) ( p ( x , y ) + (A( i ) / d ) ∗u{ i } ( x ) . ∗ v{ i } ( y ) ) ;
44 end
%
% draw s u r f a c e f o r g r i d [ 0 , L1 ] x [ 0 , L2 ]
% s e t up x and y s t u f f
49 x = l i n s p a c e ( 0 , L1 , nx ) ;
y = l i n s p a c e ( 0 , L2 , ny ) ;
% s e t up g r i d o f x and y p a i r s ( x ( i ) , y ( j ) )
[ X,Y] = m e s h g r i d ( x , y ) ;
% s e t up s u r f a c e
54 Z = p (X,Y) ;
%p l o t s u r f a c e
figure
mesh (X, Y, Z , ’ EdgeColor ’ , ’ black ’ ) ;
59 x l a b e l ( ’x axis ’ ) ;
y l a b e l ( ’y axis ’ ) ;
z l a b e l ( ’ Laplace Solution ’ ) ;
t i t l e ( ’ Laplace Neumann Solution on Square ’ ) ;
p r i n t −dpng ’ L a p l a c e N e u m a n n . png ’ ;
64
end
Next, we approximate the solution to the Laplace Neumann model for square wave
boundary data using 5 terms.
Fig. 10.5 5 term Fourier series approximation to Laplace’s equation with square wave data and
Neumann boundary conditions
350 10 Linear Partial Differential Equations
∂ ∂2
−D =0
∂t ∂x 2
(0, t) = 0, for 0 < t
(L, t) = 0, for 0 < t
(x, 0) = f (x), for 0 < x < L1
2
where the separation constants are n = −D for n = 1, 2, . . .. The boundary
nπ
L1
conditions on x lead to the solutions un (x) = sin nπ
L1
x and wn (t) = e−n t . The
infinite series solution is then
2
∞
−D nπ
t
nπ L1
(x, t) = An sin x e .
n=1
L1
% Get t h e e x p f u n c t i o n s
30 v = c e l l (N, 1 ) ;
f o r i = 1 :N
v{ i } = @( t ) exp ( −D∗ i ˆ2∗ p i ˆ2∗ t /L1 ˆ 2 ) ;
end
%
% draw s u r f a c e f o r g r i d [ 0 , L1 ] x [ 0 , L2 ]
% s e t up x and y s t u f f
45 x = l i n s p a c e ( 0 , L1 , nx ) ;
t = l i n s p a c e ( 0 , L2 , n t ) ;
% s e t up g r i d o f x and y p a i r s ( x ( i ) , t ( j ) )
[ X, T ] = m e s h g r i d ( x , t ) ;
% s e t up s u r f a c e
50 Z = p (X, T) ;
%p l o t s u r f a c e
figure
mesh (X, T , Z , ’ EdgeColor ’ , ’ black ’ ) ;
352 10 Linear Partial Differential Equations
55 x l a b e l ( ’x axis ’ ) ;
y l a b e l ( ’t axis ’ ) ;
z l a b e l ( ’ Heat Solution ’ ) ;
t i t l e ( ’ Heat Dirichlet Solution on Square ’ ) ;
p r i n t −dpng ’ H e a t D i r i c h l e t . png ’ ;
60
end
Let’s look a quick test of this function to solve the Heat equation using square wave
data. We set the diffusion constant to D = 0.02 and solve the model over 80 time
units. Note we use a relatively coarse gridding strategy for the plot; nx = 41 and
nt = 121. The decay of the solution is quite slow and unless we plot it over a long
time interval, we don’t see much change.
The returned function p(x, t) is the approximation to our model with the generated
surface shown in Fig. 10.6.
We can also solve the heat equation using pulse data. Recall, a rectangular pulse
centered at x0 of width r and height H on the interval [0, L] has the form
Fig. 10.6 10 term Fourier series approximation to the heat equation with square wave data and
Dirichlet boundary conditions
10.2 Fourier Series Approximate Methods 353
⎧
⎨ 0, 0 ≤ x ≤ x0 − r,
J(x) = H, x0 − r < x < x0 + r,
⎩
0, x0 + r ≤ x ≤ L
It is then easy to approximate the solution to the heat equation with a data pulse of
height 100 at location 1 of width 0.2. As you would expect, we need more terms in
the Fourier series to approximate this pulse reasonably well. Hence, we are using 40
terms here.
Fig. 10.7 40 term Fourier series approximation to the heat equation with pulse data and Dirichlet
boundary conditions
354 10 Linear Partial Differential Equations
∂ ∂2
−D = 0
∂t ∂x 2
∂
(0, t) = 0, for 0 < t
∂x
∂
(L, t) = 0, for 0 < t
∂x
(x, 0) = f (x), for 0 < x < L1
2
where the separation constants are n = −D for n = 0, 1, 2, . . .. The bound-
nπ
L1
ary conditions on x lead to the solutions u0 (x) = 1 and un (x) = cos nπL1
x for n ≥ 1.
The solutions for t are then w0 (t) = 1 and wn (t) = e−n t for n ≥ 1. The infinite
series solution is then
2
∞ −D nπ t
nπ L1
(x, t) = A0 + An cos x e .
n=1
L1
% Get C o s i n e F u n c t i o n s
u = S e t U p C o s i n e s ( L1 ,N) ;
30 % Get t h e e x p f u n c t i o n s
v = c e l l (N+1 ,1) ;
v{1} = @( t ) 1 ;
f o r i = 2 :N+1
v{ i } = @( t ) exp ( −D∗ i ˆ2∗ p i ˆ2∗ t /L1 ˆ 2 ) ;
35 end
%
45 % draw s u r f a c e f o r g r i d [ 0 , L1 ] x [ 0 , L2 ]
% s e t up x and y s t u f f
x = l i n s p a c e ( 0 , L1 , nx ) ;
t = l i n s p a c e ( 0 , L2 , n t ) ;
% s e t up g r i d o f x and y p a i r s ( x ( i ) , t ( j ) )
50 [ X, T ] = m e s h g r i d ( x , t ) ;
% s e t up s u r f a c e
Z = p (X, T) ;
%p l o t s u r f a c e
55 figure
mesh (X, T , Z , ’ EdgeColor ’ , ’ black ’ ) ;
x l a b e l ( ’x axis ’ ) ;
y l a b e l ( ’t axis ’ ) ;
z l a b e l ( ’ Laplace Solution ’ ) ;
60 t i t l e ( ’ Laplace Neumann Solution on Square ’ ) ;
p r i n t −dpng ’ H e a t N e u m a n n . png ’ ;
end
356 10 Linear Partial Differential Equations
As an example, let’s solve the heat equation using multiple pulse data. The function
pulsefunc(x,x0,r,H) gives us a rectangular pulse centered at x0 of width r
and height H on any interval. For convenience, denote such a pulse of height 1 by the
function P(x0 , r). Then a pulse of height H is simply HP(x0 , r). We now apply two
pulses, 100P(2, 0.3) and 200P(4, 0.1) as boundary data. Since this boundary data is
more complicated, let’s look at it Fourier cosine approximations first. We generate
this pulse with the code
and we compute the Fourier cosine approximations as usual with these lines. Recall
the line FourierCosineApprox(pulse,5,100,5); is setting the number
of terms in the Riemann sum approximations to the inner product calculations to
100, the interval to [0, 5] and the number of Fourier terms to 6. Hence, we gener-
ate approximations all the way to 1400 Riemann sum terms and 61 Fourier cosine
coefficients.
We show the approximation we will use in our approximation of the heat model in
Fig. 10.8 which uses 41 Fourier coefficients and 500 terms in the Riemann sum.
Then, we can approximate the solution to the heat model for a diffusion coefficient
D = 0.0002 over 300 time units.
Linear Partial Differential Equations!the Heat equation with Neumann BC: a
sample solution with 40 terms for two pulses
Fig. 10.8 41 term Fourier series approximation for dual pulse data
Fig. 10.9 41 term Fourier series approximation to the heat equation with dual pulse data and
Neumann boundary conditions
10.2.3.3 Homework
Exercise 10.2.1 Solve the Heat equation using square wave data (L1 = 4) with the
diffusion constant to D = 0.0004. Solve the model over an appropriate length of
358 10 Linear Partial Differential Equations
time using a the gridding strategy you think is good. Use the split function as coded
below.
Listing 10.37: Sample session
L1 = 4 ;
2 f = @( x ) 2 0 ;
g = @( x ) 0 ;
Sq = @( x ) s p l i t f u n c ( x , f , g , L1 ) ;
% Here we u s e N = 5 0 0 , nx = 10 and n t = 41 b u t e x p e r i m e n t w i t h
% different choices
7 p = H e a t D i r i c h l e t A p p r o x ( Sq , 5 0 0 , 1 0 , 4 1 , 1 2 1 , . 0 2 , L1 , 8 0 ) ;
Experiment with a variety of gridding strategies and the length of time until you get
a good plot of the decay of the solution.
Exercise 10.2.2 Solve the Heat equation using square wave data (L1 = 14) with
the diffusion constant to D = 0.4. Solve the model over an appropriate length of
time using a the gridding strategy you think is good. Use the split function as coded
below.
Experiment with a variety of gridding strategies and the length of time until you get
a good plot of the decay of the solution.
Exercise 10.2.3 Solve the Heat equation using square wave data (L1 = 4) with the
diffusion constant to D = 0.0004. Solve the model over an appropriate length of
time using a the gridding strategy you think is good. Use the split function as coded
below.
Experiment with a variety of gridding strategies and the length of time until you get
a good plot of the decay of the solution.
Reference 359
Reference
Let’s review the basics of information processing in a typical neuron. There are
many first sources for this material; some of them are Introduction to Neurobiology
(Hall 1992), Ionic Channels of Excitable Membranes (Hille 1992), Foundations of
Cellular Neurophysiology (Johnston and Wu 1995)], Rall’s review of cable theory in
the 1977 Handbook of Physiology (Rall 1977) and Cellular Biophysics: Transport
and Electrical Properties (Weiss 1996a, b).
Our basic model consists of the following structural elements: A neuron which
consists of a dendritic tree (which collects sensory stimuli and sums this information
in a temporally and spatially dependent way), a cell body (called the soma) and an
output fiber (called the axon). Individual dendrites of the dendritic tree and the axon
are all modeled as cylinders of some radius a whose length is very long compared
to this radius and whose walls are made of a bilipid membrane. The inside of each
cylinder consists of an intracellular fluid and we think of the cylinder as lying in a
bath of extracellular fluid. So for many practical reasons, we can model a dendritic
or axonal fiber as two concentric cylinders; an inner one of radius a (this is the actual
dendrite or axon) and an outer one with the extracellular fluid contained in the space
between the inner and outer membranes.
The potential difference across the inner membrane is essentially due to a balance
between the electromotive force generated by charge imbalance, the driving force
generated by charge concentration differences in various ions and osmotic pressures
that arise from concentration differences in water molecules on either side of the
membrane. Roughly speaking, the ions of importance in our simplified model are
the potassium K + , sodium Na+ and chloride Cl− ions. The equilibrium potential
across the inner membrane is about −70 millivolts and when the membrane potential
is driven above this rest value, we say the membrane is depolarized and when it is
driven below the rest potential, we say the membrane is hyperpolarized. The axon of
one neuron interacts with the dendrite of another neuron via a site called a synapse.
The synapse is physically separated into two parts: the presynaptic side (the side the
axon is on) and the postsynaptic side (the side the dendrite is on). There is an actual
physical gap, the synaptic cleft, between the two parts of the synapse. This cleft is
filled with extracellular fluid.
© Springer Science+Business Media Singapore 2016 361
J.K. Peterson, Calculus for Cognitive Scientists, Cognitive Science
and Technology, DOI 10.1007/978-981-287-880-9_11
362 11 Simplified Dendrite—Soma—Axon Information Processing
• Axonal and dendritic fibers are modeled as two concentric membrane cylinders.
• The axon carries action potentials which propagate without change along the fiber
once they are generated. Thus if an axon makes 100 synaptic contacts, we assume
that the depolarizations of each presynaptic membrane are the same.
• Each synaptic contact on the dendritic tree generates a time and space localized
depolarization of the postsynaptic membrane which is attenuated in space as the
11 Simplified Dendrite—Soma—Axon Information Processing 363
pulse travels along the fiber from the injection site and which decrease in magnitude
the longer the time is since the pulse was generated.
• The effect of a synaptic contact is very dependent on the position along the dendritic
fiber that the contact is made—in particular, how far was the contact from the axon
hillock (i.e., in our model, how far from the soma)? Contacts made in essentially the
same space locality have a high probability of reinforcing each other and thereby
possibly generating a depolarization high enough to trigger an action potential.
• The effect of a synaptic contact is very dependent on the time at which the contact
is made. Contacts made in essentially the same time frame have a high probability
of reinforcing each other and thereby possibly generating a depolarization high
enough to trigger an action potential.
We can model the above dendrite fiber reasonably accurately by using what is called
the core conductor model (see Fig. 11.1). We have gone over this before, but let’s
repeat it here so we can easily refer to it for this discussion. We assume the following:
• The dendrite is made up of two concentric cylinders. Both cylinders are bilayer
lipid membranes with the same electrical characteristics. There is conducting fluid
between both the inner and outer cylinder (extracellular solution) and inside the
inner cylinder (intracellular solution). These solutions are assumed homogeneous
and isotropic; in addition, Ohm’s law is valid within them.
• All electrical variables are assumed to have cylindrical symmetry; hence, all vari-
ables are independent of the traditional polar angle θ. In particular, currents in
the inner and outer fluids are longitudinal only (that is, up and down the dendritic
fiber). Finally, current through the membrane is always normal to the membrane
(that is the membrane current is only radial).
• A circuit theory description of currents and voltages is adequate for our model. At
a given position along the cylinder, the inner and outer conductors are at the same
potential (if you slice the cylinder at some point along its length perpendicular to
its length, all voltage measurements in the inner and outer solutions will have the
same voltage). The only radial voltage variation occurs in the membrane itself.
There are many variables associated with this model; although the model is very
simplified from the actual biological complexity, it is still formidably detailed. These
variables are described below:
z: the position of along the cable measured from some reference zero (m),
t: the current time (sec),
Io (z, t): the total longitudinal current flowing in the +z direction in the outer
conductor (amps),
Ii (z, t): the total longitudinal current flowing in the +z direction in the inner
conductor (amps),
Jm (z, t): the membrane current density in the inner conductor to the outer conduc-
tor (amp/m2 ),
Km (z, t): the membrane current per unit length from the inner conductor to the
outer conductor (amp/m),
Ke (z, t): the current per unit length due to external sources applied in a cylindri-
cally symmetric manner. So it we think of a presynaptic neuron’s axon
generating a postsynaptic pulse in a given postsynaptic neuron, we can
envision this synaptic contact occurring at some point z along the cable
and the resulting postsynaptic pulse as a Dirac delta function impulse
applied to the cable as a high current Ke which lasts for a very short time
(amp/m),
Vm (z, t): the membrane potential which is consider + when the inner membrane
is positive with respect to the outer one (volts),
Vi (z, t): the potential in the inner conductor (volts),
Vo (z, t): the potential in the outer conductor (volts),
ro : the resistance per unit length in the outer conductor (ohms/m),
ri : the resistance per unit length in the inner conductor (ohms/m),
a: the radius of the inner cylinder (m).
11.1 A Simple Model of a Dendrite: The Core Conductor Model 365
Careful reasoning using Ohm’s law and Kirchhoff’s laws for current and voltage
balance lead to the well-known steady state equations:
∂Ii ∂Io
= −Km (z, t), = Km (z, t) − Ke (z, t) (11.1)
∂z ∂z
∂Vi ∂Vo
= −ri Ii (z, t), = −ro Io (z, t), Vm = Vi − Vo (11.2)
∂z ∂z
These equations look at what is happening in the concentric cylinder model at equi-
librium; hence, the change in the potential across the inner membrane is due entirely
to the longitudinal variable z. From Eq. 11.2, we see
implying
∂ 2 Vm ∂Io ∂Ii
= ro − ri = (ri + ro )Km (z, t) − ro Ke (z, t).
∂z2 ∂z ∂z
∂ 2 Vm
= (ri + ro )Km (z, t) − ro Ke (z, t). (11.3)
∂z2
It is much more useful to look at this model in terms of transient variables which are
perturbations from rest values. We define
Vm (z, t) = Vm0 + vm (z, t), Km (z, t) = Km0 + km (z, t), Ke (z, t) = Ke0 + ke (z,
(11.4)
t)
where the rest values are respectively Vm0 (membrane rest voltage), Km0 (membrane
current per length base value) and Ke0 (injected current per length base value). With
the introduction of these transient variables, we are able to model the flow of current
across the inner membrane more precisely. We introduce the conductance per length
gm (Siemens/cm or 1/(ohms cm) and capacitance per length cm (fahrads/cm) of the
membrane and note that we can think of a patch of membrane as as simple RC circuit.
This leads to the transient cable equation
∂ 2 vm ∂vm
= (ri + ro )gm vm (z, t) + (ri + ro )cm − ro ke (z, t). (11.5)
∂z 2 ∂t
If we write the transient cable equation into an appropriate scaled form, we gain great
insight into how membrane voltages propagate in time and space relative to what
may be called fundamental scales. Define
366 11 Simplified Dendrite—Soma—Axon Information Processing
cm
τM = (11.6)
gm
1
λc = √ (11.7)
(ri + ro ) gm
Note that τM is independent of the geometry of the cable and depends only on
dendritic fiber characteristics. We will call τM the fundamental time constant (that is,
this constant determines how quickly a membrane potential decays to one half on its
initial value) of the solution for reasons we will see shortly. On the other hand, the
constant λc is dependent on the geometry of the cable fiber and we will find it is the
fundamental space constant of the system (that is, the membrane potential decays to
one half of its value within this distance along the cable fiber).
If we let CM and G M denote the capacitance and conductance per square cm of
the membrane, the circumference of the cable is 2πa and hence the capacitance and
conductance per length are given by
cm = 2πaCM (11.8)
gm = 2πaG M (11.9)
and we see clearly that the ratio τM is simply GCMM . This clearly has no dependence on
the cable radius showing yet again that this constant is geometry independent. We
note that the units of τM are in seconds. The space constant can be shown to have
units of cm and defining ρi to be the resistivity (ohm-cm) of the inner conductor, we
can show that
ρi
ri = . (11.10)
π a2
From this it follows that
1 1
λC = √ a2 . (11.11)
2ρi G M
Clearly, the space constant is proportional to the square root of the fiber radius and
the proportionality constant is geometry independent. Another important constant is
the Thévenin equivalent conductance, G ∞ , which is defined to be
gm
G ∞ = λC gm = . (11.12)
ri + ro
For most biologically plausible situations, the outer conductor resistance per unit
length is very small in comparison to the inner conductor’s resistance per unit length.
Hence, ri ro and Eq. 11.12 can be rewritten using Eqs. 11.9 and 11.10 to have
the form
11.1 A Simple Model of a Dendrite: The Core Conductor Model 367
gm 2G M 3
G∞ = =π a2 . (11.13)
ri ρi
which shows that G ∞ is proportional to the three halves power of the fiber radius
a with a proportionality constant which is geometry independent. With all this said,
we note that ri + ro = λ21g and hence, we can rewrite the transient cable equation
C m
as
∂ 2 vm ∂vm
λ2C = vm + τM − ro λ2C ke . (11.14)
∂z 2 ∂t
There are three important classes of solution to the properly scaled cable equation:
for the cases of an infinite, semi-infinite and finite length cable respectively; further,
we are interested in both time independent and dependent solutions, which we will
discuss in the next section. The three types of solution here are for the infinite, semi-
infinite and finite cable models. We model the applied current as a current impulse
of the form ke Ie δ(z − 0), where Ie is the magnitude of the impulse which is applied
at position z = 0 using the Dirac delta function δ(z − 0). The resulting steady state
equation is given by
d 2 vm
λ2C = vm − ro λ2C Ie δ(z − 0).
dz2
d 2 vm
λ2C = vm , ii (0) = Ie
dz2
where ii denotes the transient inner conductor current. This system has solution
368 11 Simplified Dendrite—Soma—Axon Information Processing
Ie − z
vm (z) = e λC
gm λC
ri + ro − z
= Ie e λC
gm
which we note is defined only for z ≥ 0. Note that the ratio vimi (0) (0)
reduces to the
Thévenin constant G ∞ . This ratio is current to voltage, so it has units of conductance.
Therefore, it is very useful to think of this ratio as telling us what resistance we see
looking into the mouth of the semi-infinite cable. While heuristic in nature, this will
give us a powerful way to judge the capabilities of dendritic fibers for information
transmission.
Finally, in the finite cable version, we consider a finite length, 0 ≤ z ≤ , of
cable with current Ie pumped in at z = and a conductance load of G e applied at the
far end z = . The cable can be thought of as a length of fiber whose two ends are
capped with membrane that is identical to the membrane that makes up the cable.
The load conductance G e represents the conductance of the membrane capping the
cable or the conductance of another cell body attached at that point. The system to
solve is now
d 2 vm
λ2C = vm , ii (0) = Ie , ii () = G e vm ().
dz2
ii (0)
with Thévenin equivalent conductance vm (0)
given by
sinh λC
+ Ge
G∞
cosh λC
G T () = G ∞ , 0 ≤ z ≤ . (11.17)
cosh λC
+ Ge
G∞
sinh λC
Now if the end caps of the cable are patches of membrane whose specific conductance
is the same as the rest of the fiber, the surface area of the cap is πa2 which is much
smaller than the surface of the cylindrical fiber, 2πa. Hence, the conductance of the
cylinder without caps is 2πaG M which is very large compared to the conductance
of a cap, πa2 G M . So little current will flow through the caps and we can approximate
this situation by thinking of the cap as an open circuit (thereby setting G e = 0). We
can think of this as the open-circuit case. Using Eqs. 11.16 and 11.17, we find
11.2 Time Independent Solutions to the Cable Model 369
−z
Ie cosh λC
vm (z) = , 0 ≤ z ≤ . (11.18)
G ∞ sinh
λC
G T () = G ∞ tanh , 0 ≤ z ≤ . (11.19)
λC
The cable equation for the normalized membrane voltage is a nice model of the
voltage on the excitable nerve cell dendrite which results from a voltage source
being applied to the dendritic cable. For zero-rate end cap conditions, the model,
as discussed and solved in Sect. 9.4, is stated below: which we have derived using
ideas from biology and physics.
∂ 2 vm (z, t) ∂vm
λ2C = vm (z, t) + τM , 0 ≤ z ≤ , t ≥ 0,
∂z2 ∂t
∂vm (0, t)
= 0,
∂z
∂vm (, t)
= 0,
∂z
vm (z, 0) = f (z), 0 ≤ z ≤ .
This is the general cable equation with β = λC and α = τ . We then normalized the
variables using the transformations
t z
τ = , λ= , L= ,
τM λC λC
v̂m = vm (λC λ, τM τ ).
∂ 2 v̂m ∂ v̂m
= v̂m + , 0 ≤ λ ≤ L, τ ≥ 0
∂λ2 ∂τ
∂ v̂m (0, τ )
=0
∂λ
∂ v̂m (L, τ )
= 0,
∂λ
v̂m (λ, 0) = fˆ (z), 0 ≤ λ ≤ L.
where fˆ = f (λC λ). Now denote the applied voltage at time zero by V (λ). Since, this
is the general cable equation with β = 1 and α = 1, the solution is
370 11 Simplified Dendrite—Soma—Axon Information Processing
∞
nπ 1+n2 π 2
−τ
v̂m (λ, τ ) = A0 e + An cos λ e− L2 τ .
n=1
L
with A − n = Bn with
L
1
B0 = f (x)dx,
L 0
L
2 nπ
Bn = f (x) cos x dx.
L 0 L
The functions un (λ) = cos(ωn λ) and the scalars ωn are known as the eigenvalues and
eigenfunctions of the differential equation operator—a fancy name for the model –
u with zero rate endcap boundary conditions. We haven’t called them this before
in our previous chapters on the separation of variables technique, but in a sense the
work we do here is very analogous to the usual eigenvalue/eigenvector analysis we
do for matrices. We can say a lot more about this in more advanced courses; in
particular we discuss this carefully in Peterson (2015a). However, that is beyond our
scope here. We wanted to mention this type of phrasing because we will need to
mention it in a bit when we actually try to solve the Ball Stick model. Anyway, for
this problem, the spatial eigenvalues are then β0 = 0 with eigenfunction u0 (λ) = 1
and βn = −ωn2 = − nLπ2 for any nonzero integer n with associated eigenfunctions
2 2
un (λ) = cos(ωn λ). It is also easy to redo our original analysis to shown that we can
use un (λ) = cos(ωn (L − λ)) as the eigenfunctions. Still in either case, there are an
infinite number of eigenvalues satisfying |βn | → ∞. Further, these eigenfunctions
are mutually orthogonal. The normalized eigenfunctions are then
1
û0 (λ) = √ ,
L
2
ûn (λ) = cos(ωn λ), n ≥ 1
L
or
1
û0 (λ) = √ ,
L
2
ûn (λ) = cos(ωn (L − λ)), n ≥ 1
L
It is easy to see that with our usual inner product, < ûn , ûn >= 1 for all integers
n ≥ 0. It is possible to show—again, the details are in other texts such as Peterson
(2015a)—that any continuous function f has the representation
∞
f (λ) = < f , ûn (λ) > ûn (λ
n=0
11.3 The Dendritic Voltage Model 371
which converges in the least squares sense. Recall we talked about these ideas in
Chap. 9 so you can go back there and review if you need to. When this is true, we
say these functions form a complete orthonormal sequence.
We can now extend our simple dendritic cable model to what is called the ball and
stick neuron model. This consists of an isopotential sphere to model the cell body or
soma coupled to a single dendritic fiber input line. We will model the soma as a simple
parallel resistance/ capacitance network and the dendrite as a finite length cable as
previously discussed (see Fig. 11.2). In Fig. 11.2, you see the terms I0 , the input
current at the soma/dendrite junction starting at τ = 0; ID , the portion of the input
current that enters the dendrite (effectively determined by the input conductance to the
finite cable, G D ); IS , the portion of the input current that enters the soma (effectively
determined by the soma conductance G S ); and CS , the soma membrane capacitance.
We assume that the electrical properties of the soma and dendrite membrane are the
same; this implies that the fundamental time and space constants of the soma and
dendrite are given by the same constant (we will use our standard notation τM and
λC as usual). It takes a bit of work, but it is possible to show that with a reasonable
zero-rate left end cap condition the appropriate boundary condition at λ = 0 is given
by
∂ v̂m ∂ v̂m
ρ (0, τ ) = tanh(L) v̂m (0, τ ) + (0, τ ) , (11.20)
∂λ ∂τ
where we introduce the fundamental ratio ρ = GGDS , the ratio of the dendritic conduc-
tance to soma conductance. For more discussion of the ball and stick model boundary
conditions we use here, you can look at the treatment in Rall (1977, Chap. 7, Sect. 2).
The full system to solve is therefore:
∂ 2 v̂m ∂ v̂m
= v̂m + , 0 ≤ λ ≤ L, τ ≥ 0. (11.21)
∂λ 2 ∂τ
∂ v̂m
(L, τ ) = 0, (11.22)
∂λ
∂ v̂m ∂ v̂m
ρ (0, τ ) = tanh(L) v̂m (0, τ ) + (0, τ ) . (11.23)
∂λ ∂τ
Since these ratios hold for all τ and λ, they must equal a common constant . Thus,
we have
d2u
= (1 + )u, 0 ≤ λ ≤ L, (11.24)
dλ2
dw
= w, τ ≥ 0. (11.25)
dτ
The boundary conditions then become
u (L) = 0
ρu (0) = (1 + ) tanh(L)u(0).
The only case where we can have non trivial solutions to Eq. 11.24 occur when
1+ = −α2 for some constant α. There are several cases to consider, but the details
are quite similar to those of the zero rate endcap case and so are not included. The
general solution to Eq. 11.24 is then of the form A cos(α(L − λ)) + B sin(α(L − λ)).
Since
we see
u (L) = −α B = 0,
and so B = 0. Then,
u(0) = A cos(αL)
u (0) = αA sin(αL)
A non trivial solution for A then requires α must satisfy the transcendental equation
tanh(L)
tan(αL) = −α = −κ(αL), (11.26)
ρ
where κ = tanh(L)
ρL
. The values of α that satisfy Eq. 11.26 give us the eigenvalue of our
original problem, = −1−α2 . The eigenvalues of our system can be determined by
the solution of the transcendental Eq. 11.26. This is easy to do graphically as you can
see in Fig. 11.3). It can be shown that the eigenvalues form a monotonically increasing
sequence starting with α0 = 0 and with the values αn approaching asymptotically
the values 2n−1
2
π. Hence, there are a countable number of eigenvalues of the form
n = −1 − αn2 leading to a general solution of the form
Hence, this system uses the pairs αn (the solution to the transcendental Eq. 11.26)
and cos[αn (L − λ)]. In fact, we can show by direct integration that for n = m,
L
cos(αn (L − λ)) cos(αm (L − λ)) ≈ 0
0
∞
v̂m (λ, τ ) = A0 e−τ + An cos(αn (L − λ))e−(1+αn )τ .
2
n=1
converges for the appropriate numbers An . To solve this model, for an applied con-
tinuous voltage pulse V to the cable we will want to expand V in terms of the
eigenfunctions and equate coefficients. That is, we would write
∞
V (λ) = V0 + Vn cos(αn (L − λ))
n=1
and match coefficients from the expansion of v̂m (λ, 0) given above. However, to do
that we need to know if any V can be written like this and to know that the expansion
of v̂m at τ = 0 is valid. Remember, that a family of functions is complete if we can
do this. Now our family of functions here is not orthogonal so we certainly can’t get
11.4 The Ball and Stick Model 375
Q
−τ
An cos(αn (L − λ))e−(1+αn )τ
2
v̂m (λ, τ ) = A0 e + (11.28)
n=1
∞
An cos(αn (L − λ))e−(1+αn )τ
2
+ (11.29)
n=Q+1
Since the spatial functions are approximately orthogonal, the computation of the
coefficients An for n > Q can be handled with a straightforward inner product
calculation. The calculation of the first Q coefficients must be handled as a linear
algebra problem.
There are several ways to solve the ball-stick cable equation with a time dependency.
One way to find a solution is to transform the cable equation into what is called
a diffusion equation. We then use the properties of the solution to the diffusion
equation and some variable transformations to obtain the cable solution. This is done
in Peterson (2015c). We will use the Separation of Variables technique as discussed
above here.
Let’s assume we are applying a spatially varying voltage V (λ) at τ = 0 to our
model. This means our full problem is
∂ 2 v̂m ∂ v̂m
= v̂m + , 0 ≤ λ ≤ L, t ≥ 0.
∂λ2 ∂τ
v̂m (λ, 0) = V (λ), τ ≥ 0
∂ v̂m
(L, τ ) = 0,
∂λ
∂ v̂m ∂ v̂m
ρ (0, τ ) = tanh(L) v̂m (0, τ ) + (0, τ ) .
∂λ ∂τ
376 11 Simplified Dendrite—Soma—Axon Information Processing
Q
v̂m (λ, τ ) = A0 e−τ + An cos(αn (L − λ))e−(1+αn )τ
2
n=1
for any choice of integer Q we wish. At τ = 0, to satisfy the desired applied voltage
condition, we must have
Q
v̂m (λ, 0) = A0 + An cos(αn (L − λ)).
n=1
Q
V (λ) = A0 + An cos(αn (L − λ)).
n=1
For convenience, let φi (λ) denote the function cos(αn (L − λ)), where φ0 (λ) = 1
always. Then, note for each integer i, 0 ≤ i ≤ Q, we have
L L
2 2
V (s) φi (s) ds = A0 φ0 (s) φi (s) ds
L 0 L 0
Q
2 L
+An φn (s) φi (s) ds
n=1
L 0
To make this easier to write out, we again use “inner product” < f , g > defined by
L
2
< f,g > = f (s)g(s) ds.
L 0
Using this new notation, we see we are trying to find constants A0 to AQ so that
11.5 Ball-Stick MatLab Solutions 377
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
< φ0 , φ0 > < φ1 , φ0 > · · · < φQ , φ0 > A0 < V, φ0 >
⎢ < φ0 , φ 1 > < φ 1 , φ 1 > · · · < φQ , φ1 > ⎥ ⎢ A1 ⎥ ⎢ < V, φ1 > ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ .. .. .. .. ⎥ ⎢ .. ⎥ ⎢ .. ⎥
⎢ . . . . ⎥ ⎢ . ⎥ ⎢ . ⎥
⎢ ⎥ ⎢ ⎥=⎢ ⎥
⎢ < φ0 , φi > < φ 1 , φi > · · · < φQ , φi > ⎥ ⎢ Ai ⎥ ⎢ < V, φi > ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ .. .. .. .. ⎥ ⎢ . ⎥ ⎢ .. ⎥
⎣ . . . . ⎦ ⎣ .. ⎦ ⎣ . ⎦
< φ0 , φQ > < φ 1 , φQ > · · · < φQ , φQ > AQ < V, φQ >
For convenience, call this coefficient matrix M and define the vectors B and D by
⎡ ⎤ ⎡ ⎤
A0 < V, φ0 >
⎢ A1 ⎥ ⎢ < V, φ1 > ⎥
⎢ ⎥ ⎢ ⎥
⎢ .. ⎥ ⎢ .. ⎥
⎢ . ⎥ ⎢ . ⎥
B=⎢ ⎢ Ai ⎥
⎥, D = ⎢
⎢ < V, φi > ⎥
⎥
⎢ ⎥ ⎢ ⎥
⎢ . ⎥ ⎢ .. ⎥
⎣ .. ⎦ ⎣ . ⎦
AQ < V, φQ >
M B = D.
and
sin((αn − αm )L) sin(αn L) cos(αm L)+ sin(αm L) cos(αn L)
=
2(αn − αm ) 2(αn + αm )
−κ (αn L) cos(αm L) cos(αn L) + κ (αm L) cos(αm L) cos(αn L)
=
2(αn + αm )
L
= −κ cos(αm L) cos(αn L).
2
and hence,
L
2
cos(αn (L − λ)) cos(αm (L − λ)) dλ = −2κ cos(αm L) cos(αn L).
L 0
2 L
sin((αm )L)
cos(αm (L − λ)) dλ = 2
L 0 αm L
sin(αm L)
2 = −2κ cos(αm L)
αm L
Hence, we conclude
L
2
cos(αm (L − λ)) = −2κ cos(αm L).
L 0
2 L
2 L
1 + cos(αn (L − λ))
cos2 (αn (L − λ)) dλ = dλ
L 0 L 0 2
1
= 1+ sin(αn L).
2αn L
11.5 Ball-Stick MatLab Solutions 379
4. n = m = 0: Finally, we have
L
2
dλ = 2.
L 0
where we use βi to denote αi L and the γi to replace the term 1 + 2α1i L sin(2αi L). For
example, if L = 5, ρ = 10 and Q = 5, we find with an easy MatLab calculation that
M is
which has a non zero determinant so that we can solve the required system.
λ0 +C
keC (s) ds = V ∗ .
λ0 −C
2 λ0 +C C
< keC , φ0 > = k (s) ds
L λ0 −C e
2
= V∗
L
380 11 Simplified Dendrite—Soma—Axon Information Processing
Thus, we use
2V ∗
< V ∗ δ(λ − λ0 ), φ0 > = .
L
Following previous discussions, we then find for any i larger than 0, that
2V ∗
< V ∗ δ(λ − λ0 ), φi > = cos(αi (L − λ0 )).
L
Therefore, for an impulse voltage applied to the cable at position λ0 of size V ∗ , we
find the constants we need by solving M B = D for
⎡ ⎤
1
⎢ cos(α1 (L − λ0 )) ⎥
⎢ ⎥
⎢ .. ⎥
V∗ ⎢⎢ . ⎥
⎥.
D=− ⎢ ⎥
2kL ⎢ cos(αi (L − λ 0 )) ⎥
⎢ .. ⎥
⎣ . ⎦
cos(αQ (L − λ0 ))
If we had two impulses applied, one at λ0 of size V0∗ and one at λ1 of size V1∗ , we can
find the desired solution by summing the solution to each of the respective parts. In
this case, we would find a vector solution B0 and B1 following the procedure above.
The solution at λ = 0, the axon hillock, would then be
Q
v̂m (0, τ ) = (B00 + B10 ) e−τ + (B0n + B1n ) cos(αn L) e−(1+αn )τ
2
n=1
To see how to handle the Ball and Stick model numerically with MatLab, we will
write scripts that do several things. We will try to explain, as best we can, the general
principles of our numerical modeling using home grown code rather than built in
MatLab functions. We need
1. A way to find Q eigenvalues numerically.
2. A routine to construct the matrix M we need for our approximations.
3. A way to solve the resulting matrix system for the coefficients we will use to build
our approximate voltage model.
To solve for the eigenvalues numerically, we will use root finding techniques. to solve
for the roots of
11.6 Ball and Stick Numerical Solutions 381
tanh(L)
tan(αL) + (αL) = 0.
ρL
for various choices of L and ρ. We know the roots we seek are always in the intervals
[ π2 , π], [ 3π
2
, 2π] and so on, so it is easy for us to find useful lower and upper bounds for
the root finding method. Since tan is undefined at the odd multiples of π2 , numerically,
it is much easier to solve instead
tanh(L)
sin(αL) + (αL) cos(αL) = 0.
ρL
The original finite difference Newton Method was for functions of one argument
and was discussed in Sect. 11.6.1. Hence, we will have to modify the MatLab code
for our purposes now. Our function f2(x,L,rho) depends on three parameters,
so we modify our feval statements to reflect this. The new code is pretty much
the same with each feval statement changed to add ,L,rho to the argument
list.
15 %
% Termination I n t e r v a l [ a , b ] has s i z e < t o l x
% | f ( approximate root ) | < t o l f
% Have e x c e e d e d nEvalsMax d e r i v a t i v e Evaluations
%
20 f a = f e v a l ( fName , a , L , rho ) ;
f b = f e v a l ( fName , b , L , rho ) ;
x = a;
f x = f e v a l ( fName , x , L , rho ) ;
d e l t a = s q r t ( eps ) ∗ abs ( x ) ;
25 f p v a l = f e v a l ( fName , x+d e l t a , L , rho ) ;
fpx = ( f p v a l −f x ) / d e l t a ;
nEvals = 1 ;
k = 1;
30 disp ( ’ ’)
d i s p ( ’ Step | k | a(k) | x(k) | b(
k) ’ )
d i s p ( s p r i n t f ( ’ Start | %6 d | %12.7 f | %12.7 f | %12.7 f ’ , k , a , x , b
));
while ( a b s ( a−b )>t o l x ) && ( a b s ( f x )> t o l f ) && ( n E v a l s<nEvalsMax ) | | (
n E v a l s ==1)
%[ a , b ] b r a c k e t s a r o o t and x=a o r x=b
35 c h e c k = S t e p I s I n ( x , f x , fpx , a , b ) ;
i f check
%Take Newton S t e p
x = x − fx / fpx ;
else
40 %Take a B i s e c t i o n S t e p :
x = ( a+b ) / 2 ;
end
f x = f e v a l ( fName , x , L , rho ) ;
f p v a l = f e v a l ( fName , x+d e l t a , L , rho ) ;
45 fpx = ( f p v a l −f x ) / d e l t a ;
n E v a l s = n E v a l s +1;
i f f a ∗ f x <=0
%t h e r e i s a r o o t i n [ a , x ] . Use r i g h t e n d p o i n t .
b = x;
50 fb = fx ;
else
%t h e r e i s a r o o t i n [ x , b ] . Bring in l e f t endpoint .
a = x;
fa = fx ;
55 end
k = k +1;
i f ( check )
d i s p ( s p r i n t f ( ’ Newton | %6 d | %12.7 f | %12.7 f | %12.7 f ’ , k , a
, x , b) ) ;
else
60 d i s p ( s p r i n t f ( ’ Bisection | %6 d | %12.7 f | %12.7 f | %12.7 f ’ , k , a
, x , b) ) ;
end
end
aF = a ;
bF = b ;
end
Let’s try running this for the first two eigenvalues. Here is the sesssion:
Now we will run this for 20 eigenvalues for L = 5 and ρ = 10 but we have com-
mented out the intermediate prints in GlobalNewtonFDTwo to save space! We
keep printing out the actual f 2 values just to make sure our numerical routines are
working like we want.
% s e t f i r s t column
f o r n = 2 :Q+1
M( 1 , n ) = 0 . 5 ∗ c o s (w( n ) ) ;
23 end
% s e t f i r s t row
f o r n = 2 :Q+1
M( n , 1 ) = 0 . 5 ∗ c o s (w( n ) ) ;
end
28 % s e t main b l o c k
f o r m=2:Q+1
f o r n = 2 :Q+1
i f m ˜= n
M(m, n ) = c o s (w(m) ) ∗ c o s (w( n ) ) ;
33 end
i f m == n
M(m,m) = −1/(4∗ kappa ) ∗ ( 1 + s i n ( 2 ∗w(m) ) / ( 2 ∗w(m) ) ) ;
end
end
38 end
Listing 11.8: Q = 6
Q = 6;
2 L = 5;
rho = 1 0 ;
z = FindRoots (Q, L , rho , 1 . 0 , 1 . 0 ) ;
n = 1 EV = 3 . 0 8 0 0 7 4 5 LB = 1.5707963 Error =
1.5092782
n 1 function value = − 0.0000000
7 o r i g i n a l function value = 0.0000000
n = 2 EV = 6 . 1 6 0 6 0 2 2 LB = 4.7123890 Error =
1.4482132
n 2 function value = − 0.0000000
o r i g i n a l function value = −0.0000000
n = 3 EV = 9 . 2 4 2 0 1 6 8 LB = 7.8539816 Error =
1.3880352
12 n 3 function value = − 0.0000000
o r i g i n a l function value = 0.0000000
n = 4 EV = 1 2 . 3 2 4 7 1 5 2 LB = 10.9955743 Error =
1.3291410
n 4 function value = 0.0000000
o r i g i n a l function value = 0.0000000
17 n = 5 EV = 1 5 . 4 0 9 0 4 3 6 LB = 14.1371669 Error =
1.2718767
n 5 function value = − 0.0000000
o r i g i n a l function value = 0.0000000
n = 6 EV = 1 8 . 4 9 5 2 8 8 4 LB = 17.2787596 Error =
1.2165288
n 6 function value = 0.0000000
22 o r i g i n a l function value = 0.0000000
M = FindM (Q, L , rho , z ) ;
Since we know that eventually, the roots or eigenvalues will become close to an odd
multiple of π2 , we see that the axon voltage which is v̂m (λ, 0) is
Q ∞
v̂m (λ, 0) = A0 + An cos(αn (L − λ)) + An cos(αn (L − λ))
n=1 n=Q+1
where Q + 1 is the value where the cos(αn L) = 0 within our tolerance choice. At
the Axon Hillock, λ = 0, we have
Q ∞
v̂m (0, 0) = A0 + An cos(αn L) + An cos(αn L)
n=1 n=Q+1
However, the terms past Q + 1 are zero and so our approximate solution at the axon
hillock at time 0 is just
Q
v̂m (0, 0) = A0 + An cos(αn L).
n=1
However, as time increases, the voltage wave initiated by impulse travels towards
the axon hillock. It dampens or attenuates as it goes. The magnitude of the depo-
larization or hyperpolarization seen at the axon hillock depends on the time we
wish to look at. Recall, the solution to our impulse at the axon hillock, λ = 0, is
given by
11.6 Ball and Stick Numerical Solutions 387
Q
v̂m (0, τ ) = A0 e−τ + An cos(αn L) e−(1+αn )τ
2
(11.30)
n=1
∞
An cos(αn L) e−(1+αn )τ .
2
+ (11.31)
n=Q+1
The strong damping given by e−(1+αn )τ for n > Q tells us these last terms are very
2
Q
v̂m (0, τ ) = A0 e−τ + An cos(αn L) e−(1+αn )τ .
2
(11.32)
n=1
The membrane voltage at the axon hillock is then the sum of the equilibrium voltage
VR (typically −70 mV) and v̂m (0, τ ). An interesting question is how do we estimate
Q? We did it with a short MatLab script.
Of course, we can’t really use this information! If you try to solve our approximation
problem using Q = 15918, you will probably do as we did and cause your laptop to
die in horrible ways. The resulting matrix M we need is 15918 × 15918 in size and
most of us don’t have enough memory for that! There are ways around this, but for
our purposes, we don’t really need to use a large value of Q.
First, we need to set up the data vector. We do this with the script
Next, we can use the linear system solvers we have discussed in Peterson (2015b).
To solve our system MB = D, we then use the LU decomposition and the lower and
upper triangular solvers as follows:
1. We find the LU decomposition of M.
2. Then, we compute apply Gaussian elimination to transform the system into lower
triangular form.
3. Finally, we use our upper triangular solver tool to find the solution.
11.6 Ball and Stick Numerical Solutions 389
A typical MatLab session would have this form for our previous L = 5, Q = 6
(remember, this gives us 7 values as the value 0 is also used in our solution), ρ − 10
for a pulse of size 200 administered at location λ = 2.5.
Q
V (λ, τ ) = B0 e−τ + Bn cos(αn (L − λ)) e−(1+αn )τ .
2
n=1
The axon hillock voltage is then V (0, τ ). We compute the voltage with the script
Fig. 11.4 Initial axon hillock voltage for pulse of size 100 at location 2.0. This uses the t = 0
values which possess least square solution artifacts
This generates the plot of Fig. 11.4. We are plotting the transient axon hillock voltage
versus time. Note we are using the computed axon hillock voltage over the entire time
interval [0, 5]. The least squares solution used at t = 0 is not very representative of
the true voltage. A better approximation is obtained by starting the plot one time value
up from zero: here, the index 1 in the t vector corresponds to 5/100 milliseconds.
This small amount of time allows some attenuation from the damped exponentials of
time to remove the least squares artifacts. We show this in Fig. 11.5. We can also plot
voltage versus distance. V evaluated at time 0 tells us how we have approximated
our impulse at location 2.0 of magnitude 100 as a function of distance along the
11.6 Ball and Stick Numerical Solutions 391
%
25 % get eigenvalue vector z
z = F i n d R o o t s (Q, L , rho , 1 . 0 , 1 . 0 ) ;
% get c o e f f i c i e n t matrix M
M = FindM (Q, L , rho , z ) ;
% compute d a t a v e c t o r f o r i m p u l s e
30 D = FindData (Q, L , rho , z , Vmax , l o c a t i o n ) ;
% S o l v e MB = D s y s t e m
[ Lower , Upper , p i v ] = GePiv (M) ;
y = L T r i S o l ( Lower ,D( p i v ) ) ;
B = U T r i S o l ( Upper , y ) ;
35 % check errors
E r r o r = Lower∗Upper∗B − D( p i v ) ;
D i f f = M∗B−D;
e = norm ( E r r o r ) ;
e2 = norm ( D i f f ) ;
40 d i s p ( s p r i n t f ( ’ norm of LU residual = %12.7 f norm of MB - D = %12.7 f ’ , e ,
e2 ) ) ;
% s e t d e n d r i t i c s p a t i a l and t i m e b o u n d s
% d i v i d e d e n d r i t i c t i m e i n t o 100 p a r t s
tau = l i n s p a c e ( 0 ,TD, 1 0 1 ) ;
% d i v i d e d e n d r i t i c s p a c e L i n t o 300 p a r t s
45 lambda = l i n s p a c e ( 0 , L , 3 0 1 ) ;
%
V = zeros (301 ,101) ;
A = z e r o s (Q, 1 ) ;
f o r n = 1 :Q
50 A( n ) = B( n+1) ;
end
% f i n d v o l t a g e a t s p a c e p o i n t l a m b d a ( s ) and t i m e p o i n t t a u ( t )
for s = 1:301
for t = 1:101
55 w = z ∗ ( L−lambda ( s ) ) ;
u = −(1+ z . ∗ z ) ∗ t a u ( t ) ;
V( s , t ) = B( 1 ) ∗ exp (− t a u ( t ) )+ d o t (A, c o s (w) . ∗ exp ( u ) ) ;
end
end
60 % axon h i l l o c k i s a t l a m b d a = 1
AH = V ( 1 , : ) ;
% p u l s e i s modeled a t i n i t i a l time by
Input = V( : , 1 ) ;
The new plot in Fig. 11.8 shows that the how the axon hillock voltage approximation
is altered by the use of more terms in the expansion. In this plot, we plot the voltages
starting at t = 0 so that all exhibit the least squares solution artifacts. We could
394 11 Simplified Dendrite—Soma—Axon Information Processing
eliminate them by starting the plots after one time tick as we do in Fig. 11.9. Higher
Q values are, of course, better although they cost more to compute.
We can also look at how the approximation to the pulse changes with Q in
Fig. 11.10 starting at t = 0 and after one time tick in Fig. 11.11.
11.6 Ball and Stick Numerical Solutions 395
Now let’s look at what happens with several pulses. We have a pulse of 100 at 2.0,
one of 300 at 4.5. The code is as follows:
Q = 40;
L = 5;
rho = 1 0 ;
4 TD = 5 . 0 ;
Vmax1 = 1 0 0 ;
location1 = 2.0;
[ tau , lambda , V1 , AH1, I n p u t 1 ] = G e t A x o n H i l l o c k 2 (Q, L , TD, rho , Vmax1 ,
location1 ) ;
396 11 Simplified Dendrite—Soma—Axon Information Processing
Vmax2 = 3 5 0 ;
9 location2 = 4.5;
[ tau , lambda , V2 , AH2, I n p u t 2 ] = G e t A x o n H i l l o c k 2 (Q, L , TD, rho , Vmax2 ,
location2 ) ;
The axon hillock voltage for the second pulse starting with time at one time tick is
seen in Fig. 11.12. We also show the pulse itself in Fig. 11.13.
Finally, we add the responses together in Fig. 11.14 and the inputs in Fig. 11.15.
Let’s compute the axon—hillock voltage given above for a number of possible
choices. It is clear that the solution v̂m we obtain depends on
1. The length of the cable L.
2. The ratio of the dendritic to soma conductance, ρ.
3. The space constant λc as it depends on the cable radius a.
4. The truncation constant Q; we clearly make error by using only a finite number
of terms.
5. The values of α1 to αQ . These have to be determined numerically as the solution
of a transcendental equation as discussed in the text.
398 11 Simplified Dendrite—Soma—Axon Information Processing
With this said, let’s calculate the axon—hillock voltage for various given applied
voltages to the cable.
Exercise 11.7.1 Compute this voltage for sums of impulses voltages applied at inte-
ger spatial constant distances: λ = 0 to λ = L:
L
V (λ) = Vi∗ δ(λ − i).
i=0
Use the following voltage profiles and use a variety of values of Q to do the approx-
imations. Do these for the choices ρ ∈ {0.1, 1.0, 10.0}.
1. L = 1: Here V0∗ is applied at location 0.25 and V1∗ is applied at location 0.75.
(a) Use V0∗ = 10 and V1∗ = 0.
(b) Use V0∗ = 0 and V1∗ = 10.
(c) Use V0∗ = 100 and V1∗ = 0.
(d) Use V0∗ = 0 and V1∗ = 100.
2. L = 5: Here V0∗ is applied at location 0.25 and V5∗ is applied at location 4.75.
The others are applied at integer locations.
(a) Use V0∗ = 10, V1∗ = 0, V2∗ = 0, V3∗ = 0, V4∗ = 0 and V5∗ = 10
(b) Use V0∗ = 0, V1∗ = 0, V2∗ = 10, V3∗ = 0, V4∗ = 0 and V5∗ = 0
(c) Use V0∗ = 100, V1∗ = 0, V2∗ = 0, V3∗ = 0, V4∗ = 0 and V5∗ = 100
(d) Use V0∗ = 0, V1∗ = 0, V2∗ = 100, V3∗ = 0, V4∗ = 0 and V5∗ = 0
3. L = 10: Since the cable is so long, we will assume all Vi∗ are 0 except the ones
listed. Here V0∗ is applied at location 0.25 and V10
∗
is applied at location 9.75.
The others are applied at integer locations.
11.7 Ball Stick Project 399
• Use your judgment to provide reasonable plots of the information you have gath-
ered above.
• Can you draw any conclusions about how to choose Q, L and ρ for our modeling
efforts?
References
We now discuss the Hodgkin–Huxley model for the generation of the action potential
of an excitable nerve cell. We use the standard Ball and Stick model of Chap. 11.
As previously mentioned, there are many variables are needed to describe what is
happening inside and outside the cellular membrane, and to some extent, inside the
membrane for a standard cable model. There are many of them, so it doesn’t hurt
to keep repeating them! Standard references for this material are Johnston and Wu
(1995) and Weiss (1996a, b). These variables, their meanings and their units are given
in Table 12.1.
The salient variables needed to describe what is happening inside and outside the
cellular membrane and to some extent, inside the membrane are then
• Vm0 is the rest value of the membrane potential.
• Km0 is the rest value of the membrane current per length density.
• Ke0 is the rest value of the externally applied current per length density.
• Ii0 is the rest value of the inner current.
• Io0 is the rest value of the outer current.
• Vi0 is the rest value of the inner voltage.
• Vo0 is the rest value of the outer voltage.
• ri is the resistance of the inner fluid of the cable.
• ro is the resistance of the outer fluid surrounding the cable.
• gm is the membrane conductance per unit length.
• cm is the membrane capacitance per unit length.
The membrane voltage can be shown to satisfy the partial differential equation 12.1
which dimensional analysis shows has units of volts/(cm2 ).
∂ 2 Vm
= (ri + ro )Km − ro Ke (12.1)
∂z2
In the standard core conductor model, the membrane is not modeled at all, but we
now need to be more careful. A realistic description of how the membrane activity
contributes to the membrane voltage must use models of ion flow which are controlled
by gates in the membrane. A simple model of this sort is based on work that Hodgkin
and Huxley (1952), Hodgkin (1952, 1954) performed in the 1950s. We start by
expanding the membrane model to handle potassium, sodium and an all purpose
current, called leakage current, using a modification of our original simple electrical
circuit model of the membrane. We will think of a gate in the membrane as having
an intrinsic resistance and the cell membrane itself as having an intrinsic capacitance
as shown in Fig. 12.1. This is a picture of an idealized cell with a small portion
of the membrane blown up into an idealized circuit: we see a small piece of the
lipid membrane with an inserted gate. Thus, we expand the single branch of our
old circuit model to multiple branches—one for each ion flow we wish to model.
The ionic current consists of the portions due to potassium, KK , sodium, KNa and
leakage KL . The leakage current is due to all other sources of ion flow across the
membrane which are not being explicitly modeled. This would include ion pumps;
gates for other ions such as Calcium, Chlorine; neurotransmitter activated gates and
so forth. We will assume that the leakage current is chosen so that there is no excitable
neural activity at equilibrium. We are thus led to the model shown in Fig. 12.2. We
will replace our empty membrane box by a parallel circuit model. Now this box is
12 The Basic Hodgkin–Huxley Model 403
Km (z, t) Δz Km (z + Δz, t) Δz
ro Δz Ω ro Δz Ω ro Δz Ω
d c
Vo (z, t) Vo (z + Δz, t)
Io (z, t) Io (z + Δz, t)
Ke (z, t) Δz Ke (z + Δz, t) Δz
really a chunk of membrane that is z wide. In the first cable model, we assume our
membrane has a constant resistance and capacitance. We know that conductance is
reciprocal resistance, so our model will consist to a two branch circuit: one branch
is contains a capacitor and the other, the conductance element. We will let cm denote
the membrane capacitance density per unit length (measured in fahrad
cm
). Hence, in our
membrane box which is z wide, we see the value of capacitance should be cm z.
Similarly, we let gm be the conductance per unit length (measured in ohm−cm
1
) for the
membrane. The amount of conductance for the box element is thus gm z. In Fig. 12.3,
we illustrate our new membrane model. Since this is a resistance-capacitance parallel
circuit, it is traditional to call this an RC membrane model.
In Fig. 12.3, the current going into the element is Km (z, t)z and we draw the
rest voltage for the membrane as a battery of value Vm0 . We know that the membrane
current, Km , satisfies Eq. 12.2:
∂Vm
Km (z, t) = gm Vm (z, t) + cm (12.2)
∂t
404 12 The Basic Hodgkin–Huxley Model
In terms of membrane current densities, all of the above details come from modeling
the simple equation
Km = Kc + Kion
where Km is the membrane current density, Kc is the current through the capacitative
side of the circuit and Kion is the current that flows through the side of the circuit that
is modeled by the conductance term, gm . We see that in this model
∂Vm
Kc = cm , Kion = gm Vm
∂t
However, we can come up with a more realistic model of how the membrane activity
contributes to the membrane voltage by adding models of ion flow controlled by
gates in the membrane. We have not done this before. In this chapter, and subsequent
ones, we will study intensely increasingly more sophisticated versions that model the
membrane gates as well as diffusion processes inside the cell that contribute to ion
flow across the membrane. Our models will initially be based on work that Hodgkin
and Huxley performed in the 1950s.
12.1 Adding Ion Membrane Currents 405
∂Vm
Km = cm + KK + KNa + KL , (12.3)
∂t
where we have expanded the Kion term to include the contributions from the sodium
and potassium currents and the leakage current. The new equation for the membrane
voltage is thus
∂ 2 Vm
= (ri + ro )Km − ro Ke
∂z2
∂Vm
= (ri + ro ) cm + (ri + ro ) KK + (ri + ro ) KNa + (ri + ro ) KL − ro Ke
∂t
which can be simplified to what is seen in Eq. 12.5:
1 ∂ 2 Vm ro
= Km − Ke (12.4)
ri + ro ∂z2 ri + ro
∂Vm ro
= cm + KK + KNa + KL − Ke (12.5)
∂t ri + ro
In Fig. 12.4, we show an idealized cell with a small portion of the membrane blown up
into an idealized circuit. We see a small piece of the lipid membrane with an inserted
gate. We think of the gate as having some intrinsic resistance and capacitance. Now for
our simple Hodgkin–Huxley model here, we want to model a sodium and potassium
gate as well as the cell capacitance. So we will have a resistance for both the sodium
and potassium. In addition, we know that other ions move across the membrane due
to pumps, other gates and so forth. We will temporarily model this additional ion
current as a leakage current with its own resistance. We also know that each ion has
its own equilibrium potential which is determined by applying the Nernst equation.
The driving electromotive force or driving emf is the difference between the ion
equilibrium potential and the voltage across the membrane itself. Hence, if Ec is the
equilibrium potential due to ion c and Vm is the membrane potential, the driving
force is Vc − Vm . In Fig. 12.4, we see an electric schematic that summarizes what
we have just said. We model the membrane as a parallel circuit with a branch for
the sodium and potassium ion, a branch for the leakage current and a branch for
the membrane capacitance. From circuit theory, we know that the charge q across
a capacitor is q = C E, where C is the capacitance and E is the voltage across the
406 12 The Basic Hodgkin–Huxley Model
capacitor. Hence, if the capacitance C is a constant, we see that the current through
the capacitor is given by the time rate of change of the charge
dq dE
=C
dt dt
If the voltage E was also space dependent, then we would write E(z, t) to indicate its
dependence on both a space variable z and the time t. Then the capacitative current
would be
dq ∂E
=C
dt ∂t
From Ohm’s law, we know that voltage is current times resistance; hence for each
ion c, we can say
Vc = Ic Rc
where we label the voltage, current and resistance due to this ion with the subscript
c. This implies
1
Ic = Vc = G c Vc
Rc
voltage V and time t. This reflects the fact that the amount of current that flows
through the membrane for these ions is dependent on the voltage differential across
the membrane which in turn is also time dependent. The general functional form for
an ion c is thus
where appropriate powers of p and q are found to match known data for a given ion
conductance. We model the leakage current, IL , as
IL = gL (V (t) − EL )
where the leakage battery voltage, EL , and the conductance gL are constants that are
data driven. Hence, in terms of current densities, letting gK , gNa and gL respectively
denote the ion conductances per length, our full model would be
KK = gK (V − EK )
KNA = gNa (V − ENa )
KL = gL (V − EL )
1 ∂ 2 Vm ∂Vm ro
= cm + KK + KNa + KL − Ke
ri + ro ∂z 2 ∂t ri + ro
1 ∂ 2 Vm ∂Vm
= cm + gK (Vm − EK ) + gNa (Vm − ENa )
ri + ro ∂z 2 ∂t
ro
+ gL (Vm − EL ) − Ke
ri + ro
408 12 The Basic Hodgkin–Huxley Model
We assume that the voltage dependence of our activation and inactivation has been
fitted from data. Hodgkin and Huxley modeled the time dependence of these variables
using first order kinetics. They assumed a typical variable of this type, say , satisfies
for each value of voltage, V :
d(V )
= α (V ) (1 − (V )) − β (V ) (V )
dt
(0) = 0 (V )
Rewriting, we see
1 d α
= −
α + β dt α + β
(0) = 0
We let
1
τ =
α + β
α
∞ =
α + β
d
τ = ∞ −
dt
(0) = 0
∂ 2 Vm
=0
∂z2
12.3 The Voltage Clamped Protocol 409
The replacement of the partial derivatives with a normal derivative reflects the fact
that in the voltage clamped protocol, the membrane voltage depends only on the one
variable, time t. Since, cm is capacitance per unit length, the above equation can also
be interpreted in terms of capacitance, Cm , and currents, IK , INa , IL and an external
type current Ie . This leads to Eq. 12.7
dVm ro
Cm + IK + INa + IL − Ie = 0 (12.7)
dt ri + ro
the equation we need to solve under the voltage clamped protocol becomes Eq. 12.8.
dVm 1
= (−IK − INa − IL + IE ) (12.8)
dt CM
gNa (V ) = gNa
Max
MNA 3 (V ) HNA (V )
gK (V ) = gKMax MK 4 (V )
where the two activation variables, MNA and MK , and the one inactivation variable,
HNA , all satisfy the first order kinetics as we have discussed. Hence, we know
τMNA MNA (t) = (MNA )∞ − MNA
τHNA HNA (t) = (HNA )∞ − HNA
τMK MK (t) = (MK )∞ − MK
with
1
τMNA =
αMNA + βMNA
αMNA
(MNA )∞ =
αMNA + βMNA
410 12 The Basic Hodgkin–Huxley Model
1
τHNA =
αHNA + βHNA
αHNA
(HNA )∞ =
αHNA + βHNA
1
τMK =
αMK + βMK
αMK
(MK )∞ =
αMK + βMK
Further, the coefficient functions, α and β for each variable required data fits as
functions of voltage. These were determined to be
V + 35.0
αMNA = −0.10
e−0.1 (V +35.0) − 1.0
−(V +60.0)
βMNA = 4.0 e 18.0
Of course these data fits were obtained at a certain temperature and assumed values
for all the other constants needed. These other parameters are given in the units below
The Hodgkin–Huxley gates model of the membrane dynamics here thus consists of
the following differential equations:
dMNA
τMNA = (MNA )∞ − MNA
dt
dHNA
τHNA = (HNA )∞ − HNA
dt
12.4 The Hodgkin–Huxley Sodium and Potassium Model 411
dMK
τMK = (MK )∞ − MK
dt
dV IM − IK − INa − IL
=
dt CM
We note that at equilibrium there is no current across the membrane. Hence, the
sodium and potassium currents are zero and the activation and inactivation variables
should achieve their steady state values which would be m∞ , h∞ and n∞ computed
at the equilibrium membrane potential which is here denoted by V0 .
Now these dynamics are more difficult to solve than you might think. The sequence
of steps is this:
• Given the time t and voltage V compute
V + 35.0
αMNA = −0.10
e−0.1 (V +35.0) − 1.0
−(V +60.0)
βMNA = 4.0 e 18.0
αHNA = 0.07 e−0.05 (V +60.0)
1.0
βHNA =
(1.0 + e−0.1 (V +30.0) )
0.01 ∗ (V + 50.0)
αMK = − −0.1(V +50.0)
(e − 1.0)
−0.0125 (V +60.0)
βMK = 0.125 e
• Then compute the τ and steady state activation and inactivation variables
1
τMNA =
αMNA + βMNA
αMNA
(MNA )∞ =
αMNA + βMNA
412 12 The Basic Hodgkin–Huxley Model
1
τHNA =
αHNA + βHNA
αHNA
(HNA )∞ =
αHNA + βHNA
1
τMK =
αMK + βMK
αMK
(MK )∞ =
αMK + βMK
• Then compute the sodium and potassium potentials. In this model this is easy as
each is set only once since the internal and external ion concentrations always stay
the same and so Nernst’s equation only has to used one time. Here we use the
concentrations
[NA]o = 491.0
[NA]i = 50.0
[K]o = 20.11
[K]i = 400.0
gNa (V ) = gNa
Max
MNA 3 (V ) HNA (V )
gK (V ) = gKMax MK 4 (V )
Now here we will need the maximum sodium and potassium conductances gNa Max
and gKMax to finish the computation. These values must be provided as data and in
this model are not time dependent. Here we use
gNa
Max
= 120.0
gK = 36.0
Max
where we use suitable values for the leakage conductance and battery voltage
such as
gL = 0.0287
EL = −50.0
We generally obtain these values with the rest.m computation which we will
discuss later.
• Finally compute the total current
IT = INA + IK + IL
• We can now compute the dynamics of our system at time t and voltage V : we let
IE denote the external current to our system which we must supply.
dV IE − IT
=
dt CM
dMNA (MNA )∞ − MNA
=
dt τMNA
dHNA (HNA )∞ − HNA
=
dt τHNA
dMK (MK )∞ − MK
=
dt τMK
We encode the dynamics calculated above into a four dimensional vector f whose
components are interpreted as follows:
⎡ IE −IT ⎤
f [0] = CM
⎢ (MNA )∞ −MNA ⎥
⎢ f [1] = ⎥
⎢ τMNA ⎥
f =⎢ (HNA )∞ −HNA ⎥
⎢ f [2] = ⎥
⎣ τHNA ⎦
(MK )∞ −MK
f [3] = τMK
414 12 The Basic Hodgkin–Huxley Model
As an example of what we might do to solve this kind of a problem, we note that this
system can now be written in vector form as
dy
= f (t, y)
dt
y(0) = y0
⎡ IM −IT ⎤
CM
⎢ (MNA )∞ −MNA ⎥
⎢ ⎥
⎢ τMNA ⎥
f = ⎢ (HNA )∞ −HNA ⎥
⎢ ⎥
⎣ τHNA ⎦
(MK )∞ −MK
τMK
The hardest part is to encode all of this in the vector form. The dynamic component
f [0] is actually a complicated function of (MNA ), (HNA ) and (MK ) as determined by
the encoding sequence we have previously discussed. Hence, the calculation of the
dynamics vector f is not as simple as defining each component of f as a functional
expression. Now recall that the Runge–Kutta order 4 requires multiple vector function
f evaluations per time step so that there is no way around the fact that solving this
system numerically is expensive!
This MatLab is more complicated and it is worth your while to have review the
MatLab implementations we have discussed earlier. Simple code to manage our
solution of the Hodgkin–Huxley equations is given below. We simply integrate
the equations using a fixed time step repeatedly with a Runge–Kutta method of
order 4. This is not terribly accurate but it illustrates the results nicely nevertheless.
The MatLab code is organized as follows:
1. SolveSimpleHHOrig.m manages the action potential simulation. It calls
HHFixedRK.m to manage the solution of the model using the Runge–Kutta
approximation. We can do better than this in several ways. Right now, our dynam-
ics function does not have the form f (p, t, y) where p is a parameter vector which
allows us to pass in many convenient values each time the dynamics function
is called. We will fix that later. Also, we still use a fixed step size Runge–Kutta
method. We will use RKF5 code later so that we can use an adjustable step size
approach.
2. The code in HHFixedRK.m calls the implementation of Runge–Kutta order
2–4 in HHRKstep.m. RK code which does not have an adjustable step size
algorithm can handle sudden discontinuities in current inputs because there is
no error checking around the time point where the current suddenly jumps. In
our later RKF5 code, we will have to use modified current pulses which ramp
up quickly to their maximum value and then go down to their initial state in a
continuous way so that the errors can be calculated correctly. However, that is a
story for later.
3. The Runge–Kutta code must evaluate the dynamics function simpleHH.m many
times.
4. We also need to initialize the simulation to set the leakage currents to be 0; this
is done with the code in rest.m.
5. We also need to calculate Nernst voltages using the function IonBattery
Voltages which uses the function Nernst.
So here are the code snippets we need.
416 12 The Basic Hodgkin–Huxley Model
%
5 % We u s e a s i m p l e Runge−K u t t a scheme
% u s i n g t h e Matlab f u n c t i o n below :
%
% f i n d number o f i n t e r a t i o n s t o do
n = c e i l ( ( t f i n a l − t i n i t ) /h ) +1;
10 %
m NA = z e r o s ( 1 , n ) ;
h NA = z e r o s ( 1 , n ) ;
n K = zeros (1 ,n) ;
g Na = z e r o s ( 1 , n ) ;
15 g K = zeros (1 ,n) ;
V = zeros (1 ,n) ;
20 %
% store values in physical variables
%
V = yvals (1 ,1: n) ;
m NA = yvals (2 ,1: n) ;
25 h NA = yvals (3 ,1: n) ;
n K = yvals (4 ,1: n) ;
%
% Compute g Na and G K
30 %
for i = 1:n
u = m NA( i ) ∗m NA( i ) ∗m NA( i ) ∗h NA ( i ) ;
g NA ( i ) = g NAmax∗u ;
end
35
for i = 1:n
u = n K ( i ) ∗n K ( i ) ∗n K ( i ) ∗n K ( i ) ;
g K ( i ) = g Kmax ∗ u ;
end
40
end
In all of our calculations, we will need the equilibrium Nernst voltages for various
ions. We find these with a call to the function IonBatteryVoltages.
12.6 The Simple MatLab Implementation 417
% Rydberg ’ s C o n s t a n t
15 R = 8.31;
% K e l v i n Temperature ; c o n v e r t f a h r e n h e i t t o C e l s i u s
% d e f a u l t i s 9.3 Celsius
T = ( 5 / 9 ) ∗ (TF−32) ;
% Faraday ’ s c o n s t a n t
20 F = 9 . 6 4 9 e +4;
%
% Compute N e r n s t v o l t a g e s o f E K and E Na
% v o l t a g e = N e r n s t ( v a l e n c e , Temperature , InConc , OutConc )
%
25 % Sodium
% NA O = 4 9 1 . 0 ;
% NA I = 5 0 . 0 ;
ENA = N e r n s t ( 1 , T , NaIn , NaOut ) ;
% Potassium
30 % K O = 20.11;
% K I = 400.0;
EK = N e r n s t ( 1 , T , KIn , KOut ) ;
Now, the typical dynamics for the Hodgkin–Huxley model has the following form
in MatLab. It has input arguments of time, t, the current vector of y values and the
name of the function which calculates an external current, IE. We encode all of
the sodium and potassium gate model parameters directly into the function. This
makes the function one we have to edit every time we change any aspect of the
Hodgkin–Huxley gate models.
15 % y ( 2 ) = m NA
% y ( 3 ) = h NA
% y (4) = m K
aa
% IE = e x t e r n a l i n p u t
20 %
The dynamics vector here is four dimensional, so we set its size next.
We compute the Nernst battery voltages and set the maximum sodium and potassium
ion conductances.
% max c o n d u c t a n c e f o r NA
g NA bar = 1 2 0 . 0 ;
8
% max c o n d u c t a n c e f o r K
g K bar = 3 6 . 0 ;
14 end
sum = ( y ( 1 ) + 6 0 . 0 ) ∗ 0 . 0 1 2 5 ;
i f sum > 0
beta mK = 0 . 1 2 5 ∗ exp ( −sum ) ;
else
19 beta mK = 0 . 1 2 5 ∗ exp ( −sum ) ;
end
t m K = 1 . 0 / ( alpha mK+beta mK ) ;
m K infinity = alpha mK / ( alpha mK+beta mK ) ;
f (4) = ( m K i n f i n i t y − y ( 4 ) ) /t m K ;
24 %
% I K current
%
I K = g K b a r ∗ ( y ( 1 )−E K ) ∗y ( 4 ) ∗y ( 4 ) ∗y ( 4 ) ∗y ( 4 ) ;
8 %
% I L current
%
I l e a k = g l e a k ∗ ( y ( 1 )− E l e a k ) ;
We then set the cell capacitance, find the external input at this time and find the f(1)
term which gives the full cell dynamics.
Let’s change this, and at the same time make the code simpler and cleaner, by
introducing a more abstract model of the ion gates. The function used in the gate
models are all special cases of the of the general mapping F(Vm , p, q) with p ∈ 4
and q ∈ 2 defined by
p0 (Vm + q0 ) + p1
F(Vm , p, q) = .
ep2 (Vm +q1 ) + p3
For ease of exposition, here we will denote MNa by m, HNa by h and MK by n as,
historically, m, h and n have been used for these Hodgkin–Huxley models. The α
12.6 The Simple MatLab Implementation 421
The p and q parameters control the shape of the action potential in a complex way.
We will think of alterations in the (p, q) pair associated with a given α and/or β as
a way of modeling how passage of ions through the gate are altered by the addition
of various ligands. These effects may or may not be immediate. For example, the
alterations to the p and q parameters may be due to the docking of ligands which
are manufactured through calls to the genome in the cell’s nucleus. In that case,
there may be a long delay between the initiation of a second messenger signal to
the genome and the migration of the ligands to the outside of the cell membrane.
In addition, proteins can be made which bind to the inside of a gate and thereby
alter the ion flow. We understand that this type of modeling is not attempting to
explain the details of such interactions. Instead, we are exploring an approach for
rapid identification and differentiation of the signals due to various toxins. For now,
we assume our standard Hodgkin–Huxley model uses gNa Max
= 120, gKMax = 36.0 and
the classical α, β functions are labeled as the nominal values. Hence, all we need to
do is code the information below in a vector 0 given by
⎡ ⎤
G 0Na = 120.0
⎢ 0 ⎥
⎢ G K = 36.0 ⎥
⎢ α 0 ⎥
⎢ (pm ) {−0.10, 0.0, −0.1, −1.0} (pβm )0 {0.0, 4.0, 0.0556, 0.0} ⎥
⎢ ⎥
⎢ α 0 β ⎥
⎢ (ph ) {0.0, 0.07, 0.05, 0.0} (ph )0 {0.0, 1.0, −0.1, 1.0} ⎥
0 = ⎢
⎢ (pα )0
⎥
⎢ n {−0.01, 0.0, −0.1, −1.0} (pβn )0 {0.0, 0.125, 0.0125, 0.0} ⎥
⎥
⎢ α 0 ⎥
⎢ (qm ) {35.0, 35.0} (qmβ )0 {60.0, 60.0} ⎥
⎢ ⎥
⎢ α 0 β ⎥
⎣ (qh ) {60.0, 60.0} (qh )0 {30.0, 30.0} ⎦
(qnα )0 {50.0, 50.0} (qnβ )0 {60.0, 60.0}
This returns the three (α, β) pairs associated with the classical HH model as a
single vector α. We write the (p, q) values we need directly into this file. However,
if we wanted to implement a different gate model, we could easily either edit this
file or copy it to a new file and edit that. This gives us a more flexible way to do our
modeling. Our dynamics are given in the rewritten code simpleHH.m.
12.6 The Simple MatLab Implementation 423
% S t a n d a r d H o d g k i n − H u x l e y Model
% voltage mV
5 % current na
% time ms
% c o n c e n t r a t i o n mM
% conductance micro Siemens
% capacitance nF
10 % ===============================================
% y vector assignments
% ===============================================
% y (1) = V
% y ( 2 ) = m NA
15 % y ( 3 ) = h NA
% y (4) = m K
%
% set s i z e of f
%
20
f = zeros (1 ,4) ;
% ===============================================
% f vector assignments
25 % ===============================================
% y ( 1 ) = V dynamics
% y ( 2 ) = m NA d y n a m i c s
% y ( 3 ) = h NA d y n a m i c s
% y ( 4 ) = m K dynamics
30 %
% ================================================
% Constants for Equilibrium Voltage C a l c u l a t i o n s
% ===============================================
[ E K , E NA , T ] = I o n B a t t e r y V o l t a g e s ( 4 0 0 . 0 , 2 0 . 1 1 , 5 0 . 0 , 4 9 1 . 0 , 6 9 ) ;
35
% max c o n d u c t a n c e f o r NA
g NA bar = 1 2 0 . 0 ;
% max c o n d u c t a n c e f o r K
g K bar = 3 6 . 0 ;
40 %
a l p h a = GatesNAK ( ’ HHGates ’ , y ( 1 ) ) ;
%
% a c t i v a t i o n / i n a c t i v a t i o n p a r a m e t e r s f o r NA
% a l p h a ( 1 ) , a l p h a ( 2 ) a l p h a and b e t a f o r mna
45 % a l p h a ( 3 ) , a l p h a ( 4 ) a l p h a and b e t a f o r hna
% a l p h a ( 5 ) , a l p h a ( 6 ) a l p h a and b e t a f o r mk
% ================================================
% F a s t Sodium C u r r e n t
% ===============================================
50 %
m NA infinity = a l p h a ( 1 ) / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
t m NA = 1 . 0 / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
f (2) = ( m N A i n f i n i t y − y ( 2 ) ) /t m NA ;
%
55 h NA infinity = a l p h a ( 3 ) / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
t h NA = 1 . 0 / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
f (3) = ( h N A i n f i n i t y − y ( 3 ) ) / t h NA ;
I NA = g NA bar ∗ ( y ( 1 )−ENA) ∗y ( 2 ) ˆ3∗ y ( 3 ) ;
% ================================================
60 % Potassium Current
% ===============================================
%
m K infinity = a l p h a ( 5 ) / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
t m K = 1 . 0 / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
65 f (4) = ( m K i n f i n i t y − y ( 4 ) ) /t m K ;
I K = g K b a r ∗ ( y ( 1 )−EK) ∗y ( 4 ) ˆ 4 ;
424 12 The Basic Hodgkin–Huxley Model
%
% l e a k a g e c u r r e n t : run r e s t .m t o find appropriate g L value
%
70 g leak = .0084170;
E leak = −50.0;
%
% I L current
I l e a k = g l e a k ∗ ( y ( 1 )− E l e a k ) ;
75
%
% C e l l Capacitance
%
C M = 1.0;
80 s = f e v a l ( IE , t ) ;
% s = 0;
f ( 1 ) = ( s − I NA − I K − I l e a k ) /C M ;
The initial conditions for the activation and inactivation variables for this model
should be calculated carefully. When the excitable nerve cell is at equilibrium, with
no external current applied, there is no net current flow across the membrane. At this
point, the voltage across the membrane should be the applied voltage EM . Therefore,
0 = IT
= INA + IK1 + IL
= gNA
Max
(EM − ENA )(MNA )3∞ (HNA )∞ + gKMax (EM − EK ) (HNA )4∞
+ gL (EM − EL )
The two parameters, gL and EL , are used to take into account whatever ionic currents
flow across the membrane that are not explicitly modeled. We know this model does
not deal with various pumps, a variety of potassium gates, calcium gates and so
forth. We also know there should be no activity at equilibrium in the absence of an
external current. However, it is difficult to choose these parameters. So first, solve
to the leakage parameters in terms of the rest of the variables. Also, we can see that
the activation and inactivation variables for each gate at equilibrium will take on
the values that are calculated using the voltage EM . We can use the formulae given
in the Hodgkin–Huxley dynamics to compute the values of activation/inactivation
that occur when the membrane voltage is at rest, EM . We label these values with a
superscript r for notational convenience.
MNA
r
≡ (MNA )∞ (EM )
HNA ≡ (HNA )∞ (EM )
r
gL (EL − EM ) = INA
r
+ IKr
or
gL (EL − EM ) = INA
r
+ IKr
38 % a l p h a ( 1 ) , a l p h a ( 2 ) a l p h a and b e t a f o r mna
% a l p h a ( 3 ) , a l p h a ( 4 ) a l p h a and b e t a f o r hna
% a l p h a ( 5 ) , a l p h a ( 6 ) a l p h a and b e t a f o r mk
%
m NA0 = a l p h a ( 1 ) / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
43 h NA0 = a l p h a ( 3 ) / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
m K0 = a l p h a ( 5 ) / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
% I NA c u r r e n t , I K c u r r e n t
I NA = g NA bar ∗ (V R−E NA) ∗m NA0ˆ3∗h NA0 ;
I K = g K b a r ∗ (V R−E K ) ∗m K0 ˆ 4 ;
48 %
numerator = −I NA − I K ;
denominator = V R − E L ;
%
% compute g L : Note we want
53 % I NA + I K + g L ∗ ( V R − E L ) = 0
% w h i c h g i v e s t h e e q u a t i o n b e l o w a s s u m i n g we a r e g i v e n E L .
%
g L = −(I NA + I K ) / ( V R − E L ) ;
end
The code that manages the call to a fixed Runge–Kutta order method from an earlier
chapter has been modified to accept an argument which is the name of the function
which models the current injection.
The actual Runge–Kutta code was also modified to allow the name of the current
injection function to be entered as an argument.
For this simulation, we will use a Fahrenheit temperature of 69.0, a maximum sodium
conductance of 120.0 and a maximum potassium conductance of 36.0. There are a
few things we have to watch for when we run a simulation:
• The Celsius temperature is actually typed into the code files simpleHH.m and
rest.m. So changing this temperature means you have to edit and change a line in
both files.
• The maximum sodium and potassium conductances is hard coded into the file
simpleHH.m. So changing these values requires editing this files.
• Once values of temperature, maximum conductances and leakage voltage are cho-
sen, run rest.m to determine the value of gL that ensures no current flows across the
cell membrane when there is no external current. This function call also returns
the initial values for the Hodgkin–Huxley dynamical system. Lines like
allow us to find the initial condition for the Hodgkin–Huxley dynamical system
we want to solve. We find
12.6 The Simple MatLab Implementation 429
⎡ ⎤ ⎡ ⎤
y[1] V_R
⎢ y[2] ⎥ ⎢ m_NA0 ⎥
⎢ ⎥ ⎢ ⎥
⎣ y[3] ⎦ = ⎣ h_NA0 ⎦ .
y[4] m_K0
Then the value of gL returned must then be typed into the appropriate place in the
file simpleHH.m.
• Once the above steps have been done, we are ready to run the simulation.
We ran our simple simulation using this session (we edit a bit to shorten lines and so
forth):
This result uses the applied current given by the code IE.m. This pulse applies
a constant current of 100 namps between on the time interval [10.0, 10.62]. On
the interval [9.95, 10.0], the current ramps up from 0 to 100 and on the interval
[10.62, 10.67], the current moves smoothly from 100 back to 0. Otherwise, it is zero.
Hence, this is a continuous current pulse. In Fig. 12.5, we see the membrane voltage
versus time curve that results from the application of this injected current. Note we
see a nice action potential here. We show the corresponding sodium and potassium
conductances during this pulse in Fig. 12.6. In Fig. 12.7 we show the activation and
inactivation variables for sodium and in Fig. 12.8, we show the activation variable
for potassium.
430 12 The Basic Hodgkin–Huxley Model
Fig. 12.6 Sodium and potassium conductances versus time for gNA
max = 120 and g max = 36 for
K
impulse current
12.6 The Simple MatLab Implementation 431
It is also instructive to look at the ion currents and conductances during the pulses.
Simply compute and plot the currents with the following MatLab commands
In Fig. 12.9, we see the sodium and potassium currents plotted simultaneously. Note
that the sodium current is positive while the potassium current is negative. If you
look closely, you can see the potassium current lags behind the sodium one. Finally,
we can look at how the sodium and potassium gates action depends on voltage. They
are voltage dependent gates after all! The sodium conductance versus membrane
voltage is shown in Fig. 12.10 and the potassium conductance voltage curve is shown
in Fig. 12.11.
∞
In order to plot the τmNA and mNA values and so forth for our simulation, we have to
rewrite some code. We need to return all of the time constants and asymptotic values
so that we can generate plots. First, we need to modify the dynamics function.
Listing 12.20: Adding new variables to the dynamics to return more information:
simpleHHnew
1 f u n c t i o n [ f , z ] = simpleHHnew ( t , y , IE )
% S t a n d a r d H o d g k i n − H u x l e y Model
% voltage mV
% current na
% time ms
6 % c o n c e n t r a t i o n mM
% conductance micro Siemens
% capacitance nF
% ===============================================
% y vector assignments
11 % ===============================================
% y (1) = V
% y ( 2 ) = m NA
% y ( 3 ) = h NA
% y (4) = m K
16 % auxiliary variables
% z ( 1 ) = t m NA
% z (2) = m NA infinity
% z ( 3 ) = t h NA
% z (4) = h NA infinity
21 % z (5) = t m K
% z (6) = m K infinity
%
% set s i z e of f
%
26
f = zeros (1 ,4) ;
% ===============================================
% f vector assignments
31 % ===============================================
% y ( 1 ) = V dynamics
% y ( 2 ) = m NA d y n a m i c s
% y ( 3 ) = h NA d y n a m i c s
% y ( 4 ) = m K dynamics
36 %
% ================================================
% Constants for Equilibrium Voltage C a l c u l a t i o n s
% ===============================================
[ E K , E NA , T ] = I o n B a t t e r y V o l t a g e s ( 4 0 0 . 0 , 2 0 . 1 1 , 5 0 . 0 , 4 9 1 . 0 , 6 9 ) ;
41
% max c o n d u c t a n c e f o r NA
g NA bar = 1 2 0 . 0 ;
% max c o n d u c t a n c e f o r K
g K bar = 3 6 . 0 ;
12.7 Printing Additional Variables 435
46 %
a l p h a = GatesNAK ( ’ HHGates ’ , y ( 1 ) ) ;
%
% a c t i v a t i o n / i n a c t i v a t i o n p a r a m e t e r s f o r NA
% a l p h a ( 1 ) , a l p h a ( 2 ) a l p h a and b e t a f o r mna
51 % a l p h a ( 3 ) , a l p h a ( 4 ) a l p h a and b e t a f o r hna
% a l p h a ( 5 ) , a l p h a ( 6 ) a l p h a and b e t a f o r mk
% ================================================
% F a s t Sodium C u r r e n t
% ===============================================
56 %
m NA infinity = a l p h a ( 1 ) / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
t m NA = 1 . 0 / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
f (2) = ( m N A i n f i n i t y − y ( 2 ) ) /t m NA ;
%
61 h NA infinity = a l p h a ( 3 ) / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
t h NA = 1 . 0 / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
f (3) = ( h N A i n f i n i t y − y ( 3 ) ) / t h NA ;
I NA = g NA bar ∗ ( y ( 1 )−E NA) ∗y ( 2 ) ˆ3∗ y ( 3 ) ;
z (1) = m NA infinity ;
66 z (2) = t m NA ;
f (2) = ( m N A i n f i n i t y − y ( 2 ) ) /t m NA ;
z (3) = h NA infinity ;
z (4) = t h NA ;
f (3) = ( h N A i n f i n i t y − y ( 3 ) ) / t h NA ;
71 % ================================================
% Potassium Current
% ===============================================
%
m K infinity = a l p h a ( 5 ) / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
76 t m K = 1 . 0 / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
z (5) = m K infinity ;
z (6) = t m K;
f (4) = ( m K i n f i n i t y − y ( 4 ) ) /t m K ;
I K = g K b a r ∗ ( y ( 1 )−E K ) ∗y ( 4 ) ˆ 4 ;
81 %
% l e a k a g e c u r r e n t : run r e s t .m t o f i n d a p p r o p r i a t e g L v a l u e
%
g leak = .0084170;
E leak = −50.0;
86 %
% I L current
I l e a k = g l e a k ∗ ( y ( 1 )− E l e a k ) ;
%
91 % C e l l Capacitance
%
C M = 1.0;
% external current
96 s = f e v a l ( IE , t ) ;
%
f ( 1 ) = ( s − I NA − I K − I l e a k ) /C M ;
%
25 % store values in physical variables
%
V = yvals (1 ,1: n) ;
m NA = yvals (2 ,1: n) ;
h NA = yvals (3 ,1: n) ;
30 n K = yvals (4 ,1: n) ;
t m NA = zvals (1 ,1: n) ;
m NA infinity = zvals (2 ,1: n) ;
t h NA = zvals (3 ,1: n) ;
h NA infinity = zvals (4 ,1: n) ;
35 t m K = zvals (5 ,1: n) ;
m K infinity = zvals (6 ,1: n) ;
%
% Compute g Na and g K
40 %
for i = 1:n
u = m NA( i ) ∗m NA( i ) ∗m NA( i ) ∗h NA ( i ) ;
g NA ( i ) = g NAmax∗u ;
end
45
for i = 1:n
u = n K ( i ) ∗n K ( i ) ∗n K ( i ) ∗n K ( i ) ;
g K ( i ) = g Kmax ∗ u ;
end
Note we are now returning all of the time constants and asymptotic values for
each time step. To do this, we have to alter HHFixedRK.m to the new code
HHFixedRKnew.m.
12.7 Printing Additional Variables 437
∞
The values of τmNA and mNA versus time are plotted simultaneously in Fig. 12.12.
∞
We can also plot τm and mNA
NA
versus membrane voltage to see how they vary with
depolarization (Fig. 12.13).
Fig. 12.13 m time constant and asymptotic value versus membrane voltage
Let’s explore how much depolarization of the membrane at the axon hillock is needed
to initiate an action potential. For this experiment, we set the size of the pulse gener-
ated by IE.m to be zero and we solve the Hodgkin–Huxley equations for a series of
initial voltages that start at VR and slowly increase. In this Chapter, we have devel-
oped a simple model of how an action potential is generated when axon hillock of
the excitable nerve cell is depolarized. This is not much of a model, of course. Right
now, the depolarization is accomplished by setting the initial voltage to be VR +
for some depolarization or by injected a current IE into the membrane. We don’t
have a real model of an excitable nerve cell that consists of a dendritic cable, a soma
and an axon. That is the topic we address in Chap. 11 on neural processing.
[ g L , m N A i n f i n i t y , h N A i n f i n i t y , m K i n f i n i t y , E K , E NA ] = . . .
r e s t ( E L , V R , g NA bar , g K bar , p , f ) ;
% now s e t g L i n simpleHH .m
15 % s o l v e HH model f o r v a r i o u s axon h i l l o c k v o l t a g e s
% axon h i l l o c k = V R = −70
[ t v a l s , g NA0 , g K0 , V0 , m NA0 , h NA0 , n K0 ] = . . .
SolveSimpleHHOrig ( ’ simpleHH ’ , ’IE ’ , 0 , 1 0 0 . 0 , . . .
[ V R , m NA infinity , h NA infinity , m K infinity ] , . . .
20 0 . 0 1 , 4 , g NA bar , g K b a r ) ;
% axon h i l l o c k = V R = −69
[ t v a l s , g NA1 , g K1 , V1 , m NA1 , h NA1 , n K1 ] = . . .
SolveSimpleHHOrig ( ’ simpleHH ’ , ’IE ’ , 0 , 1 0 0 . 0 , . . .
[ V R+1 , m N A i n f i n i t y , h N A i n f i n i t y , m K i n f i n i t y ] , . . .
25 0 . 0 1 , 4 , g NA bar , g K b a r ) ;
% axon h i l l o c k = V R = −68
[ t v a l s , g NA2 , g K2 , V2 , m NA2 , h NA2 , n K2 ] = . . .
SolveSimpleHHOrig ( ’ simpleHH ’ , ’IE ’ , 0 , 1 0 0 . 0 , . . .
[ V R+2 , m N A i n f i n i t y , h N A i n f i n i t y , m K i n f i n i t y ] , . . .
30 0 . 0 1 , 4 , g NA bar , g K b a r ) ;
% axon h i l l o c k = V R = −67
...
% axon h i l l o c k = V R = −61
[ t v a l s , g NA9 , g K9 , V9 , m NA9 , h NA9 , n K9 ] = . . .
35 SolveSimpleHHOrig ( ’ simpleHH ’ , ’IE ’ , 0 , 1 0 0 . 0 , . . .
[ V R+9 , m N A i n f i n i t y , h N A i n f i n i t y , m K i n f i n i t y ] , . . .
0 . 0 1 , 4 , g NA bar , g K b a r ) ;
% axon h i l l o c k = V R = −60
[ t v a l s , g NA10 , g K10 , V10 , m NA10 , h NA10 , n K10 ] = . . .
40 SolveSimpleHHOrig ( ’ simpleHH ’ , ’IE ’ , 0 , 1 0 0 . 0 , . . .
[ V R+10 , m N A i n f i n i t y , h N A i n f i n i t y , m K i n f i n i t y ] , . . .
0 . 0 1 , 4 , g NA bar , g K b a r ) ;
% plot action potentials
p l o t ( t v a l s , V0 , t v a l s , V4 , . . .
45 t v a l s , V6 , t v a l s , V8 , . . .
t v a l s , V9 , t v a l s , V10 ) ;
% s e t l e g e n d , l a b e l s and s o f o r t h
% t h e l e g e n d i s one l i n e
l e g e n d ( ’ -70 mV ’ , ’ -66 mV ’ , ’ -64 mV ’ ,
50 ’ -62 mV ’ , ’ -61 mV ’ , ’ -60 mV ’ ) ;
x l a b e l ( ’ Time mS ’ ) ;
y l a b e l ( ’ Voltage mV ’ ) ;
t i t l e ( ’ Action Potential versus Time ’ ) ;
Now, in Fig. 12.14, you can see that the action potential is not initiated until the
depolarization is about 10 mV.
If we depolarize one more degree, we obtain Fig. 12.15. This shows clearly that
the additional degree causes the action potential to initiate much sooner.
12.9 Homework
Exercise 12.9.1 Run the Hodgkin–Huxley simulation as has been done in the work
above and write a complete report in your favorite editor which documents how an
action potential is generated using the plots and evidence obtained in the following
studies.
For all of these studies, we will use the current impulse defined by the code in
IE.m where you define the pulse appropriately.
Study One: maximum sodium conductance is 120 and maximum potassium con-
ductance is 36.0:
Study Two: maximum sodium conductance is 120 and maximum potassium con-
ductance is 36.0:
1. IE is as given in the text but change the pulse size to 400.
2. The plots of voltage, m_NA, h_NA and m_K versus time for 100 mSec.
3. The plots of the time constant and the asymptotic value for m_NA, h_NA and m_K
versus time.
4. The plots of the time constant and the asymptotic value for m_NA, h_NA and m_K
versus voltage.
5. The plots of the sodium and potassium conductance versus time.
6. The plots of the sodium and potassium conductance versus voltage.
7. The plots of sodium and potassium current versus time.
Study Three: maximum sodium conductance is 120 and maximum potassium con-
ductance is 16.0:
1. IE is as given in the text but change the pulse size to 800.
2. The plots of voltage, m_NA, h_NA and m_K versus time for 100 mSec.
3. The plots of the time constant and the asymptotic value for m_NA, h_NA and m_K
versus time.
4. The plots of the time constant and the asymptotic value for m_NA, h_NA and m_K
versus voltage.
5. The plots of the sodium and potassium conductance versus time.
6. The plots of the sodium and potassium conductance versus voltage.
7. The plots of sodium and potassium current versus time.
Study Four: maximum sodium conductance is 20.0 and maximum potassium con-
ductance is 3.6:
1. IE is as given in the text but change the pulse size to 400.
2. The plots of voltage, m_NA, h_NA and m_K versus time for 100 mSec.
3. The plots of the time constant and the asymptotic value for m_NA, h_NA and m_K
versus time overlaid on the plots from Study One and Study Two.
4. The plots of the time constant and the asymptotic value for m_NA, h_NA and m_K
versus voltage overlaid on the plots from Study One and Study Two.
5. The plots of the sodium and potassium conductance versus time overlaid on the
plots from Study One and Study Two.
6. The plots of the sodium and potassium conductance versus voltage overlaid on
the plots from Study One and Study Two.
7. The plots of sodium and potassium current versus time overlaid on the plots from
Study One and Study Two.
12.10 Another MatLab Implementation 443
We are now ready to integrate the ball stick model and our Hodgkin–Huxley model
in Matlab. We modify the existing MatLab code to reflect the fact that we are now
going to allow our dendritic model to provide the axon hillock voltage. We will need
to rewrite many of our original Hodgkin–Huxley functions in order to take advantage
of the ball-stick model for dendritic inputs. We also will now move to a more efficient
ODE solver: RKF5 which has automatic step size adjustment algorithms.
Recall, we introduced the general mapping F to encode our gate dynamics more
efficiently as defined by
p0 (Vm + q0 ) + p1
F(Vm , p, q) = .
ep2 (Vm +q1 ) + p3
under some choices of the parameter vectors p and q, these functions may be unde-
fined. However, if the numerator and denominator are both 0, this occurs when the
numerator N = p0 (Vm + q0 ) + p1 = 0 and the denominator D = ep2 (Vm +q1 ) + p3 = 0.
This gives two equations in the one unknown Vm . If these equations are consistent
call this critical voltage value Vm∗ .
To understand what to do here, we need another idea from the calculus of one
variable called L’Hopital’s rule. We only need the easy form but you can read up
about other variations and we encourage you to do so. Let’s assume we have two
functions f (x) and g(x) both of which are differentiable and both of which vanish
f (x)
at the value x ∗ . If we are interested in knowing the value of limx→x∗ g(x) how can
∗
we∗ find that out? The naive thing to do would be to plug x into the fraction getting
f (x )
g(x ∗ )
= 00 which is undefined. But we can figure this out by using the definition of
differentiability with error terms for both f and g. We have
f (x) f (x ∗ ) + f (x ∗ )(x − x ∗ ) + Ef (x − x ∗ )
lim∗ = lim∗
x→x g(x) x→x g(x ∗ ) + g (x ∗ )(x − x ∗ ) + Eg (x − x ∗ )
where we assume we are in the simplest case where both f (x ∗ ) and g (x ∗ ) are not
zero. We can still figure out what to do if one or both of them is zero, but we don’t
need that complication here. We know f (x ∗ ) and g(x ∗ ) are zero, so we have
f (x) f (x ∗ )(x − x ∗ ) + Ef (x − x ∗ )
lim∗ = lim∗ ∗
x→x g(x) x→x g (x )(x − x ∗ ) + Eg (x − x ∗ )
Ef (x−x ∗ )
f (x) f (x ∗ ) + (x−x ∗ )
lim = lim∗ Eg (x−x ∗ )
x→x ∗ g(x) x→x g (x ∗ ) +
(x−x ∗ )
Ef (x−x ∗ ) Ef (x−x ∗ )
Since f and g are differentiable, we know (x−x ∗ )
→ 0 and (x−x ∗ )
→ 0 as x → x ∗ .
Hence, we have
444 12 The Basic Hodgkin–Huxley Model
f (x) f (x ∗ )
lim∗ = ∗
x→x g(x) g (x )
f (x) f (x ∗ )
lim∗ = ∗
x→x g(x) g (x )
p0 −p0
lim F(Vm , p, q) = =
Vm →Vm∗ p2 ep2 (Vm +q1 ) p2 p3
∗
as ep2 (Vm +q1 ) = −p3 . Since the axon hillock voltage is a voltage spike, the incoming
voltages may cross this critical voltage value Vm∗ . Hence, we will rewrite the α and
β computations to be more careful to avoid division by zero. Such a division by zero
would introduce a discontinuity into our numerical solution with potential loss of
accuracy. Here is a more careful version of our previous HHGates code.
In this code, we handle the 00 case carefully. If the numerator and denominator of
F are both in the interval (−, ) for set equal to the tolerance tol = 1.0e-6,
we use the L’Hopital’s limiting value. Otherwise, depending on the signs of the
numerator and denominator values, we set the ±1 0
case to be 100 or −100. Finally,
if the numerator and denominator are both reasonable numbers, we simply calculate
the usual ratio. An incoming axon hillock voltage spike could easily be very large
and so we don’t want any of the α and β calculations to be undefined at some step
in the numerical process. We can then define α and β functions easily as follows.
30 F= { } ;
message = {} ’
F{1} = HHGatesGraph ( p ( 1 , : ) ,q (1 ,:) ) ;
message {1} = ’ alphaMNA ’ ;
F{2} = HHGatesGraph ( p ( 2 , : ) ,q (2 ,:) ) ;
35 message {2} = ’ betaMNA ’ ;
F{3} = HHGatesGraph ( p ( 3 , : ) ,q (3 ,:) ) ;
message {3} = ’ alphaHNA ’ ;
F{4} = HHGatesGraph ( p ( 4 , : ) ,q (4 ,:) ) ;
message {4} = ’ betaHNA ’ ;
40 F{5} = HHGatesGraph ( p ( 5 , : ) ,q (5 ,:) ) ;
message {5} = ’ alphaMK ’ ;
F{6} = HHGatesGraph ( p ( 6 , : ) ,q (6 ,:) ) ;
message {6} = ’ betaMK ’ ;
To graph and then remove all these plots, a typical session would be as follows:
The plots for our typical Hodgkin–Huxley model are shown in Figs. 12.16a, b,
12.17a, b and 12.18a, b for a voltage range of −200 to 200 mV. In the simulations to
come, we will be using these improved α–β calculations.
12.10 Another MatLab Implementation 447
approximate the pulse with a six times differentiable function, but this suffices for
now.
15 i e = ( Imax1 / ( t s 2 − t s 1 ) ) ∗ ( t − t s 1 ) ;
e l s e i f t>t s 2 & t < t e 1
i e = Imax1 ;
e l s e i f t >= t e 1 & t < t e 2
i e = Imax1 −(Imax1 / ( t e 2 −t e 1 ) ) ∗ ( t −t e 1 ) ;
20 e l s e i f t >= t s 3 & t <= t s 4
i e = ( Imax2 / ( t s 4 − t s 3 ) ) ∗ ( t − t s 3 ) ;
e l s e i f t>t s 3 & t < t e 3
i e = Imax2 ;
e l s e i f t >= t e 3 & t < t e 4
25 i e = Imax2 −(Imax2 / ( t e 4 −t e 3 ) ) ∗ ( t −t e 3 ) ;
end
The new dynamics function is given in Listing 12.32. We are handling the para-
meter p differently here also. We now want to send in numerical data and string data.
We do this as follows. We create a data structure p having two parts, p.a for the
numerical data, and p.b for the string data. We can then access the elements of p.a
as usual, p.a(1), p.a(2) and so forth. The syntax p.b will give us the string
name we need.
p . a (1)
a n s = −75.607
EK = p . a (1) ;
12.10 Another MatLab Implementation 451
41 ENA = p . a (2) ;
% l e a k a g e c u r r e n t : run r e s t .m t o f i n d a p p r o p r i a t e g L v a l u e
% d e f a u l t E l e a k = −50.0
E leak = p . a (3) ;
g leak = p . a (4) ;
46 % max c o n d u c t a n c e f o r NA: d e f a u l t i s 120
g NA bar = p . a ( 5 ) ;
% max c o n d u c t a n c e f o r K: d e f a u l t i s 3 6 . 0
g K bar = p . a (6) ;
gatename = p . b ;
51
f = zeros (4 ,1) ;
% ==============================================
% f vector assignments
56 % ==============================================
% y ( 1 ) = V dynamics
% y ( 2 ) = m NA d y n a m i c s
% y ( 3 ) = h NA d y n a m i c s
% y ( 4 ) = m K dynamics
61 %
a l p h a = GatesNAK ( gatename , y ( 1 ) ) ;
%
% a c t i v a t i o n / i n a c t i v a t i o n p a r a m e t e r s f o r NA
% a l p h a ( 1 ) , a l p h a ( 2 ) a l p h a and b e t a f o r mna
66 % a l p h a ( 3 ) , a l p h a ( 4 ) a l p h a and b e t a f o r hna
% a l p h a ( 5 ) , a l p h a ( 6 ) a l p h a and b e t a f o r mk
%
m NA infinity = a l p h a ( 1 ) / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
t m NA = 1 . 0 / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
71 f (2) = ( m N A i n f i n i t y − y ( 2 ) ) /t m NA ;
%
h NA infinity = a l p h a ( 3 ) / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
t h NA = 1 . 0 / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
f (3) = ( h N A i n f i n i t y − y ( 3 ) ) / t h NA ;
76 I NA = g NA bar ∗ ( y ( 1 )−ENA) ∗y ( 2 ) ˆ3∗ y ( 3 ) ;
%
m K infinity = a l p h a ( 5 ) / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
t m K = 1 . 0 / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
f (4) = ( m K i n f i n i t y − y ( 4 ) ) /t m K ;
81 I K = g K b a r ∗ ( y ( 1 )−EK) ∗y ( 4 ) ˆ 4 ;
% I L current
I l e a k = g l e a k ∗ ( y ( 1 )− E l e a k ) ;
% C e l l Capacitance
C M = 1.0;
86 % f u l l dynamics
s 1 = IE2 ( t ) ;
f ( 1 ) = ( s 1 − I NA − I K − I l e a k ) /C M ;
end
The code to manage the solution of the ODE is then given below in Listing 12.33.
452 12 The Basic Hodgkin–Huxley Model
%
% fname dynamics f u n c t i o n
6 % q p a r a m e t e r v e c t o r f o r RKF5 s e t t i n g s
% p p a r a m e t e r v e c t o r f o r HH d y n a m i c s
% t0 i n i t i a l time
% tf f i n a l time
% yinit initial state
11 % hinit initial stepsize
%
% We u s e RKF5
%
% p parameter assignments
16 %
% p . a ( 1 ) = EK, t h e p o t a s s i u m b a t t e r y v o l t a g e
% p . a ( 2 ) = ENA i s t h e sodium b a t t e r y v o l t a g e
% p . a ( 3 ) = EL , t h e l e a k a g e v o l t a g e
% p . a ( 4 ) = GL, t h e l e a k a g e c o n d u c t a n c e
21 % p . a ( 5 ) = g NA bar , maximum sodium c o n d u c t a n c e
% p . a ( 6 ) = g K b a r , maximum p o t a s s i u m c o n d u c t a n c e
%
% To u s e
% p . a = [ EK ;ENA; EL ; GL ; g N A b a r ; g K b a r ] ;
26 % p . b = ’ name o f t h e g a t e d y n a m i c s f u n c t i o n ’ ;
%
% q parameter assignments
%
% q (1) = errortol , step s i z e tolerance
31 % q (2) = steptol , step s iz e tolerance
% q ( 3 ) = m i n s t e p , minimum a l l o w a b l e s t e p s i z e
% q ( 4 ) = maxstep , maximum a l l o w a b l e s t e p s i z e
%
% To u s e
36 % q = [ e r r o r t o l ; s t e p t o l ; minstep ; maxstep ]
%
% i n i t i a l y values
%
% y (1) = V
41 % y ( 2 ) = m NA
% y ( 3 ) = h NA
% y (4) = m K
%
% To u s e
46 % y i n i t = [ V0 ; m NA0 ; h NA0 ; m K0 ]
%
EK = p . a (1) ;
ENA = p . a (2) ;
EL = p . a (3) ;
51 GL = p . a (4) ;
g NA bar = p . a ( 5 ) ;
g K bar = p . a ( 6 ) ;
%
errortol = q(1) ;
56 steptol = q(2) ;
minstep = q ( 3 ) ;
maxstep = q ( 4 ) ;
%
% Compute g Na and G K
71 %
g NA = g NA bar ∗m NA. ∗m NA. ∗m NA. ∗ h NA ;
g K = g K b a r ∗n K . ∗ n K . ∗ n K . ∗ n K ;
end
12.11 More Action Potentials 453
Let’s examine how an action potential is generated with this model. We can inject
both a current using the function IE2.m and apply an axon hillock voltage using the
techniques from Chap. 11. For our work in this section, we will not use an external
current so we will set IE2.m to be always 0. Then, for a given dendritic pulse at
some location, we use the function GetAxonHillock2 given in Listing 12.34.
50 u = −(1+ z . ∗ z ) ∗ t a u ( t ) ;
V( s , t ) = B( 1 ) ∗ exp (− t a u ( t ) )+ d o t (A, c o s (w) . ∗ exp ( u ) ) ;
end
end
% axon h i l l o c k i s a t l a m b d a = 1
55 AH = V ( 1 , : ) ;
% p u l s e i s modeled a t i n i t i a l time by
Input = V( : , 1 ) ;
A typical voltage trace generated by an impulse of size 1100 at location 3.0 is seen in
Fig. 12.19. This was generated by the following lines in MatLab. First, we generate
the axon hillock voltage trace.
The transient axon hillock voltage is shown in Fig. 12.19. The axon hillock voltage
is then VR + AH which for us is −70 + AH(τ ).
Then, we calculate the action potential corresponding to various axon hillock
voltages. We choose a dendritic time, τ , and use the value of the axon hillock voltage,
AH(τ ), to be the initial value in the HH simulation. Here are the MatLab lines to do
that.
As this current flows into the membrane, the membrane begins to depolarize. The
current flow of sodium and potassium through the membrane is voltage dependent and
so this increase in the voltage across the membrane causes changes in the ion gates.
Using V0 = −70 + AH(0), we generate the action potential shown in Fig. 12.20.
Recall that in the ion current equations the nonlinear conductance is modeled by
To see how the sodium current activates first and then the potassium current, we can
plot the absolute value of INa and IK simultaneously. This is done in Fig. 12.22. The
time interval here is setup with a linspace command dividing 30 mS into 300 equal
parts. So to see the currents better, we will plot them on the time interval [3.5, 20.0]
which is time tick 35 to 200.
We can study the activation and inactivation terms more closely using some carefully
chosen plots. We show the plot of MNA in Fig. 12.23 and HNA in Fig. 12.24.
Finally, the potassium activation MK is shown in Fig. 12.25.
458 12 The Basic Hodgkin–Huxley Model
Of even more interest is the products that are proportional to the sodium and
potassium current. We plot MNA 3 HNA versus time in Fig. 12.26 and MK 4 ’s time
trace in Fig. 12.27.
We note that if we apply a voltage pulse at a location further from the axon
hillock, say at location 3, we will not generate an action potential! In this chapter, we
have started to put together our models: we have a simple ball stick neuron model
which couples voltage pulses applied to the dendritic cable to a simple cell body.
We assume the resulting membrane voltage at the junction of the dendrite and the
cell body is available without change at the axon hillock which is potentially on the
other side of the cell body. From Fig. 12.19, we know the voltage we seen at the axon
hillock varies with time. In the simulations in this Chapter, we have chosen a time
(usually time tick 2 which corresponds to a time of 0.1 time constants) and used the
12.11 More Action Potentials 459
axon hillock voltage there as our depolarizing input to the Hodgkin–Huxley model.
Clearly, we could use other starting values from the axon hillock voltage time trace.
Each of these values may or may not trigger an action potential. The neurobiology
of the axon sends a voltage wave backwards through the axon hillock at each time
also. If an action potential is generated, this backward potential hyperpolarizes the
dendritic cable and effectively shuts down depolarization for some time. This is the
well-known refractory period for an excitable neuron. We are not ready to model
these effects yet.
460 12 The Basic Hodgkin–Huxley Model
12.11.1 Exercise
Exercise 12.11.1 Run the Hodgkin–Huxley simulation as has been done in the work
above and write a complete report in your favorite editor which includes the following
things: For this study, we use the maximum sodium conductance is 120, the maximum
potassium conductance is 36, the leakage voltage is −50 with temperature 70 degrees
Fahrenheit. We will use IM is zero always. Then, find
1. The plots of voltage V , MNA , HNA and MK versus time for 20 milliseconds.
2. The plots of the time constant and the asymptotic value for MNA , HNA and MK
versus time.
3. The plots of MNA 3 HNA and MK 4 versus time.
4. The plots of sodium and potassium current versus time.
for the following applied voltage pulses on a cable of length 5 with ρ = 10. Use
suitable Q for the following pulses:
1. Pulse of size 300 at 1.5.
2. Pulse of size 200 at 2.0 and 100 at 1.0.
3. Pulse of size 300 at 4.0 and 200 at 1.0.
Exercise 12.11.2 Run the Hodgkin–Huxley simulation as has been done in the work
above and write a complete report in your favorite editor which includes the following
things: For this study, we use the maximum sodium conductance is 120, the maximum
potassium conductance is 36, the leakage voltage is −50 with temperature 70 degrees
Fahrenheit. We will still use IM is zero always. Then, find
1. The plots of voltage V , MNA , HNA and MK versus time for 20 milliseconds.
2. The plots of the time constant and the asymptotic value for MNA , HNA and MK
versus time.
12.11 More Action Potentials 461
Exercise 12.11.3 Run the Hodgkin–Huxley simulation as has been done in the work
above and write a complete report in your favorite editor which includes the following
things: For this study, we use the maximum sodium conductance is 120, the maximum
potassium conductance is 36, the leakage voltage is −50 with temperature 70 degrees
Fahrenheit. We will still use IM is zero always. Then, find
1. The plots of voltage V , MNA , HNA and MK versus time for 20 milliseconds.
2. The plots of the time constant and the asymptotic value for MNA , HNA and MK
versus time.
3. The plots of MNA 3 HNA and MK 4 versus time.
4. The plots of sodium and potassium current versus time.
for the following applied voltage pulses on a cable of length 5 with ρ = 0.1. Use
suitable Q for the following pulses:
1. Pulse of size 300 at 1.5.
2. Pulse of size 200 at 2.0 and 100 at 1.0.
3. Pulse of size 300 at 4.0 and 200 at 1.0.
Exercise 12.11.4 Run the Hodgkin–Huxley simulation as has been done in the work
above and write a complete report in your favorite editor which includes the following
things: For this study, we use the maximum sodium conductance is 120, the maximum
potassium conductance is 36, the leakage voltage is −50 with temperature 70 degrees
Fahrenheit. We will still use IM is zero always. Then, find
1. The plots of voltage V , MNA , HNA and MK versus time for 20 milliseconds.
2. The plots of the time constant and the asymptotic value for MNA , HNA and MK
versus time.
3. The plots of MNA 3 HNA and MK 4 versus time.
4. The plots of sodium and potassium current versus time.
for the following applied voltage pulses on a cable of length 1 with ρ = 10.0. Use
suitable Q for the following pulses:
1. Pulse of size 300 at 1.0.
2. Pulse of size 200 at 1.0 and 100 at 0.6.
462 12 The Basic Hodgkin–Huxley Model
Let’s redo our code to allow sequences of pulses to enter the dendritic system of an
excitable nerve cell. First, we will rewrite our GetAxonHillock code to return
our approximate solution to the ball-stick model as a function of the two variables
spatial distance along the dendrite and local dendrite time. Most of the code below
is standard and has been discussed already. However, in this code we do two new
things: first, as mentioned, we return the solution V as a function of two variables
and second, we generate a plot of this solution as a surface. The returned axon hillock
function is generated as follows:
Note, we print out the graph as a portable network graphic file for inclusion in our
documentation. The full code is then given below.
12.12 Action Potential Dynamics 463
37 % s e t s p a t i a l and t i m e b o u n d s
V = @( s , t ) B( 1 ) ∗ exp (− t ) ;
f o r n=1:Q
V = @( s , t ) (V( s , t ) + B( n+1)∗ c o s ( z ( n ) ∗ ( L − s ) ) . ∗ exp (−(1+ z ( n ) ˆ 2 ) ∗ t ) ) ;
end
42
%
% draw s u r f a c e f o r g r i d [ 0 , L ] x [ 0 , 5 ]
% s e t up s p a c e and t i m e s t u f f
space = l i n s p a c e (0 ,L,101) ;
47 time = l i n s p a c e ( 0 , 5 , 1 0 1 ) ;
% s e t up g r i d o f x and y p a i r s ( s p a c e ( i ) , t i m e ( j ) )
[ Space , Time ] = m e s h g r i d ( s p a c e , t i m e ) ;
% s e t up s u r f a c e
Z = V( Space , Time ) ;
52
%p l o t s u r f a c e
figure
mesh ( Space , Time , Z , ’ EdgeColor ’ , ’ black ’ ) ;
x l a b e l ( ’ Dendrite Cable axis ’ ) ;
57 y l a b e l ( ’ Time axis ’ ) ;
z l a b e l ( ’ Voltage ’ ) ;
t i t l e ( ’ Dendritic Voltage ’ ) ;
p r i n t −dpng ’ D e n d r i t i c V o l t a g e . png ’ ;
62 end
Fig. 12.28 Dendritic voltage surface approximation due to a spike of 300 mV at location 4.0 using
40 terms
We have oriented the surface you see in Fig. 12.28 so you can see the voltage solution
at spacial position 0; this is the axon hillock voltage as a function of space and time.
Note the separation of variables technique generates a voltage which has spurious
oscillations in it do the fact that we are calculating an approximate solution with
Q = 40 terms in the expansion.
We can focus on the axon hillock voltage by defining an axon hillock function
and plotting it as usual. To see the axon hillock voltage as a function of time, we
define an appropriate time axis and the compute the plot.
We next modify this function a bit to make it easier to use when there are multiple
pulses. This is the function GetAxonHillockFour.
which returns the dendrite voltage function V as well as the handle of the surface we
plot, Surface. Most of this code is similar to that of the third version but this time,
we can specify the time the pulse is delivered; hence, the pulse is of magnitude Vmax
and is applied at time t0 and location x0. We also can choose how long we want to
time we want to use in the plot of the resulting surface by setting the variable tf as
we see fit. The new code for the surface plot is slightly different as we have to choose
the underlying linspace commands to we get a reasonable plot. We choose a time
and space step of .1 here as it works fairly well for many of our surfaces, but it is
possible it would be too coarse in some situations. So, you might have to alter this
in some simulations. We also change the voltage calculation to use absolute values
by changing to -abs(t-t0) in the code.
% rows o f Space a r e c o p i e s o f s p a c e
% a s many rows a r e t h e r e a r e t i m e p o i n t s
% c o l s o f Time a r e c o p i e s o f t i m e
466 12 The Basic Hodgkin–Huxley Model
14 % a s many c o l s a r e t h e r e a r e s p a c e p o i n t s
[ rowspace , c o l s p a c e ] = s i z e ( Space ) ;
[ rowstime , c o l t i m e ] = s i z e ( Space ) ;
%
% s e t up s u r f a c e
19 %
% f o r t h i s t o work
% rowspace = c o l t i m e
% c o l s p a c e = rowtime
f o r i =1: s i z e s p a c e
24 f o r j =1: s i z e t i m e
Z ( j , i ) = V( s p a c e ( i ) , t i m e ( j ) ) ;
end
end
After the construction of the surface points to plot, Z, is done, we do the plot itself.
The only thing new here is that after we generate the plot with the mesh command,
we store its handle with the line Surface = gcf();. We can then refer to this
plot in later code by using the name Surface. The full code is then as follows:
% S o l v e MB = D s y s t e m
[ Lower , Upper , p i v ] = GePiv (M) ;
y = L T r i S o l ( Lower ,D( p i v ) ) ;
30 B = U T r i S o l ( Upper , y ) ;
% check errors
E r r o r = Lower∗Upper∗B − D( p i v ) ;
D i f f = M∗B−D;
e = norm ( E r r o r ) ;
35 e2 = norm ( D i f f ) ;
EZ = z e r o s (Q, 1 ) ;
f o r n = 1 :Q
EZ( n ) = −(1+ z ( n ) ˆ 2 ) ;
40 end
BB = z e r o s (Q, 1 ) ;
f o r n = 1 :Q
BB( n ) = B( n+1) ;
45 end
%
V = @( s , t ) B( 1 ) ∗ exp (− a b s ( t −t 0 ) ) + sum ( ( BB. ∗ c o s ( z ∗ ( L−s ) ) ) . ∗ exp (EZ∗
a b s ( t −t 0 ) ) ) ;
% 1 2 3 4 43 2 2
3 32 1
50
%
% draw s u r f a c e f o r g r i d [ 0 , L ] x [ 0 , t f ]
% s e t up s p a c e and t i m e s t u f f
sizetime = t f /.1+1;
55 s i z e s p a c e = L/.1+1;
space = l i n s p a c e (0 ,L , s i z e s p a c e ) ;
time = l i n s p a c e ( 0 . 3 , t f , s i z e t i m e ) ;
% s e t up g r i d o f x and y p a i r s ( s p a c e ( i ) , t i m e ( j ) )
[ Space , Time ] = m e s h g r i d ( s p a c e , t i m e ) ;
60
% rows o f S p a c e a r e c o p i e s o f s p a c e
% a s many rows a r e t h e r e a r e t i m e p o i n t s
% c o l s o f Time a r e c o p i e s o f t i m e
% a s many c o l s a r e t h e r e a r e s p a c e p o i n t s
65 [ rowspace , c o l s p a c e ] = s i z e ( Space ) ;
[ rowstime , c o l t i m e ] = s i z e ( Space ) ;
%
% s e t up s u r f a c e
%
70 % f o r t h i s t o work
% rowspace = c o l t i m e
% c o l s p a c e = rowtime
f o r i =1: s i z e s p a c e
f o r j =1: s i z e t i m e
75 Z ( j , i ) = V( s p a c e ( i ) , t i m e ( j ) ) ;
end
end
%Z = V( Space , Time ) ;
80 %p l o t s u r f a c e
figure
mesh ( Space , Time , Z , ’ EdgeColor ’ , ’ black ’ ) ;
Surface = gcf () ;
x l a b e l ( ’ Dendrite Cable axis ’ ) ;
85 y l a b e l ( ’ Time axis ’ ) ;
z l a b e l ( ’ Voltage ’ ) ;
t i t l e ( ’ Dendritic Voltage ’ ) ;
%p r i n t −dpng ’ D e n d r i t i c V o l t a g e . png ’ ;
90 end
468 12 The Basic Hodgkin–Huxley Model
To handle multiple pulses occurring at different times, we will use the function
SetUpPulses. The function returns the a collection of handles to the surface plots
of each of the incoming pulses S{1}, S{2} and so forth; the handle of the plot of
the voltage for the cumulative pulses on the dendritic cable, DVplot, the handle of
the axon hillock voltage for the cumulative pulses, AHplot and finally, the summed
voltage function, Vin.
The data structure we use here in the cell. The voltage pulses are sent in as the
cell VMax{1} to VMax{N} where N is the number of elements in the cell. We
store N in the variable NumberOfPulses and then we setup the summed dendritic
impulse function by calling the function GetAxonHillockFour repeatedly for
all N incoming pulses. This gives us a cell of handles to the individual surface plots
S{} and a cell of the individual pulse functions V{}. We also generate all of the
individual axon hillock potentials and save them in the cell AH{}. Since there are
multiple pulses, the locations of the pulses and their arrival times are also stored in
cells; here, x0{} and td0{}, respectively. Finally, we sum the response to the
incoming pulses in the function Vin.
Note, we use the argument scale here. We may or may not want to use the gener-
ated pulse voltages unscaled. Our approximation strategies can generate really high
voltages at times; hence, we opt for prudence and allow ourselves a scaling choice.
If we set scale = 1.0 we use the full generated voltages. On the other hand, if
we set scale = 0.4 or anything less than 1, we artificially diminish the size of
the pulse. We then compute the summed dendritic voltage, DV, on the dendritic cable
12.12 Action Potential Dynamics 469
Next, we generate the plots of the summed dendritic voltage Vin and summed
axon hillock voltage and return their handles DVPlot{} and AHplot. There are
multiple handles for the dendritic voltage plots as their are multiple pulses. Here we
use the variables delx and delt to try to set up reasonable linspace commands for
our surface plots. These variables are set earlier in the code.
66 end
12.12 Action Potential Dynamics 471
Let’s try out the code. We send in two pulses: one of magnitude 200 at time 5 and
location 2.3 and the other of size 400 at time 10.0 and location 2.5. We setup the
time axis to run from 0 to 15 and we choose to use full scaling; i.e., scale = 1.0.
This returns handles to our graphics and the summed axon hillock function Vin. We
then print out our plots. First, we find the handle numbers.
{
5 [1 ,1] = 2
[1 ,2] = 3
}
AHplot
AHplot = 4
10
DVplot
DVplot =
{
15 [1 ,1] = 5
[1 ,2] = 6
}
This gives us the two surface plots, Figs. 12.29 and 12.30.
The voltage trace for the two pulses along the cable are approximated as shown
in Figs. 12.31 and 12.32.
Finally, the generated axon hillock voltage is shown in Fig. 12.33.
We clean up our generated figures with the utility function CleanUpFigures-
Two given below. To use this, simply type CleanUpFiguresTwo.
472 12 The Basic Hodgkin–Huxley Model
d e l e t e ( AHplot ) ;
12.12 Action Potential Dynamics 473
We extract this information as usual, assigning the variable Pulse to the input
voltage function name.
We then evaluate the incoming voltage at the time t using feval(Pulse,t) and
add it to the current voltage y(1). Then we send this voltage into the α–β evaluation
function GatesNAK as we have done in the previous code.
f u n c t i o n f = HHdynamicsVin ( p , t , y )
% S t a n d a r d H o d g k i n − H u x l e y Model
% voltage mV
% current na
5 % time ms
% c o n c e n t r a t i o n mM
% conductance micro Siemens
% capacitance nF
%
10 % arguments
% p parameter v e c t o r
% t time
% y state vector
%
15 % ===============================================
% y vector assignments
% ===============================================
% y (1) = V
% y ( 2 ) = m NA
20 % y ( 3 ) = h NA
% y (4) = m K
%
% parameter assignments
% p comes i n a s a d a t a s t r u c t u r e .
476 12 The Basic Hodgkin–Huxley Model
25 %
% p . a (1) = EK, t h e p o t a s s i u m b a t t e r y v o l t a g e
% p . a (2) = ENA i s t h e sodium b a t t e r y v o l t a g e
% p . a (3) = EL , t h e l e a k a g e v o l t a g e
% p . a (4) = GL, t h e l e a k a g e c o n d u c t a n c e
30 % p . a (5) = gNAmax , maximum sodium c o n d u c t a n c e
% p . a (6) = gKmax , maximum p o t a s s i u m c o n d u c t a n c e
%
% p (1 ,2) i s the s t r i n g data
% To u s e
35 % p . a = [ EK ;ENA; EL ; GL ; gNAmax ; gKMax ] ;
% p . b = ’ string ’ ; name o f HHGates f u n c t i o n
% p . c = ’ string ’ ; name o f i n p u t v o l t a g e
EK = p . a (1) ;
40 ENA = p . a (2) ;
% l e a k a g e c u r r e n t : run r e s t .m t o f i n d a p p r o p r i a t e g L v a l u e
% d e f a u l t E l e a k = −50.0
E leak = p . a (3) ;
g leak = p . a (4) ;
45 % max c o n d u c t a n c e f o r NA: d e f a u l t i s 120
g NA bar = p . a ( 5 ) ;
% max c o n d u c t a n c e f o r K: d e f a u l t i s 3 6 . 0
g K bar = p . a (6) ;
gatename = p . b ;
50 Pulse = p. c ;
f = zeros (4 ,1) ;
% ==============================================
55 % f vector assignments
% ==============================================
% f ( 1 ) = V dynamics
% f ( 2 ) = m NA d y n a m i c s
% f ( 3 ) = h NA d y n a m i c s
60 % f ( 4 ) = m K dynamics
%
c u r r e n t V = y ( 1 )+f e v a l ( P u l s e , t ) ;
a l p h a = GatesNAK ( gatename , c u r r e n t V ) ;
%
65 % a c t i v a t i o n / i n a c t i v a t i o n p a r a m e t e r s f o r NA
% a l p h a ( 1 ) , a l p h a ( 2 ) a l p h a and b e t a f o r mna
% a l p h a ( 3 ) , a l p h a ( 4 ) a l p h a and b e t a f o r hna
% a l p h a ( 5 ) , a l p h a ( 6 ) a l p h a and b e t a f o r mk
%
70 m NA infinity = a l p h a ( 1 ) / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
t m NA = 1 . 0 / ( a l p h a ( 1 )+a l p h a ( 2 ) ) ;
f (2) = ( m N A i n f i n i t y − y ( 2 ) ) /t m NA ;
%
h NA infinity = a l p h a ( 3 ) / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
75 t h NA = 1 . 0 / ( a l p h a ( 3 )+a l p h a ( 4 ) ) ;
f (3) = ( h N A i n f i n i t y − y ( 3 ) ) / t h NA ;
I NA = g NA bar ∗ ( currentV −ENA) ∗y ( 2 ) ˆ3∗ y ( 3 ) ;
%
m K infinity = a l p h a ( 5 ) / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
80 t m K = 1 . 0 / ( a l p h a ( 5 )+a l p h a ( 6 ) ) ;
f (4) = ( m K i n f i n i t y − y ( 4 ) ) /t m K ;
I K = g K b a r ∗ ( currentV −EK) ∗y ( 4 ) ˆ 4 ;
% I L current
I l e a k = g l e a k ∗ ( currentV −E l e a k ) ;
85 % C e l l Capacitance
C M = 1.0;
% f u l l dynamics
f ( 1 ) = (− I NA − I K − I l e a k ) /C M ;
end
12.12 Action Potential Dynamics 477
We then write code to allow us to automate the generation of the action poten-
tial. This is the function SetUpHH. As part of the automation, we provide our
first attempt at determining if an action potential is generated. This is the function
ConvertToDigital. This is a simple sigmoidal switch. The switch, D(V ), is
defined by
1 1 V −O
D(V ) = (VT + VB ) + (VT − VB ) tanh
2 2 G
and provides a transfer from the bottom value VB to the top value VT using a stan-
dard sigmoid with offset O and gain parameter G. The membrane voltage must be
larger than the offset to allow the switch value to approach the top value of VT . The
implementation of the switch is given in the code below.
In the SetUpHH code, we begin by setting up the incoming pulses for the excitable
cell. Here Vmax{} is the cell of pulse magnitudes, x0{} is the cell of spatial
locations for the pulses and td0{} is the cell of the times at which the pulses are
applied.
Note, when we calculate the effects of the incoming pulses, we return the function
Vin. Then, we set the rest value for the excitable cell.
Kout = 2 0 . 1 1 ;
10 Nain = 5 0 . 0 ;
Naout = 4 9 1 ;
TF = 6 9 ;
p = [ Kin ; Kout ; Nain ; Naout ; TF ] ;
[ g L , m NA0 , h NA0 , m K0 , E K , E NA ] = r e s t ( E L , V R , g NA bar , g K bar ,
p , ’ HHGates ’ ) ;
Next, we initialize the data structures pp and q which we need for the call to the
function SolveSimpleHH. We then compute the response of the excitable nerve
cell which may include action potentials.
10 [ t v a l s , y v a l s , f v a l s , h v a l s , g NA , g K ,Vm, m NA, h NA , m K ] = . . .
SolveSimpleHH ( ’ HHdynamicsVin ’ , q , pp , 0 , t f , [ V R ; m NA0 ; h NA0 ; m K0
] ,.6) ;
figure ;
p l o t ( t v a l s ,Vm) ;
APplot = g c f ( ) ;
x l a b e l ( ’ Time ’ ) ;
9 y l a b e l ( ’ Voltage ’ ) ;
t i t l e ( ’ Axon Response Voltage ’ ) ;
Finally, we plot the digitization of the axon response using the ConvertTo-
Digital function. We set this conversion using a top voltage of 40 mV and a
bottom voltage of VR = −70 mV. Since the offset is also VR and the gain is 20,
this function slowly transitions from the reference voltage to 40. Hence, all voltages
above 40 are output as 40.
12.12 Action Potential Dynamics 479
%
% Setup nerve c e l l parameters
15 %
E L = −50;
V R = −70;
g NA bar = 1 2 0 ;
g K bar = 3 6 ;
20 Kin = 4 0 0 ;
Kout = 2 0 . 1 1 ;
Nain = 5 0 . 0 ;
Naout = 4 9 1 ;
TF = 6 9 ;
25 p = [ Kin ; Kout ; Nain ; Naout ; TF ] ;
[ g L , m NA0 , h NA0 , m K0 , E K , E NA ] = r e s t ( E L , V R , g NA bar , g K bar , p , ’
HHGates ’ ) ;
pp . a = [ E K ; E NA ; E L ; g L ; g NA bar ; g K b a r ] ;
pp . b = ’ HHGates ’ ;
30 pp . c = Vin ;
e r r o r t o l = 1 . 0 e −3;
s t e p t o l = 1 . 0 e −5;
minstep = 1 . 0 e −2;
maxstep = 2 . 0 ;
35 q = [ e r r o r t o l ; s t e p t o l ; m i n s t e p ; maxstep ] ;
[ t v a l s , y v a l s , f v a l s , h v a l s , g NA , g K ,Vm, m NA, h NA , m K ] = . . .
SolveSimpleHH ( ’ H H d y n a m i c s V i n ’ , q , pp , 0 , t f , [ V R ; m NA0 ; h NA0 ; m K0 ] , . 6 ) ;
40 delt = .1;
s i z e T i m e = t f / d e l t +1;
time = l i n s p a c e ( ts , t f , sizeTime ) ;
figure ;
45 p l o t ( t v a l s ,Vm) ;
APplot = g c f ( ) ;
x l a b e l ( ’ Time ’ ) ;
y l a b e l ( ’ Voltage ’ ) ;
t i t l e ( ’ Axon Response Voltage ’ ) ;
480 12 The Basic Hodgkin–Huxley Model
50
figure
VT = 4 0 ;
VB = V R ;
O f f s e t = −70;
55 Gain = 2 0 ;
p l o t ( t v a l s , C o n v e r t T o D i g i t a l (Vm, VT, VB, O f f s e t , Gain ) ) ;
DPplot = g c f ( ) ;
x l a b e l ( ’ Time ’ ) ;
y l a b e l ( ’ Digital Voltage ’ ) ;
60 t i t l e ( ’ Axon Digital Voltage ’ ) ;
end
We clean up our generated figures with the script CleanUpFigures given below.
Use it by simply typing CleanUpFigures.
To use this code is straightforward. We will send in three pulses of various mag-
nitudes, locations and times using a scale of 1.0 and plot the results over 20 sec-
onds. For convenience, we will denote these pulses using a dirac delta notation:
Vmax δ(t − t0 , x − x0 ) is the pulse of magnitude Vmax at location x0 applied at time t0 .
The generated action potential is shown in Fig. 12.34 and the digitization of it is shown
in Fig. 12.35. Recall,
the digitization here is performed by the function D(V ) =
V +70
−15 + 55 tanh 20
which has a bottom threshold for −70 mV and an upper
threshold of 40 mV. Since the axon potential never goes above about 20 mV, the
digital value does not stay near the top value for long.
Of course, by altering the parameters that shape the digitization sigmoid, we can
change this signal. To change the bottom threshold to 0 mV and the top to 1, we
12.12 Action Potential Dynamics 481
Fig. 12.34 Generated action potential for pulses 200δ(t − 5, x − 1.5), 300δ(t − 10, x − 2.0) and
400δ(t − 11, x − 3.0)
Fig. 12.35 −70 to 40 digitization of action potential for pulses 200δ(t − 5, x − 1.5),
300δ(t − 10, x − 2.0) and 400δ(t − 11, x − 3.0)
would set VB = 0 and VT = 1 and rerun the example. We also can change the offset
value so that the pulse assigns a value of 0 to voltages close to VR . In this run, we set
O = −40; this givesa value of about 0.05 to VR . The new switch is then defined by
V +40
D(V ) = 0 + 1 tanh 20
and the new digitization is shown in Fig. 12.36.
482 12 The Basic Hodgkin–Huxley Model
Second messenger systems alter the axon potential generated from the inputs to
the dendritic system by generating proteins which change the excitable nerve cell
itself. Thus, a second messenger signal takes the existing hardware of the cell and
replaces it in various ways. These systems are discussed more thoroughly in Peterson
(2015) where we model generalized triggers that cause a cascade of reactions inside
the cell which culminate in the production of proteins. These proteins could be
additional sodium gates (increasing or decreasing gNa Max
), potassium gates (increasing
or decreasing gNa ) and/or proteins that alter the hyperpolarization phase of the
Max
action potential. For example, the value of gL could be altered leading to increased or
decreased current flux across the membrane. This would change how easy it is for an
action potential to be generated for a given voltage input sequence to the dendrite. We
can simulate this by altering the value of gL in the simulation. In the code SetUpHH,
we return the value of gL that sets up zero current flow across the membrane initially.
Add this code to the function after the call to rest. This will print out the rest
determined gL value, and the changed value we get by adding 2.5.
Fig. 12.37 Generated action potential for pulses 200δ(t − 5, x − 1.5), 300δ(t − 10, x − 2.0) and
400δ(t − 11, x − 3.0) with increased gL
Fig. 12.38 −70 to 40 digitization of action potential for pulses 200δ(t − 5, x − 1.5),
300δ(t − 10, x − 2.0) and 400δ(t − 11, x − 3.0) with increased gL
The new action potential, Fig. 12.37, is significantly different from the first as the
increased leakage current allows for the depolarization effects to be more pronounced.
The digitized potential now has a much higher hyperpolarization phase and a
wider digitized action potential. This is shown in Fig. 12.38.
484 12 The Basic Hodgkin–Huxley Model
References
A. Hodgkin, The components of membrane conductance in the giant axon of Loligo. J. Physiol.
(Lond.) 116, 473–496 (1952)
A. Hodgkin, The ionic basis of electrical activity in nerve and muscle. Biol. Rev. 26, 339–409
(1954)
A. Hodgkin, A. Huxley, Currents carried by sodium and potassium ions through the membrane of
the giant axon of Loligo. J. Physiol. (Lond.) 116, 449–472 (1952)
D. Johnston, S. Miao-Sin Wu, Foundations of Cellular Neurophysiology (MIT Press, Cambridge,
1995)
J. Peterson, BioInformation Processing: A Primer on Computational Cognitive Science. Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd., Singapore, 2015 in press)
T. Weiss, Cellular Biophysics: Volume 1, Transport (MIT Press, Cambridge, 1996a)
T. Weiss, Cellular Biophysics: Volume 2, Electrical Properties (MIT Press, Cambridge, 1996b)
Part V
Summing It All Up
Chapter 13
Final Thoughts
In this book, we have learned a lot about how to model an excitable neuron and
we have seen how many approximations we must make to find models we can solve
mathematically. It is important to realize that we always make error when we abstract
from reality a tentative map of how variables of interest to us relate. Our choice for
constructing these relationship maps here is the language of mathematics and we
supplement that with another expressive language known as computer modeling. Our
choice of language for that has been MatLab/Octave but that is merely convenient.
Much of this material we have taught to a mixture of undergraduates and graduate
students who have either taken one or two courses based on Peterson (2015a, b)
or have a traditional mathematics degree where they have learned that material—
without the modeling and computer work though—in other courses. On most college
campuses in today’s world, few students know other computer languages and so these
books were written for the common denominator language MatLab which is readily
available.
However, it is easy enough to do all of the computer modeling in Python or other
languages. We encourage you to start exploring other programming viewpoints. In
the next volume, we begin the process of setting up our tools for building network
of computational nodes which interact and although all of the code is still within the
MatLab/Octave family, it is clear we could perhaps do better if we started learning
how to program in other choices. To start you off with Python, we recommend
working through Langtangen (2012). This is a big book and will take a lot of time
to process, but being able to model ideas from computational cognitive processing
in both MatLab/Octave and Python will help you grow as a modeler. Another thing
to do is to start learning about programming paradigms when the value of a variable
can not be changed. This completely alters the way you program but it is very helpful
when you try to model things using many cores on a laptop. It is easy to see why
having a variable not be changeable is good in the case that you models using many
processes that can access that variable. If each process can change the value, it is
very easy to get into situations where the value of the variable loses meaning as
it is not well defined. A good choice to begin studying this approach is to start
reading about Erlang in Hébert (2013), Armstrong (2013) and Logan et al. (2011).
© Springer Science+Business Media Singapore 2016 487
J.K. Peterson, Calculus for Cognitive Scientists, Cognitive Science
and Technology, DOI 10.1007/978-981-287-880-9_13
488 13 Final Thoughts
References
J. Armstrong, Programming Erlang Second Edition: Software for a Concurrent World (The Prag-
matic Bookshelf, Dallas, 2013)
F. Hébert, Learn You Some Erlang for Great Good (No Starch Press, San Francisco, 2013)
H. Langtangen, A Primer of Scientific Programming with Python (Springer, New York, 2012)
M. Logan, E. Merritt, R. Carlsson, Erlang and OTP in Actions (Manning, Stamford, 2011)
J. Peterson, Calculus for Cognitive Scientists: Derivatives, Integration and Modeling, Springer
Series on Cognitive Science and Technology (Science+Business Media Singapore Pte Ltd.,
Singapore, 2015a in press)
J. Peterson, Calculus for Cognitive Scientists: Higher Order Models and Their Analysis, Springer
Series on Cognitive Science and Technology (Springer Science+Business Media Singapore Pte
Ltd., Singapore, 2015b in press)
Part VI
Advise to the Beginner
Chapter 14
Background Reading
We have written these notes to help you if want to learn some of the basic principles of
chemistry, biology and neuroscience that underlie the study of biological information
processing. Perhaps you also wish to develop software models of cognition or learn
better the material that underlies detailed mathematical models of neurons and other
biological cells. We have been inspired by many attempts by people in disparate
fields to find meaning and order in the vast compilations of knowledge that they
must assimilate. Like them, we have done a fair bit of reading and study to prepare
ourselves for necessary abstractions we need to make in our journey. We have learned
a lot from various studies of theoretical biology and computation and so forth. You
will need to make this journey too, so to help you, here are some specific comments
about the sources we have used to learn from.
• The connections between genes, developmental biology and evolution from Raff
and Kaufman (1983). This is the older version of his ideas, but it is very useful
to a beginner to read. A more mature version of his ideas appears in Raff (1996).
This is a more mature version of Raff’s ideas on the connections between genes,
development and evolution using more contemporary evidence.
• Neuromodulation and its importance in information processing in Katz (1999).
• The neurobiology of memory in Dudai (1989). This is a useful book that was our
first introduction to theories of how nervous systems handle information process-
ing. It is very speculative and for that reason, extremely interesting. There is much
food for thought on software design buried in here!
• A theoretical approach to cell signaling, embryonic development and much more
is presented in Gerhart and Kirschner (1997a). This book has influenced our
14.2 Theoretical Biology 493
14.3 Software
Out of the many books that are available for self-study in all of the areas above,
some have proved to be invaluable, while others have been much less helpful. The
following annotated list consists of the real gems. To learn to program effectively in
an object oriented way in Python, it is helpful to know how to program in a procedural
language such as C. Then, learning how to program objects within the constraints of
the class syntax of C++ is very useful. This is the route we took in learning how to
program in an object oriented way. The final step is to learn how to use a scripting
glue language such as Python to build application software. Finally, don’t be put off
by the publication date of these resources! Many resources are timeless.
C++
The following books need to be on your shelf. Lippman will get you started, but
you’ll also need Deitel and Deitel and Olshevsky and Ponomarev for nuance.
References
J. Austyn, K. Wood, Principles of Cellular and Molecular Immunology (Oxford University Press,
Oxford, 1993)
G. Booch, Object-Oriented Analysis and Design with Applications, 2nd edn. (Benjamin/Cummings
Publishing Company Inc, Redwood City, 1994)
J. Bower, D. Beeman, The Book of Genesis: Exploring Realistic Neural Models with the GEneral
NEural SImulation System, 2nd edn. (Springer TELOS, New York, 1998)
H. Deitel, P. Deitel, C ++ : How to Program (Prentice Hal, Upper Saddle River, 1994)
References 495
Y. Dudai, The Neurobiology of Memory: Concepts, Findings, Trends (Oxford University Press,
Oxford, 1989)
R. Eckert, D. Randall, G. Augustine, Animal Physiology: Mechanisms and Adaptations, 3rd edn.
(W. H. freeman and Company, New York, 1998)
E. Gamma, R. Helm, R. Johnson, J. Vlissides, Design Patterns: Elements of Reusable Object -
Oriented Software (Addison - Wesley Publishing Company, Reading, 1995)
J. Gerhart, M. Kirschner, Cells, Embryos and Evolution: Towards a Cellular and Developmen-
tal Understanding of Phenotypic Variation and Evolutionary Adaptability (Blackwell Science,
Oxford, 1997a)
J. Gerhart, M. Kirschner, Regulatory linkage, Cells, Embryos, and Evolution: Towards a Cellu-
lar and Developmental Understanding of Phenotypic Variation and Evolutionary Adaptability
(Blackwell Science, Oxford, 1997b), pp. 90–145
J. Gerhart, M. Kirschner, Conditionality and compartmentalization, Cells, Embryos, and Evolution:
Towards a Cellular and Developmental Understanding of Phenotypic Variation and Evolutionary
Adaptability (Blackwell Science, Oxford, 1997c), pp. 238–295
M. Hadley, Endocrinology (Prentice Hall, Upper Saddle River, 1996)
Z. Hall, An Introduction to Molecular Neurobiology (Sinauer Associates Inc., Sunderland, 1992)
B. Hille, Ionic Channels of Excitable Membranes (Sinauer Associates Inc, Sunderland, 1992a)
B. Hille, Classical biophysics of the squid giant axon, Ionic Channels of Excitable Membranes
(Sinauer Associates Inc, Sunderland, 1992b), pp. 23–58
D. Johnston, S. Miao-Sin Wu, Foundations of Cellular Neurophysiology (MIT Press, Cambridge,
1995a)
D. Johnston, S. Miao-Sin Wu, Hodgkin and Huxley’s Analysis of the Squid Giant Axon, Foundations
of Cellular Neurophysiology (MIT Press, Cambridge, 1995b), pp. 143–182
P. Katz (ed.), Beyond Neurotransmission: Neuromodulation and its Importance for Information
Processing (Oxford University Press, Oxford, 1999)
S. Lippman, C ++ Primer, 2nd edn. (Addison–Wesley Publishing Company, Reading, 1991)
R. Martin, Designing Object – Oriented C ++ Applications Using the Booch Method (Prentice Hall,
Upper Saddle River, 1995)
V. Olshevsky, A. Ponomarev, The Revolutionary Guide to OOP Using C ++ (WROX Publishers,
Birmingham, 1994)
W. Pree, Design Patterns for Object-Oriented Software Development, ACM Press Books (Addison-
Wesley Publishing Company, Reading, 1995)
R. Raff, T. Kaufman, Embryos, Genes, and Evolution (Macmillan Publishing Co., Inc, New York,
1983)
R. Raff, The Shape of Life: Genes, Development, and the Evolution of the Animal Form (The
University of Chicago Press, Chicago, 1996)
J. Soukup, Taming C ++ : Pattern Classes and Persistence for Large Projects (Addison–Wesley
Publishing Company, Reading, 1994)
S. Stahl, Essential Psychopharmacology: Neuroscientific Basis and Practical Applications, 2nd
edn. (Cambridge University Press, Cambridge, 2000)
T. Stone, Neuropharmacology (W. H. Freeman, Oxford, 1995)
T. Weiss, Cellular Biophysics: Transport, vol. 1 (MIT Press, Cambridge, 1996a)
T. Weiss, Cellular Biophysics: Electrical Properties, vol. 2 (MIT Press, Cambridge, 1996b)
T. Weiss, The Hodgkin - Huxley model, Cellular Biophysics: Electrical Properties, vol. 2 (MIT
Press, Cambridge, 1996c), pp. 163–292
R. Wilhem, D. Maurer, Compiler Design (Addison-Wesley Publishing Company, Reading, 1995)
W. Yamada, C. Koch, P. Adams, Multiple channels and calcium dynamics, in Methods of Neuronal
Modeling, ed. by C. Koch, I. Segev (MIT Press, Cambridge, 1987), pp. 97–134
Glossary
Amino acid An α amino acid consists of the following things: an amide group
NH2 , a carbonyl group COOH, a hydrogen atom H and a distinctive residue R.
These groups are all attached to a central carbon atom which is called the α
carbon. There are many common residues. An amino acid occurs in two different
3D forms. To keep it simple, look at this simple representation
R + y axis
↑
H ← Cα → NH2 + x axis
↓
COOH
The R, H, NH2 and COOH are in the xy plane and the Cα carbon is along the
positive z axis above the side groups. The NH2 is on the positive x axis and the R
is on the positive y axis. This is the L form as if you take your right hand, line
up the fingers along the NH2 line and rotate your fingers left towards the residue
R. Note your thumb points out of the page towards the positive z axis location of
Cα . Also, it is easy to visualize by just imaging grabbing the Cα and pulling it up
out of the page that the other groups lie in. The other form is called the R form
and looks like this:
H
↑
COOH ← Cα → NH2 + x axis
↓
R − y axis
The R, NH2 , H and COOH are in the xy plane and the Cα carbon is along the
negative z axis below the side groups. Here the NH2 is on the positive x axis but
the R is on the negative y axis. This is the R form as if you take your right hand,
line up the fingers along the NH2 line and rotate your fingers right towards the
residue R. Hence, we pull the Cα down below the page determined by the other
groups here. Now there are a total of twenty amino acids which we show below
in a table, p. 72.
Ball stick The salient features of the ball stick model are
• Axonal and dendritic fibers are modeled as two concentric membrane cylinders.
• The axon carries action potentials which propagate without change along the
fiber once they are generated. Thus if an axon makes 100 synaptic contacts, we
assume that the depolarizations of each presynaptic membrane are the same.
• Each synaptic contact on the dendritic tree generates a time and space localized
depolarization of the postsynaptic membrane which is attenuated in space as
the pulse travels along the fiber from the injection site and which decrease in
magnitude the longer the time is since the pulse was generated.
• The effect of a synaptic contact is very dependent on the position along the
dendritic fiber that the contact is made–in particular, how far was the contact
from the axon hillock (i.e., in our model, how far from the soma)? Contacts made
in essentially the same space locality have a high probability of reinforcing each
other and thereby possibly generating a depolarization high enough to trigger
an action potential.
• The effect of a synaptic contact is very dependent on the time at which the
contact is made. Contacts made in essentially the same time frame have a high
probability of reinforcing each other and thereby possibly generating a depo-
larization high enough to trigger an action potential.
We extend the simple dendritic cable model to what is called the ball and stick
neuron model by using isopotential sphere to model the soma and coupling it to a
single dendritic fiber input line. We model the soma as a simple parallel resistance/-
capacitance network and the dendrite as a finite length cable. In Fig. 11.2, you see
the terms I0 , the input current at the soma/dendrite junction starting at τ = 0; ID ,
the portion of the input current that enters the dendrite (effectively determined by
Glossary 499
the input conductance to the finite cable, GD ); IS , the portion of the input current
that enters the soma (effectively determined by the soma conductance GS ); and CS ,
the soma membrane capacitance. We assume that the electrical properties of the
soma and dendrite membrane are the same; this implies that the fundamental time
and space constants of the soma and dendrite are given by the same constant (we
will use our standard notation τM and λC as usual). It is possible to show that with
a reasonable zero-rate left end cap condition the appropriate boundary condition
at λ = 0 is given by
∂ v̂m ∂ v̂m
ρ (0, τ ) = tanh(L) v̂m (0, τ ) + (0, τ ) ,
∂λ ∂τ
where we introduce the fundamental ratio ρ = GGDS , the ratio of the dendritic
conductance to soma conductance. The full system to solve is therefore:
∂ 2 v̂m ∂ v̂m
= v̂m + , 0 ≤ λ ≤ L, τ ≥ 0.
∂λ 2 ∂τ
∂ v̂m
(L, τ ) = 0,
∂λ
∂ v̂m ∂ v̂m
ρ (0, τ ) = tanh(L) v̂m (0, τ ) + (0, τ ) .
∂λ ∂τ
Cable model There are many variables are needed to describe what is happening
inside and outside the membrane for a standard cable model. These variables
include
Variable Meaning Units
Vm Membrane potential mV
Km Membrane current per length nA/cm
Ke Externally applied current nA/cm
Ii Inner current nA
Io Outer current nA
Ie External current nA
Im Membrane current nA
Vi Inner voltage mV
Vo Outer voltage mV
ri Resistance inner fluid per length µohms/cm
ro Resistance outer fluid per length µohms/cm
gm Membrane conductance per length µSiemens/cm
cm Membrane capacitance per length nano Fahrads/cm
GM Membrane conductance µSiemens/cm
CM Membrane capacitance nano Fahrads/cm
500 Glossary
The variables needed to describe what is happening inside and outside the cellular
membrane and to some extent, inside the membrane are then
• Vm0 is the rest value of the membrane potential.
• Km0 is the rest value of the membrane current per length density.
• Ke0 is the rest value of the externally applied current per length density.
• Ii0 is the rest value of the inner current.
• Io0 is the rest value of the outer current.
• Vi0 is the rest value of the inner voltage.
• Vo0 is the rest value of the outer voltage.
• ri is the resistance of the inner fluid of the cable.
• ro is the resistance of the outer fluid surrounding the cable.
• gm is the membrane conductance per unit length.
• cm is the membrane capacitance per unit length.
The membrane voltage can be shown to satisfy the first order partial differential
equations
∂Ii
= −Km (z, t)
∂z
∂Io
= Km (z, t) − Ke (z, t)
∂z
∂Vi
= −ri Ii (z, t)
∂z
∂Vo
= −ro Io (z, t)
∂z
Vm = Vi − V0
which we can then use to derive the standard second order partial differential
equation
∂ 2 Vm
= (ri + ro )Km − ro Ke
∂z2
This equation can be solved in many ways. First, we can look at cables that are
infinitely long or finitely long assuming there is no dependence on time. Then,
we can add time as a variable which forces us to use new tools for finding the
solution. The cable equation, time dependent or independent, provides a model
for the input side of a neuron. It is part of a full neuron model called the ball stick
model, p. 149.
Complimentary nucleotides the purine and pyrimidine nucleotides can bond
together in the following ways: A to T or T to A and C to G or G to C. We say that
adenine and thymine and cytosine and guanine are complementary nucleotides.
This bonding occurs because hydrogen bonds can form between the adjacent nitro-
gen or between adjacent nitrogen and oxygen atoms. For example, look at the T –A
Glossary 501
bond in Fig. 4.40. Note the bases are inside and the sugars outside. Finally, note
how the bonding is done for the cytosine and guanine components in Fig. 4.41.
Now as we have said, nucleotides can link into a long chain via the phosphate
bond. Each base in this chain is attracted to a complimentary base. It is energeti-
cally favorable for two chains to form: chain one and its complement chain 2. Each
pair of complimentary nucleotides is called a complimentary base pair. The forces
that act on the residues of the nucleotides and between the nucleotides themselves
coupled with the rigid nature of the peptide bond between two nucleotides induce
the two chains to form a double helix structure under cellular conditions which
in cross-section (see Fig. 4.42) has the bases inside and the sugars outside. The
double helix is called DNA when deoxy-ribose sugars are used on the nucleotides
in our alphabet. The name DNA stands for deoxy-ribose nucleic acid. A chain
structure closely related to DNA is what is called RNA, where the R refers to the
fact that oxy-ribose sugars or simply ribose sugars are used on the nucleotides
in the alphabet used to build RNA. In RNA, thymine is replaced by Uracil. The
RNA alphabet is slightly different as the nucleotide Thymine, T, in the DNA
alphabet is replaced by the similar nucleotide Uracil, U. The chemical structure
of uracil is shown in Fig. 4.44 right next to the formula for thymine. Note that
the only difference is that carbon 5 C holds a methyl group in thymine and just a
hydrogen in uracil. Despite these differences, uracil will still bond to adenine via
a complimentary bond, p. 91.
κT
D= μ
q
where
Further, we see that Einstein’s Law says that diffusion and drift processes are
additive because Ohm’s Law of Drift says Jdrift is proportional to μ which by
Einstein’s Law is proportional to D and hence Jdiff , p. 101.
Excitable cell There are specialized cells in most living creatures called neurons
which are adapted for generating signals which are used for the transmission
of sensory data, control of movement and cognition through mechanisms we
don’t fully understand. A neuron has a membrane studded with many voltage
502 Glossary
gated sodium and potassium channels. In terms of ionic permeabilities, the GHK
voltage equation for the usual sodium, potassium and chlorine ions gives
PK [K + ]out + PNa [Na+ ]out + PCl [Cl]in
V0m = 25.32 (mV ) ln
PK [K + ]in + PNa [Na+ ]in + PCl [Cl− ]out
which is about −60 mV at rest but which can rapidly increase to +40 mV upon a
large shift in the sodium and potassium permeability ratio. We can also write the
rest voltage in terms of conductances as
gK gNa gCl
V0m = EK + ENa + ECl
gK + gNa + gCl gK + gNa + gCl gK + gNa + gCl
Ficke’s Law of Diffusion is an empirical law which says the rate of change of the
concentration of molecule b is proportional to the diffusion flux and is written in
mathematical form as follows:
∂ [b]
Jdiff = −D
∂x
where
The minus sign implies that flow is from high to low concentration; hence diffusion
takes place down the concentration gradient. Note that D is the proportionality
constant in this law, p. 100.
Fourier Series A general trigonometric series S(x) has the following form
Glossary 503
∞
iπ iπ
S(x) = b0 + an sin x + bn cos x
i=1
L L
for any numbers an and bn . Of course, there is no guarantee that this series will
converge at any x! If we start with a function f which is continuous on the interval
[0, L], we can define the trigonometric series associated with f as follows
1
S(x) = < f,1 >
L
∞
2 iπ iπ 2 iπ iπ
+ f (x), sin x sin x + f (x), cos x cos x .
L L L L L L
i=1
This series is called the Fourier Series for f and the coefficients in the Fourier
series for f are called the Fourier coefficients of f . Since these coefficients are
based on inner products with the normalized sin and cos functions, they are called
normalized Fourier coefficients. The nth Fourier sin coefficient, n ≥ 1, of f is as
follows:
2 L iπ
an (f ) = f (x) sin x dx
L 0 L
1. [cm ] varies linearly across the membrane as discussed in the previous subsec-
tion.
2. The electric field in the membrane is constant.
3. The Nernst–Planck equation holds inside the membrane.
After much work and some approximations, we obtain another current equation
zFVcm
z2 PF 2 Vcm [c]in − [c]out e− RT
I0m = zFVcm
RT 1 − e− RT
504 Glossary
where P is the permeability of the ion which is a measure of how ions flow across
the membrane. In an equilibrium situation, this current is zero and we obtain the
GHK voltage equation. If the cell is permeable to say sodium, potassium and
chlorine, we find the GHK currents must sum to zero:
IK + INa + ICl = 0
Further, the associated Nernst potentials for the ions should all match because
otherwise there would be current flow:
where to actually compute the GHK voltage, we would need the three ion perme-
abilities, p. 132.
Hodgkin–Huxley gates Hodgkin and Huxley modeled the sodium and potassium
gates as
gNa (V ) = gNa
Max
MNA 3 (V ) HNA (V )
gK (V ) = gKMax MK 4 (V )
where the two activation variables, MNA and MK , and the one inactivation vari-
able, HNA , all satisfy the first order kinetics
τMNA MNA (t) = (MNA )∞ − MNA
τHNA HNA (t) = (HNA )∞ − HNA
τMK MK (t) = (MK )∞ − MK
Glossary 505
with
1
τMNA =
αMNA + βMNA
αMNA
(MNA )∞ =
αMNA + βMNA
1
τHNA =
αHNA + βHNA
αHNA
(HNA )∞ =
αHNA + βHNA
1
τMK =
αMK + βMK
αMK
(MK )∞ =
αMK + βMK
Further, the coefficient functions, α and β for each variable required data fits as
functions of voltage. These were determined to be
V + 35.0
αMNA = −0.10
e−0.1 (V +35.0) − 1.0
−(V +60.0)
βMNA = 4.0 e 18.0
Of course these data fits were obtained at a certain temperature. The model of the
membrane dynamics thus consists of the following differential equations:
dMNA
τMNA = (MNA )∞ − MNA
dt
dHNA
τHNA = (HNA )∞ − HNA
dt
dMK
τMK = (MK )∞ − MK
dt
dV IM − IK − INa − IL
=
dt CM
where the leakage current IL is handled more simply by choosing a leakage con-
ductance and leakage voltage that is relevant to the simulation. The model has the
initial conditions
506 Glossary
∂ 2 Vm
= (ri + ro )Km − ro Ke
∂z2
∂Vm
= (ri + ro ) cm + (ri + ro ) KK + (ri + ro ) KNa + (ri + ro ) KL − ro Ke
∂t
1 ∂ 2 Vm ro
= Km − Ke
ri + ro ∂z2 ri + ro
∂Vm ro
= cm + KK + KNa + KL − Ke
∂t ri + ro
where the ion current terms are modeled using Hodgkin and Huxley’s model of
the voltage dependent gates, p. 405.
Hydrocarbons Hydrocarbons are molecules made up of strings of carbons. Since
each carbon can make four bonds, these strings can be quite complex. Any of
the four binding sites of a carbon can be filled with an arbitrarily large complex
which we often called a residue and these in turn can have other residues bound
to them. Hence, a hydrocarbon chain could be linear if there are no side chains
or bushy if the chain has multiple side chains due to the attached residues. Also,
five carbons can combine together into a cyclical structure called a ring which is a
potent molecular component that occurs in many biologically reactive molecular
assemblies, p. 71.
Glossary 507
Hydrogen bonds these occur when a hydrogen atom is shared between two other
atoms: The atom to which the hydrogen is held more tightly is called the hydro-
gen donor and the other one which is less tightly linked is called the hydrogen
acceptor, p. 65.
Infinite series The simplest one is a series of positive terms which we write as
∞
n=1 an where each an is a positive number. If we add up a finite number at
a time starting from the beginning, we get a sequence of what are called partial
sums of the form SN = Nn=1 an , We say the series converges if this sequence
of partial sums converges and as usual, this need not be true. The sequence of
partial sums could blow up to infinity if we sum terms that do not decay very
fast. For example, the series ∞ n=1 1 has partial sums SN = N which go off to
infinity as we add more terms in. We can show other series such as ∞ 1
n=1 n also
add up to infinity although that is a bit harder. The point is that just having the nth
term an go to zero is not enough to insure the series adds up to a finite number.
In this simple case, we are always adding positive numbers, so the partial sums
are always increasing. But if the terms an can have different algebraic signs, the
behavior of these partial sums can get quite complicated. To study this behavior
properly naturally enough requires a lot of mathematical analysis which we only
do some of in the text. So you should feel free to read more! A general series
is then of the form ∞ n=1 an where the an ’s can have differing algebraic signs.
We can make it even more general, by looking at series of functions such as
∞
n=1 fn (x). The idea of partial sums is still the same but we have to think about
whether or not the series sums to a finite number (we say the series converges) at
each x in the domain of our functions. This gets more difficult fast and requires
more intellectual effort to master. When the series contains functions like fn (x),
there a many new types of convergence to consider such as convergence at a
given value of x but not necessarily at another value of x. This is called pointwise
convergence. Convergence ideas on an entire interval such as [0, 1] of possible x
values are called uniform convergence notions and they imply the pointwise ideas
but the implication does not go the other way. Finally, there is an idea called L2
convergence which is also different from those. There are many details in Chap. 9
you should study, p. 235.
Linear partial differential equation These are models where the variable u sat-
isfies an equation involving the function u, its partial derivatives, second order
partial derivatives and so forth. The relationship between these terms can be very
508 Glossary
nonlinear but here we will just mention a few common linear PDE which we
discuss in Chap. 10.
The Wave Equation: We seek functions (x, t) so that
∂2 2∂
2
− c = 0
∂t 2 ∂x 2
(x, 0) = f (x), for 0 ≤ x ≤ L
∂
(x, 0) = g(x), for 0 ≤ x ≤ L
∂t
(0, t) = 0, for 0 ≤ t
(L, t) = 0, for 0 ≤ t
for some positive constant c. The solution of this equation approximates the motion
of a nice string with no external forces applied. The domain here is the infinite
rectangle [0, L] × [0, ∞).
Laplace’s Equation: The solution (x, y) of this equation is a time independent
solution to a problem such as the distribution of heat on a membrane stretch over
the domain given that various heat sources are applied to the boundary. Here, the
domain is the finite square [0, L]×[0, L]. In the problem below, three of the edges
of the square are clamped to 0 and the remaining one must follow the heat profile
given by the function f (x).
∂2 ∂2
+ =0
∂x 2 ∂y2
∂
(0, y) = 0, for 0 ≤ y ≤ L
∂x
∂
(L, y) = 0, for 0 ≤ y ≤ L
∂x
(x, L) = 0, for 0 ≤ x ≤ L
(x, 0) = f (x), for 0 ≤ x ≤ L
The Heat/Diffusion Equation: The solution of this equation, (x, t), is the time
dependent value of heat or temperature of a one dimensional bar which is having
a heat source applied to it initially. It can also model a substance moving through
a domain using diffusion with diffusion constant D as discussed in Chap. 5. The
domain is again half infinite: [0, L] × [0, ∞).
∂ ∂2
− D =0
∂t ∂x 2
(0, t) = 0, for 0 < t
(L, t) = 0, for 0 < t
(x, 0) = f (x), for 0 < x < L
Glossary 509
This equation is very relevant to our needs. Indeed, in Peterson (2015), we derive
this equation using a random walk model and learn how to interpret the diffusion
constant D in terms of the space constant λC and the time constant τM . However,
we will not discuss that here.
The Cable Equation: The solution (x, t) of this equation for us is usually the
membrane voltage in a dendrite model for an excitable neuron. Here the domain
is the infinite rectangle [0, L] × [0, ∞) where the space variable represents the
position on the cable. In the problem below, fluxes in the spatial direction at the
endcaps of the fiber are zero and there is an imposed voltage input function over
the entire cable when time is zero, p. 309.
∂2 ∂
β2 − − α = 0, for 0 ≤ x ≤ L, t ≥ 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
∂
(L, t) = 0,
∂x
(x, 0) = f (x).
Nernst The current form of the Nernst–Planck equation given in Eq. 5.10 describes
ionic current flow driven by electro-chemical potentials (concentration gradients
and electric fields). When the net current due to all of these contributions is zero,
we have I = 0 and after suitable manipulations, we can derive the Nernst equation
in terms of the inner and outer concentration of the ion c.
510 Glossary
RT [c]out
Ec = ln
zF [c]in
If we have more than one ion, say sodium, potassium and chlorine, at equilibrium,
the currents would sum to zero and we would find
gK gNa gCl
Vm = EK + ENa + ECl
gK + gNa + gCl gK + gNa + gCl gK + gNa + gCl
where the terms gK and so forth are the conductances of the ions, p. 106.
Nernst Planck Under physiological conditions, ion movement across the mem-
brane is influenced by both electric fields and concentration gradients. Let J denote
the total flux, then we will assume that we can add linearly the diffusion due to
the molecule c and the drift due to the ion c giving
J = Jdrift + Jdiff
Thus, applying Ohm’s Law 5.3 and Ficke’s Law 5.1, we have
∂V ∂[c]
J = −μ z [c] − D
∂x ∂x
Next, we use Einstein’s Relation 5.4 to replace the diffusion constant D to obtain
what is called the Nernst–Planck Equation
∂V κT ∂[c]
J = −μ z [c] − μ
∂x q ∂x
∂V κT ∂[c]
= −μ z [c] +
∂x q ∂x
furan molecule is the 2 C endo form shown in Fig. 4.31b. Here, 2 C and 5 C are
out of the plane formed by O–1 C –3 C –4 C . Another version is the one where 3 C
and 5 C are out of the plane formed by O–1 C –2 C –4 C which is called the 3 C
endo form. DNA uses the 2 C endo and RNA, the 3 C endo form. The particular
sugar of interest is ribose which comes in an oxygenated and non oxygenated
form; ribose (Fig. 4.32a) and deoxyribose (Fig. 4.32b), respectively. There are
also four special nitrogenous bases which are important. They come in two flavors:
purines and pyrimidines. The purines have the form shown in Fig. 4.33a while
the pyrimidines have the one shown in Fig. 4.33b. There are two purines and two
pyrimidines we need to know about: the purines adenine (A) and guanine (G)
and the pyrimidines thymine (T) and cytosine (C). Figure 4.34a (Adenine is a
purine with an attached amide on 6 C ), 4.34b (Guanine is a purine with an attached
oxygen on 6 C ), 4.34d (Cytosine is a pyrimidine with an attached amide on 4 C ),
and 4.34c (Thymine is a pyrimidine with an attached oxygen on 4 C ). These four
nitrogenous bases can bond to the ribose or deoxyribose sugars to create what are
called nucleotides. In general, a sugar plus a purine or pyrimidine nitrogenous
base give us a nucleoside. If we add phosphate to the 5 C of the sugar, we get
a new molecule called a nucleotide. This level of detail is far more complicated
and messy than we typically wish to show; hence, we generally draw this in the
compact form shown in Fig. 4.37. There, we have replaced the base with a simple
shaded box and simply labeled the primed carbons with the numerical ranking.
In Fig. 4.38 we show how nucleotides can link up into chains: bond the 5 C of
the ribose on one nucleotide to the 3 C of the ribose on another nucleotide with
a phosphate or PO3− bridge. Symbolically this looks like Fig. 4.38. This chain of
three nucleotides has a terminal OH on the 5 C of the top sugar and a terminal OH
on the 3 C of the bottom sugar. We often write this even more abstractly as shown
in Fig. 4.39 or just OH− Base 3 P Base 2 P Base 1 P −OH, where the P denotes a
phosphate bridge. For example, for a chain with bases adenine, adenine, cytosine
and guanine, we would write OH–A–p–A–p–C–p–G–OH or OHApApCpGOH.
Even this is cumbersome, so we will leave out the common phosphate bridges
and terminal hydroxyl groups and simply write AACG. It is thus understood the
left end is an OH terminated 5 C and the right end an hydroxyl terminated 3 C ,
p. 85.
Ohm’s Law of Drift relates the electrical field due to an charged molecule, i.e. an
ion, c, across a membrane to the drift of the ion across the membrane where drift is
the amount of ions that moves across the membrane per unit area. In mathematical
form
Jdrift = − ∂el E
512 Glossary
where
From basic physics, we know an electrical field is the negative gradient of the
potential so if V is the potential across the membrane and x is the variable that
measures our position on the membrane, we have
∂V
E=−
∂x
Let the valence of the ion c be denoted by z. It is possible to show
∂el = μ z [c]
∂V
Jdrift = −μz[c]
∂x
Peptide bond Amino acids can link up in chains because the COOH on one can
bond with the NH2 on another. The two amino acids that pair are connected by a
rigid planar bond. There is a Cα1 atom from amino acid one and another Cα2 from
amino acid two attached to this bond. The COOH and NH2 bond looks like this
in block diagram form. The COOH loses an OH and the NH2 loses an H to form
the bond. Think of bond as forming a rigid piece of cardboard and attached on
the left is the amino acid built around Cα1 and attached on the right is the amino
acid build around Cα2 .
Now think of Cα1 as attached to a pencil which is plugged into the side of the
peptide bond. The Cα1 to CO bond is an axis that amino acid one is free to rotate
about. Call this angle of rotation 1 . We can do the same thing for the other side
and talk about a rotation angle 2 for the NH to Cα2 bond. In Fig. 4.21, R1 is the
residue or side chain for the first amino acid and R2 is the side chain for the other.
Glossary 513
Note amino acid one starts with an N2 H group on the left and amino acid two
ends with a COOH group on the right
The peptide bond allows amino acids to link into chains as we show in the next
block diagram, p. 80.
is produced instead. Note again that the 5 pairs with a 3 and vice versa. From what
we said earlier, there are 64 different triplets that can be made from the alphabet
{A, C, U, G} and it is this mapping that is used to assemble the protein chain a
little at a time. For each chain that is unzipped, a complimentary chain is attracted
to it in the fashion shown by Table 4.7. This complimentary chain will however be
built from the oxygenated deoxy-ribose or simply ribose nucleotides. Hence, this
complimentary chain is part of a complimentary RNA helix. As the amino acids
encoded by mRNA are built and exit from the ribosome into the fluid inside the
cell, the chain of amino acids or polypeptides begins to twist and curl into its three
dimensional shape based on all the forces acting on it. We can write this whole
process symbolically as DNA → mRNA → ribosome → Protein. This is known
as the Central Dogma of Molecular Biology. Hence to decode a particular gene
514 Glossary
stored in DNA which has been translated to its complimentary mRNA form all
we need to know are which triplets are associated with which amino acids. These
triplets are called DNA Codons. The DNA alphabet form of this mapping is given
in Table 4.8. For example, the DNA sequence,
TAC|TAT|GTG|CTT|ACC|TCG|ATT
AUG|AUA|CAC|GAA|UGG|AGC|UAA
Start|Isoleucine|Histidine|Glutamic Acid|Tryptophan|Serine|Stop
∂2 ∂
β2 − − α = 0, for 0 ≤ x ≤ L, t ≥ 0,
∂x 2 ∂t
∂
(0, t) = 0,
∂x
∂
(L, t) = 0,
∂x
(x, 0) = f (x).
The domain is the usual half infinite [0, L] × [0, ∞) where the spatial part of the
domain corresponds to the length of the dendritic cable in an excitable nerve cell.
We won’t worry too much about the details of where this model comes from as
we will discuss that in another volume. The boundary conditions ux (0, t) = 0 and
ux (L, t) = 0 are called Neumann Boundary conditions. The conditions u(0, t) = 0
and u(L, t) = 0 are known as Dirichlet Boundary conditions. One way to find
the solution is to assume we can separate the variables so that we can write
(x, t) = u(x)w(t). We assume a solution of the form (x, t) = u(x) w(t) and
compute the needed partials. This leads to a the new equation
d2u dw
β2 w(t) − u(x)w(t) − αu(x) = 0.
dx 2 dt
Rewriting, we find for all x and t, we must have
2
2d u dw
w(t) β − u(x) = αu(x) .
dx 2 dt
This tells us
2
β 2 ddxu2 − u(x) α dw
= dt , 0 ≤ x ≤ L, t > 0.
u(x) w(t)
The only way this can be true is if both the left and right hand side are equal
to a constant that is usually called the separation constant . This leads to the
decoupled equations
dw
α = w(t), t > 0,
dt
d2u
β 2 2 = (1 + ) u(x), 0 ≤ x ≤ L,
dx
516 Glossary
du
(0) = 0
dx
du
(L) = 0.
dx
This gives us a second order ODE to solve in x and a first order ODE to solve in
t. We have a lot of discussion about this in the text which you should study. In
general, we find there is an infinite family of solutions that solve these coupled
ODE models which we can label un (x) and wn (t). Thus, any finite combination
n (x, t) = Nn=0 an un (x)wn (t) will solve these ODE models, but we are still left
with satisfying the last condition that (x, 0) = f (x). We do this by finding a
series solution. We can show that the data function f can be written as a series
f (x) = ∞ n=0 bn un (x) for a set of constants {b0 , b1 , . . .} and we can also show
that the series (x, t) = ∞ n=0 an un (x)wn (t) solves the last boundary condition
(x, 0) = ∞ a
n=0 n n u (x)w n (0) = f (x) as long as we choose an = bn for all n.
The idea of a series and the mathematical machinery associated with that takes a
while to explain, so Chap. 9 is devoted to that, p. 229.
Triplet code There are 20 amino acids and only 4 nucleotides. Hence, our alphabet
here is {A, C, T , G} The number of ways to take 3 things out of an alphabet of 4
things is 64. To see this, think of a given triplet as a set of three empty slots; there
are 4 ways to fill slot 1, 4 independent ways to fill slot 2 (we know have 4 × 4
ways to fill the first two slots) and finally, 4 independent ways to fill slot 3. This
gives a total of 4 × 4 × 4 or 64 ways to fill the three slots independently. Since
there are only 20 amino acids, it is clear that more than one nucleotide triplet
could be mapped to a given amino acid! In a similar way, there are 64 different
ways to form triplets from the RNA alphabet {A, C, U, G}. We tend to identify
these two sets of triplets and the associated mapping to amino acids as it is just a
matter of replacing the T in one set with an U to obtain the other set. The triplet
code is shown in Table 4.8, p. 93.
Voltage dependent gate A typical sodium channel as shown in Fig. 5.11 and it is
a typical voltage dependent gate. When you look at the drawing of the sodium
channel, you’ll see it is drawn in three parts. Our idealized channel has a hinged
cap which can cover the part of the gate that opens into the cell. We call this the
Glossary 517
inactivation gate. It also has a smaller flap inside the gate which can close off the
throat of the channel. This is called the activation gate. As you see in the drawing,
these two pieces can be in one of three positions: resting (activation gate is closed
and the inactivation gate is open); open (activation gate is open and the inactivation
gate is open); and closed (activation gate is closed or closed and the inactivation
gate is closed). Since this is a voltage activated gate, the transition from resting
to open depends on the voltage across the cell membrane. We typically use the
following terminology:
• When the voltage across the membrane is above the resting membrane voltage,
we say the cell is depolarized.
• When the voltage across the membrane is below the resting membrane voltage,
we say the cell is hyperpolarized.
These gates transition from resting to open when the membrane depolarizes. In
detail, the probability that the gate opens increases upon membrane depolarization.
However, the probability that the gate transitions from open to closed is NOT
voltage dependent. Hence, no matter what the membrane voltage, once a gate
opens, there is a fixed probability it will close again. Hence, an action potential can
be described as follows: when the cell membrane is sufficiently depolarized, there
is an explosive increase in the opening of the sodium gates which causes a huge
influx on sodium ions which produces a short lived rapid increase in the voltage
across the membrane followed by a rapid return to the rest voltage with a typical
overshoot phase which temporarily keeps the cell membrane hyperpolarized. The
opening of the potassium gates lags the sodium gates and as the sodium gates
begin to close, the influx of potassium ions is on the rise which brings the membrane
voltage down actually below equilibrium and as the potassium gates close, there
is the slow rise back up to equilibrium, p. 143.
Reference
plotting the axon hillock voltage as a rest.m sets the initial conditions and
function of time, 464 makes sure the leakage current
plotting the axon response again, 478 starts at zero, 415
plotting the generating ion currents, 457 setting up an more abstract model of
set the cell capacitance and cable dynam- the ion gates, F, 420
ics, 420 SimpleHH.m computes the dynamics
set the dimension of the Hodgkin– at the a given time, 415
Huxley dynamics, 418 SolveSimpleHHOrig.m manages the
action potential simulation, 415
set the leakage current, 420
the altered SolveSimpleHHnew.m,
setting up parameters for the excitable
435
cell the pulse goes into, 477
the leakage conductance and leakage
setting up pulse arguments, 468 voltage must be chosen, 425
setting up some dendritic pulses, 471 the full dynamic model requires four
setting up the new absolute value surface variables, 410
plot of the voltage, 465 the ion current equation, 407
the α and β curve fits for the sodium and the ionic conductance is assumed to
potassium conductance models, 410 have a specific form: Gc (V , t) =
the m is called the activation variable and G0 mp (V , t)hq (V , t), 407
the h is called the inactivation variable the leakage current model, 407
and they follow first order kinetics, 408 the membrane and gate circuit model,
the activation and inactivation variables 402
rate equation, 408 the membrane model replaced by a par-
the cable equation with the current terms allel circuit model, 402
specified, 405 the membrane voltage equation in terms
the digital response associated with an of the Hodgkin–Huxley ion gate mod-
axonal output, 478 els, 407
the first MatLab implementation the membrane voltage model under the
clamped voltage protocol, 409
F used to setup all the needed α and
β functions, 420 the second MatLab implementation with
RKF5, 443
A HH model has a set of nominal p
a simple attempt to convert an action
and q values encoded in 0 , 421
potential into a digital pulse, 477
a sample simulation, 428
a simple attempt to simulate second
alterations to return time constants messenger activity, 482
and asymptotic values: HHfixe- adding a sequence of pulses to the
dRKnew.m, 436 dendritic arbor, 462
an example action potential, activa- altering the gates function to avoid
tion and inactivation variable plot division by zero problems, 443
and ion conductances and currents, altering the HH dynamics function to
429 accept an axon hillock voltage func-
each α and β function uses two para- tion, 474
meters, p and q which give the altering the incoming parameter p to
specific values needed to set their have additional parts, 474
forms, 421 rewriting the HH dynamics function
Finding the proper initial conditions, to accept a parameter vector, 447
424 the sodium and potassium activation and
HHFixedRK.m handles the Runge– inactivation rate equations, 409
Kutta for each needed time step, the sodium and potassium activation and
415 inactivation time constants and asymp-
modifying simpleHH.m to return totic values, 409
extra information: simpleHH- the sodium and potassium conductance
new.m, 434 models, 409, 504
526 Index
the standard units for the model, 410 the four continuity conditions give
the structure of the parameter p which we rise to four conditions, 185
use to simplify the argument lists, 450 the inner and outer voltage solutions,
the time constant and asymptotic value 196
for the rate equations, 408 the inner and outer voltage solutions
the total membrane current is a sum of a for the idealized pulse, 195
capacitative current and the individual the limit as C → 0 away from the site
ion currents, 405 of the current injection at 0, 186,
the voltage clamped protocol, 408 188
using a script to remove unwanted figures the solution for multiple idealized
after a MatLab session, 446 current pulses, 190
the solution to the current injection
on [−C, C], 185
I the continuity conditions in the derivative
Infinite Cables with No Time Dependence of the solution at ±C, 183
a particular solution to the time indepen- the continuity conditions in the solution
dent cable model, 176 at ±C, 182
applying the initial conditions to get the the current injection problem implies
solution, 177 we solve three related ODEs and then
examples of the Variation of Parameters splice the solutions together so the
method, 178 solution is continuous in the first deriv-
Handling Current Injections ative, 181
families of currents give rise to fam- the derivation of the second condition in
ilies of solutions: defining the cur- Variation of Parameters, 174
rent families, 181 the general solution to the time indepen-
rewriting the general solution in terms of dent cable model, 176
hyperbolic sin’s and cos’s, 177 the inner and outer current solutions, 192
solving the Variation of Parameters sys- the solution and its derivative depend on
tem using Cramer’s Rule, 175 C where the current injection is applied
summarizing the infinite cable solutions, on [−C, C], 182
196 the solution is a combination of the
the basic model to solve, 171 homogeneous solution and a particular
the continuity conditions at ±C solution, 172
a discussion of idealized currents: the system of equations the particular
defining a delta function, 189 solution must satisfy in Variation of
defining some auxiliary variables to Parameters, 175
make the exposition simpler to read,
the time independent cable model is a
183
standard ODE, 172
defining the signum and unit step
Variation of Parameters
function and writing the inner and
the derivation of the first condition in
outer current solutions in terms of
Variation of Parameters, 173
them, 195
the current injection to an idealized Ion Movement
pulse: i.e. the limiting value as C → finding the membrane voltage using con-
0, 185 ductances, 118
the derivation of the inner current for finding the potassium voltage, 109
the solution, 193 increasing the sodium to potassium con-
the derivation of the outer current for ductance ratio, 118
the solution, 194 Nernst output for potassium, 109
the evaluation of integrals of delta Ion Movement in Cells
functions, 192 A simple two compartment models: there
the four continuity condition equa- are sodium and chlorine gates between
tions, 184 the compartments, 125
Index 527
qualitative analysis is not enough; with two gates, Ohm’s law for simple
need to use Donnan’s Equilibrium circuits applies: I = R1 V or since
and a little algebra to solve for final G = 1/R, I = GV ., 114
equilibrium values, 126 the environment inside a cell
Active transport with pumps, 124 how many uncompensated ions on
biological membrane structure, 97 one side of a membrane are needed
a typical phospholipid spontaneously to maintain a one volt difference
assembles into membranes and across the membrane, 102
spheres, 98 inside a typical cell with a 0.5 Molar
Ion channels, 120 concentration of ions, there are
Donnan’s Law of Equilibrium, 123 about 2 × 1016 ions and to maintain
a 100 mV difference, only about
Donnan’s Law of Equilibrium: an
2.5 × 10−7 % of them need to be
example with three ions, 124
uncompensated, 103
Membrane transport mechanisms, 119
the environment inside the cell
Simple Cell Membrane Calculations space charge neutrality, 102
100 mM KCl inside and 10 mM KCl The Goldman–Hodgkin–Katz Equa-
outside and 100 mM NaCl outside tions, 128
and 10 mM NaCl inside with potas-
a qualitative description of what hap-
sium gates, 112
pens when an excitable nerve cell
100 mM KCl inside and 10 mM generates an action potential, 144
KCl outside and 100mM NaCl out- a typical sodium voltage activated
side and 10 mM NaCl inside with gate, 143
sodium and potassium gates, 113
adding a model for the concentration
100 mM KCl inside and 10 mM of the ion c in the membrane itself,
KCl outside and 100mM NaCl out- 129
side and 10 mM NaCl inside with
an expression for permeability in
sodium gates instead of potassium
terms of fundamental constants,
gates, 113
131
100 mM KCl inside and 10 mM KCl assumptions, 132
outside with potassium gates, 111
each GHK current equation can be
100 mM KCl inside and outside expressed in terms of permeabili-
before adding potassium gates, 110 ties for their respective ion, 137
100 mM KCl inside and outside with electrical field in terms of the deriva-
potassium gates, 111 tive of the potential, 132
a simple RC circuit model for multi- Examples of voltage calculations
ple ions, 115 using the GHK equations, 138
comments on the equation for the Excitable Nerve Cells, 142
membrane voltage with multiple for multiple ions, the individual GHK
ions, 116 currents sum to zero and equilib-
equilibrium membrane voltage with rium, 136
two gates in terms of conductances, How conductance and membrane
114 voltages change with time under a
ion c current and voltage relationship, depolarization in an action poten-
114 tial, 142
Sodium and Potassium current equa- ion current in membrane satisfies the
tions if there are two gates, 114 Nernst–Planck equation, 132
the Nernst equation for more than two Large change in permeability ratio
ions, 115 between potassium and sodium
what happens if there is an xplosive triggers a huge change in the equi-
change in the sodium to potassium librium membrane voltage, 139
conductance ratio?, 118 membrane permeability, 128
528 Index
the development of the idea of the Wron- The Wave equation with Neumann BC:
skian of two differentiable functions, testing on saw data, 340
24 Wave equation Dirichlet BC: setup sine
Linear Partial Differential Equations functions, 333
a typical pulse function, 353 Wave Equation Dirichlet Boundary Con-
setting up two pulses, 356 ditions: altering WaveDirichletApprox
the fourier cosine approximation to the to return partial derivative approxima-
double pulse, 356 tions, 336
the Heat equation with Dirichlet BC: a Wave Equation Dirichlet Boundary Con-
sample solution for square wave data, ditions: construct the approximate
358 solution, 333
the Heat equation with Dirichlet BC: a Wave Equation Dirichlet Boundary Con-
third sample solution for square wave ditions: get fourier sine coefficients,
data, 358 333
Wave Equation Dirichlet Boundary Con-
the Heat equation with Dirichlet BC:
ditions: plot the approximate solution
another sample solution for square
surface, 334
wave data, 358
Wave Equation Dirichlet Boundary Con-
the Heat Equation with Dirichlet data: a
ditions: sample wave equation approx-
pulse input solution with 40 terms, 353
imate solution, 335
The Laplace equation with Dirichlet BC:
Wave Equation Dirichlet Boundary Con-
a sample solution with 10 terms, 345
ditions: setting up the partial derivative
The Laplace equation with Dirichlet BC: approximations, 336
a sample solution with 20 terms, 346 Wave Equation Dirichlet Boundary Con-
The Laplace equation with Dirichlet BC: ditions: setup cosine functions, 333
build the approximate solution, 344 Wave Equation Dirichlet Boundary Con-
The Laplace equation with Dirich- ditions: setup the plot domain, 333
let BC: LaplaceDirichletApprox argu- Wave Equation Dirichlet Boundary Con-
ments, 343 ditions: testing the boundary condi-
The Laplace equation with Neumann tions, 337
BC: LaplaceNeumannApprox argu- Wave Equation Dirichlet Boundary Con-
ments, 348 ditions: the wave solution for saw func-
The Laplace equation with Neumann tion inputs, 336
BC: sample solution with 10 terms, 352 Linear PDE
The Laplace equation with Neumann Fourier Series Approximations, 331
BC: sample solution with 5 terms, 349 Models
The Wave equation with Neumann BC: Laplace’s Equation, 310, 508
altering the WaveNeumannApprox to Neumann and Dirichlet Boundary
return partial derivative information, Conditions, 229
340 The Cable Equation, 229
The Wave equation with Neumann BC: The Heat/Diffusion Equation, 310
getting fourier cosine approximations, The Wave Equation, 309, 508
338 Separation of Variables
The Wave equation with Neumann BC: Definition, 230
setting up the partial derivative approx- Linear PDE Fourier Series Approximations
imations, 340 Laplace’s Equation with Dirichlet
The Wave equation with Neumann BC: Boundary Conditions, 343
setup approximate solutions, 339 Code Implementation, 344
The Wave equation with Neumann BC: Coefficient Matching, 343
setup cosine functions, 338 Sample Code Session, 345
The Wave equation with Neumann BC: Series Solution, 343
solving and returning the partial deriv- Laplace’s Equation with Neumann
ative information, 342 Boundary Conditions, 347
530 Index