## The math behind extracellular mechanisms

The basics of how to develop, test, and use models.
sdanner
Posts: 5
Joined: Sat Aug 29, 2009 7:24 am

### Re: The math behind extracellular mechanisms

Thank you for clearing this up for me.
Kind regards
Simon

mzenker
Posts: 25
Joined: Tue Sep 04, 2018 10:04 am
Location: Germany

### Re: The math behind extracellular mechanisms

Hi,

this is an old thread, but the subject isn't... ;)
ted wrote:
Mon Jun 08, 2009 5:09 pm
Proceeding from the outside in, the potentials at the ith nodes are vext_i, vext_i, and v_i + vext_i.
(...)

- v_i * cm*D + vext_i * (cm + xc)*D - vext_i * xc*D
= vext_i-1 * (1/xraxial_i) - vext_i * ((1/xraxial_i) + (1/xraxial_i+1)) + vext_i+1 * (1/xraxial_i+1) + g_pas * (v_i - e_pas) - xg * (vext_i - vext_i)

- vext_i * xc*D + vext_i * (xc + xc)*D
= vext_i-1 * (1/xraxial_i) - vext_i * ((1/xraxial_i) + (1/xraxial_i+1)) + vext_i+1 * (1/xraxial_i+1) + xg * vext_i - xg * (vext_i - e_extracellular)
(...)
Although I have proofread this several times, it would not surprise me if these equations contain one or more errors (especially in the indices).
Trying to reproduce the equations using the picture in the documentation, I think there is an error in the second and one in the third equation.
The potential difference over cm is just the membrane potential v_i, so that the left hand side of the second equation should read:

- v_i * cm*D + (vext_i * - vext_i) * xc*D

i.e. there is no term vext_i*cm*D.

In the third equation, the resistive current between the  and  layer is xg * (vext_i - vext_i). The term xg*vext_i is missing, so that the right hand side should read:

vext_i-1 * (1/xraxial_i) - vext_i * ((1/xraxial_i) + (1/xraxial_i+1)) + vext_i+1 * (1/xraxial_i+1) + xg * (vext_i - vext_i) - xg * (vext_i - e_extracellular)

Additionally, I think the equations are easier to read (and derive) if written in terms of potential differences and with a slightly different notation for the time derivative (D == d/dt), since the capacitances are considered to be constant:

cm*D(v_i) = (v_i-1 - v_i)/Ra_i + (v_i+1 - v_i)/Ra_i+1 - g_pas*(v_i - e_pas)

-cm*D(v_i) + xc*D(vext_i - vext_i)
= (vext_i-1 - vext_i)/xraxial_i + (vext_i+1 - vext_i)/xraxial_i+1 + g_pas*(v_i - e_pas) - xg*(vext_i - vext_i)

-xc*D(vext_i - vext_i) + xc*D(vext_i)
= (vext_i-1 - vext_i)/xraxial_i + (vext_i+1 - vext_i)/xraxial_i+1 + xg*(vext_i - vext_i) - xg*(vext_i-e_extracellular_i)

Please correct me if I am wrong...

Matthias

ted
Posts: 5772
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: The math behind extracellular mechanisms

Yes indeed, there are mistakes in those equations that I wrote. I treated membrane potential as if it were potential relative to ground. Also, notation was bad. It's a good idea to revisit this stuff at least once every decade or so. Too bad I didn't do that long before now. My apologies to the confusion that this caused.

Starting from scratch, treating the potential at each node as "relative to ground", and using these definitions (note: this list was revised by ted on Wed Oct 10, 2018--see Comments at the end of this post)
• D is the derivative operator
• each segment has the same physical dimensions and electrical properties
• cm and gm are total membrane capacitance and conductance of a compartment
• Ra is total resistance between the centers of adjacent compartments
• xraxial and xraxial are the net longitudinal extracellular resistances between extracellular positions that correspond to the centers of adjacent compartments, as shown in that diagram
• xc and xg represent the net radial capacitance and conductance between the two layers of NEURON's extracellular mechanism, as shown in that diagram
• xc and xg are the net radial capacitance and conductance between the extracellular mechanism's outer layer and the bath, as shown in that diagram
I get the following:

Begin by focussing on the intracellular nodes.

Code: Select all

``````(cm*D + gm + 2/Ra) * v[i]
= v[i-1]/Ra + v[i+1]/Ra
+ (cm*D + gm) * vext[0,i]``````
which rearranges to

Code: Select all

``````cm*D(v[i]) - cm*D(vext[0,i])
= - (gm + 2/Ra) * v[i]
+ v[i-1]/Ra + v[i+1]/Ra
+ gm * vext[0,i]``````
Now shift to the nodes in layer 0.

Code: Select all

``````((xc + cm)*D + (xg + gm + 2/xraxial)) * vext[0,i]
= (cm*D + gm) * v[i]
+ (vext[0,i-1] + vext[0,i+1])/xraxial
+ (xc*D + xg) * vext[1,i]``````
which rearranges to

Code: Select all

``````-cm*D(v[i]) + (cm + xc)*D(vext[0,i]) - xc*D(vext[1,i])
= gm * v[i]
- (gm + xg + 2/xraxial) * vext[0,i]
+ (vext[0,i-1] + vext[0,i+1])/xraxial
+ xg * vext[1,i]``````
Finally deal with the nodes in layer 1.

Code: Select all

``````((xc + xc)*D + (xg + xg + 2/xraxial)) * vext[1,i]
= (xc*D + xg) * vext[0,i]
+ (vext[1,i-1] + vext[1,i+1])/xraxial
+ xg * e_extracellular[i]``````
which rearranges to

Code: Select all

``````-xc*D(vext[0,i]) + (xc + xc)*D(vext[1,i])
= xg * vext[0,i]
- (xg + xg + 2/xraxial) * vext[1,i]
+ (vext[1,i-1] + vext[1,i+1]) / xraxial
+ xg * e_extracellular[i]``````
The left hand sides of these equations have two or three derivatives because of the capacitive coupling between adjacent layers.

1. In NEURON's documentation of extracellular, potentials at extracellular nodes are relative to ground, but potential at the intracellular nodes is transmembrane potential, that is, potential relative to extracellular space immediately adjacent to the section. However, v in the following equations refers to "intracellular potential" (potential at intracellular nodes relative to ground). This definition makes it easier to write the node equations by inspection, and results in a set of equations that is more easily understood.
2. The following statement was removed from the above list on Wed Oct 10, 2018 8:15 am:
v, vext, and vext are the potentials indicated in the diagram that is part of NEURON's documentation of the extracellular mechanism
That statement is clearly incorrect and confusing. It led to the exchange starting with the post by mzenker » Tue Oct 09, 2018 3:47 am and ending with the post by ted » Wed Oct 10, 2018 7:57 am. That exchange is preserved below.

mzenker
Posts: 25
Joined: Tue Sep 04, 2018 10:04 am
Location: Germany

### Re: The math behind extracellular mechanisms

Hi Ted,

I am confused. I don't understand how you derive your equations, and I get different ones if I do it.
I paste here the picture from the documentation:

Code: Select all

``````
Ra
o/`--o--'\/\/`--o--'\/\/`--o--'\/\/`--o--'\o vext + v
|          |          |          |
---        ---        ---        ---
|   |      |   |      |   |      |   |
---        ---        ---        ---
|          |          |          |
|          |          |          |     i_membrane
|  xraxial |          |          |
/`--o--'\/\/`--o--'\/\/`--o--'\/\/`--o--'\ vext
|          |          |          |
---        ---        ---        ---     xc and xg
|   |      |   |      |   |      |   |    in  parallel
---        ---        ---        ---
|          |          |          |
|          |          |          |
|xraxial|          |          |
/`--o--'\/\/`--o--'\/\/`--o--'\/\/`--o--'\ vext
|          |          |          |
---        ---        ---        ---     the series xg, e_extracellular
|   |      |   |      |   |      |   |    combination is in parallel with
|  ---     |  ---     |  ---     |  ---   the xc capacitance. This is
|   -      |   -      |   -      |   -    identical to a membrane with
---        ---        ---        ---     cm, g_pas, e_pas
|          |          |          |
-------------------------------------------- ground
``````
now I write cm, gm, xc, xg, xc, xg and the layer nominations into the schematics. Just to make sure that we are talking about the same things.

Code: Select all

``````
Ra
o/`--o--'\/\/`--o--'\/\/`--o--'\/\/`--o--'\o vext + v     intracellular layer
|          |          |          |
---        ---        ---        ---
|   |      |   |      |   |    cm|   |gm
---        ---        ---        ---
|          |          |          |
|          |          |          |
|xraxial|          |          |
/`--o--'\/\/`--o--'\/\/`--o--'\/\/`--o--'\ vext             layer 0
|          |          |          |
---        ---        ---        ---
|   |      |   |      |   | xc|   |xg
---        ---        ---        ---
|          |          |          |
|          |          |          |
|xraxial|          |          |
/`--o--'\/\/`--o--'\/\/`--o--'\/\/`--o--'\ vext           layer 1
|          |          |          |
---        ---        ---        ---
|   |      |   |      |   | xc|   |xg
|  ---     |  ---     |  ---     |  ---
|   -      |   -      |   -      |   - e_extracellular
---        ---        ---        ---
|          |          |          |
-------------------------------------------- ground
``````
now for the voltages (shorthand for potential differences):
• v is the voltage between the intracellular layer and layer 0.
• vext is the voltage between layer 0 and ground.
• vext is the voltage between layer 1 and ground.
• vext-vext is the voltage between layer 0 and layer 1.
We consider a passive membrane.
ted wrote:
Mon Oct 08, 2018 3:11 pm
Begin by focussing on the intracellular nodes.

Code: Select all

``````(cm*D + gm + 2/Ra) * v[i]
= v[i-1]/Ra + v[i+1]/Ra
+ (cm*D + gm) * vext[0,i]``````
which rearranges to

Code: Select all

``````cm*D(v[i]) - cm*D(vext[0,i])
= - (gm + 2/Ra) * v[i]
+ v[i-1]/Ra + v[i+1]/Ra
+ gm * vext[0,i]``````
OK. Did you write the first equation directly from inspection of the schematics? Then what is the physical meaning behind this arrangement?
As I see it, we have to write Kirchhoff's law for the node i. So here we go. The currents for that node are (in the direction towards the node)
• -gm * v[ i]: resistive through membrane
• -cm * D(v[ i]): capacitive through membrane
• (v[i+1] - v[ i])/Ra: resistive from node i+1
• (v[i-1] - v[ i])/Ra: resistive from node i-1
which gives me the following current balance

Code: Select all

``````(v[i+1] + v[i-1] - 2*v[ i])/Ra - gm*v[i] - cm * D(v[i]) = 0
``````
rearranged to separate capacitive and resistive currents and ordering by the voltages / potentials, to compare with your equation:

Code: Select all

``````cm * D(v[i])
= - (gm + 2/Ra)*v[i])
+ v[i+1]/Ra + v[i-1]/Ra
``````
So there is a term (cm*D + gm) * vext[0,i] in your equation which I don't understand. Where does it come from, and what does it mean?
ted wrote:
Mon Oct 08, 2018 3:11 pm
Now shift to the nodes in layer 0.

Code: Select all

``````((xc + cm)*D + (xg + gm + 2/xraxial)) * vext[0,i]
= (cm*D + gm) * v[i]
+ (vext[0,i-1] + vext[0,i+1])/xraxial
+ (xc*D + xg) * vext[1,i]``````
which rearranges to

Code: Select all

``````-cm*D(v[i]) + (cm + xc)*D(vext[0,i]) - xc*D(vext[1,i])
= gm * v[i]
- (gm + xg + 2/xraxial) * vext[0,i]
+ (vext[0,i-1] + vext[0,i+1])/xraxial
+ xg * vext[1,i]
``````
Hmmm... I still don't follow. Remember, I am just a physicist, so I need to stick to Kirchhoff. ;)
Proceeding as above, the currents are
• gm * v[ i]: resistive through membrane
• cm * D(v[ i]): capacitive through membrane
• (vext[0,i+1] - vext[0,i])/xraxial: resistive from node i+1
• (vext[0,i-1] - vext[0,i])/xraxial: resistive from node i-1
• -xg * (vext[0,i] - vext[1,i]): resistive between layer 0 and layer 1
• -xc * D(vext[0,i] - vext[1,i]): capacitive between layer 0 and layer 1
giving the following equation:

Code: Select all

``````cm * D(v[i]) + gm * v[i] + (vext[0,i+1] + vext[0,i-1] - 2*vext[0,i])/xraxial
- (xg + xc * D) * (vext[0,i] - vext[1,i]) = 0
``````
or

Code: Select all

``````-cm*D(v[i]) + xc*D(vext[0,i]) - xc*D(vext[1,i])
= gm * v[i]
+ (xg - 2/xraxial) * vext[0,i]
+ (vext[0,i+1] + vext[0,i-1])/xraxial
+ xg * vext[1,i]
``````
So again there is this term (cm*D + gm)*vext[0,i], as above.
ted wrote:
Mon Oct 08, 2018 3:11 pm
Finally deal with the nodes in layer 1.

Code: Select all

``````((xc + xc)*D + (xg + xg + 2/xraxial)) * vext[1,i]
= (xc*D + xg) * vext[0,i]
+ (vext[1,i-1] + vext[1,i+1])/xraxial
+ xg * e_extracellular[i]
``````
which rearranges to

Code: Select all

``````-xc*D(vext[0,i]) + (xc + xc)*D(vext[1,i])
= xg * vext[0,i]
- (xg + xg + 2/xraxial) * vext[1,i]
+ (vext[1,i-1] + vext[1,i+1]) / xraxial
+ xg * e_extracellular[i]``````
Kirchhoff, help!
Here are the currents:
• xg * (vext[0,i] - vext[1,i]): resistive between layer 0 and layer 1
• xc * D(vext[0,i] - vext[1,i]): capacitive between layer 0 and layer 1
• (vext[1,i+1] - vext[1,i])/xraxial: resistive from node i+1
• (vext[1,i-1] - vext[1,i])/xraxial: resistive from node i-1
• -xg * (vext[1,i] - e_extracellular[ i]): resistive between layer 1 and ground
• -xc * D(vext[1,i]): capacitive between layer 1 and ground
so we have

Code: Select all

``````(xg + xc * D) * (vext[0,i] - vext[1,i]) + (vext[1,i+1] + vext[1,i-1] - 2*vext[1,i])/xraxial
- xg * (vext[1,i] - e_extracellular) - xc * D(vext[1,i]) = 0
``````
or

Code: Select all

``````-xc * D(vext[0,i]) + (xc + xc) * D(vext[1,i])
= xg * vext[0,i]
- (xg + xg + 2/xraxial) * vext[1,i]
+ (vext[1,i+1] + vext[1,i-1])/xraxial
+ xg * e_extracellular[i]
``````
This time it's a perfect match! :)

So finally there is just the mysterious (cm*D + gm)*vext[0,i] in the equations for the innercellular node and the node in layer 0.

Matthias

ted
Posts: 5772
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: The math behind extracellular mechanisms

Perhaps this is the source of confusion:
The schematic diagram in the documentation of extracellular uses v to refer to membrane potential, i.e. the difference between intracellular potential and the potential adjacent to the outer surface of the neurite. However, in yesterday's post I used v to refer to intracellular potential. This is a deliberate choice. Consistency--treating the potential at each node in exactly the same way (i.e. "treating the potential at each node as relative to ground" rather than "treating extracellular potentials as relative to ground while interpreting v as relative to potential adjacent to the external surface of the neurite")--leads to a set of equations that is more easily written and understood than the alternative of treating v as a value measured relative to vext.

Of course, there is an alternative way to achieve a different consistency--leave the meaning of v and vext unchanged, but replace vext with a variable equal to vext - vext, so that all "potentials" in the equations are "voltage drops between adjacent layers"--but somehow that seems less natural to me.

Yet another approach would be to abandon node equations altogether and resort to loop equations instead, but let's agree not to do that.

mzenker
Posts: 25
Joined: Tue Sep 04, 2018 10:04 am
Location: Germany

### Re: The math behind extracellular mechanisms

OK, this explains the "mysterious" term. Since in the post it was written
ted wrote:
Mon Oct 08, 2018 3:11 pm
Starting from scratch, treating the potential at each node as "relative to ground," and using these definitions
• (...)
• v, vext, and vext are the potentials indicated in the diagram that is part of NEURON's documentation of the extracellular mechanism
• (...)
and this diagram in the documentation shows the potential at the innercellular layer to be v+vext, I didn't get the different meaning of v.

Case closed for now as far as I am concerned... :)

Matthias

ted
Posts: 5772
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: The math behind extracellular mechanisms

. . . in the post it was written
ted wrote:
Mon Oct 08, 2018 3:11 pm
Starting from scratch, treating the potential at each node as "relative to ground," and using these definitions
• (...)
• v, vext, and vext are the potentials indicated in the diagram that is part of NEURON's documentation of the extracellular mechanism
• (...)
You're right, that was a mistake. I'm sorry it exists, but glad that you caught it. I was so focussed on deriving and proofreading the equations that I didn't think to check the definition of terms. I'll correct that now, and leave a comment for the benefit of others who may read this thread.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8537902,"math_prob":0.9658501,"size":18847,"snap":"2020-34-2020-40","text_gpt3_token_len":6324,"char_repetition_ratio":0.17831555,"word_repetition_ratio":0.63963395,"special_character_ratio":0.35820025,"punctuation_ratio":0.10874704,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9931636,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-14T16:49:24Z\",\"WARC-Record-ID\":\"<urn:uuid:f50e20d2-eb16-4808-b941-09f9ac5c150e>\",\"Content-Length\":\"64793\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cfa56671-884a-4d88-87e5-3dc68c18a09e>\",\"WARC-Concurrent-To\":\"<urn:uuid:1db6224f-7f58-48c6-8dd2-c7acf8ef76da>\",\"WARC-IP-Address\":\"128.36.111.212\",\"WARC-Target-URI\":\"https://neuron.yale.edu/phpBB/viewtopic.php?p=17104\",\"WARC-Payload-Digest\":\"sha1:JCTKOSLQ77OO6OWCFE33CR3VPKD6WVY7\",\"WARC-Block-Digest\":\"sha1:TTSJKDQK5QA3NLIFQHM6E7E4DOTFVWTA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439739347.81_warc_CC-MAIN-20200814160701-20200814190701-00581.warc.gz\"}"}