The math behind extracellular mechanisms
Re: The math behind extracellular mechanisms
Thank you for clearing this up for me.
Kind regards
Simon
Kind regards
Simon
Re: The math behind extracellular mechanisms
Hi,
this is an old thread, but the subject isn't... ;)
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[1]_i) * xc*D
i.e. there is no term vext_i*cm*D.
In the third equation, the resistive current between the [0] and [1] layer is xg * (vext_i  vext[1]_i). The term xg*vext[1]_i is missing, so that the right hand side should read:
vext[1]_i1 * (1/xraxial[1]_i)  vext[1]_i * ((1/xraxial[1]_i) + (1/xraxial[1]_i+1)) + vext[1]_i+1 * (1/xraxial[1]_i+1) + xg * (vext_i  vext[1]_i)  xg[1] * (vext[1]_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_i1  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[1]_i)
= (vext_i1  vext_i)/xraxial_i + (vext_i+1  vext_i)/xraxial_i+1 + g_pas*(v_i  e_pas)  xg*(vext_i  vext[1]_i)
xc*D(vext_i  vext[1]_i) + xc[1]*D(vext[1]_i)
= (vext[1]_i1  vext[1]_i)/xraxial_i + (vext[1]_i+1  vext[1]_i)/xraxial_i+1 + xg*(vext_i  vext[1]_i)  xg[1]*(vext[1]_ie_extracellular_i)
Please correct me if I am wrong...
Matthias
this is an old thread, but the subject isn't... ;)
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.ted wrote: ↑Mon Jun 08, 2009 5:09 pm Proceeding from the outside in, the potentials at the ith nodes are vext[1]_i, vext_i, and v_i + vext_i.
(...)
 v_i * cm*D + vext_i * (cm + xc)*D  vext[1]_i * xc*D
= vext_i1 * (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[1]_i)
 vext_i * xc*D + vext[1]_i * (xc + xc[1])*D
= vext[1]_i1 * (1/xraxial[1]_i)  vext[1]_i * ((1/xraxial[1]_i) + (1/xraxial[1]_i+1)) + vext[1]_i+1 * (1/xraxial[1]_i+1) + xg * vext_i  xg[1] * (vext[1]_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).
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[1]_i) * xc*D
i.e. there is no term vext_i*cm*D.
In the third equation, the resistive current between the [0] and [1] layer is xg * (vext_i  vext[1]_i). The term xg*vext[1]_i is missing, so that the right hand side should read:
vext[1]_i1 * (1/xraxial[1]_i)  vext[1]_i * ((1/xraxial[1]_i) + (1/xraxial[1]_i+1)) + vext[1]_i+1 * (1/xraxial[1]_i+1) + xg * (vext_i  vext[1]_i)  xg[1] * (vext[1]_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_i1  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[1]_i)
= (vext_i1  vext_i)/xraxial_i + (vext_i+1  vext_i)/xraxial_i+1 + g_pas*(v_i  e_pas)  xg*(vext_i  vext[1]_i)
xc*D(vext_i  vext[1]_i) + xc[1]*D(vext[1]_i)
= (vext[1]_i1  vext[1]_i)/xraxial_i + (vext[1]_i+1  vext[1]_i)/xraxial_i+1 + xg*(vext_i  vext[1]_i)  xg[1]*(vext[1]_ie_extracellular_i)
Please correct me if I am wrong...
Matthias

 Site Admin
 Posts: 5810
 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, 2018see Comments at the end of this post)
Begin by focussing on the intracellular nodes.which rearranges to
Now shift to the nodes in layer 0.which rearranges to
Finally deal with the nodes in layer 1.which rearranges to
The left hand sides of these equations have two or three derivatives because of the capacitive coupling between adjacent layers.
Comments:
These comments were added by ted on Wed Oct 10, 2018:
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[0], and vext[1] 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.
End of Comments
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, 2018see 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[0] and xraxial[1] are the net longitudinal extracellular resistances between extracellular positions that correspond to the centers of adjacent compartments, as shown in that diagram
 xc[0] and xg[0] represent the net radial capacitance and conductance between the two layers of NEURON's extracellular mechanism, as shown in that diagram
 xc[1] and xg[1] are the net radial capacitance and conductance between the extracellular mechanism's outer layer and the bath, as shown in that diagram
Begin by focussing on the intracellular nodes.
Code: Select all
(cm*D + gm + 2/Ra) * v[i]
= v[i1]/Ra + v[i+1]/Ra
+ (cm*D + gm) * vext[0,i]
Code: Select all
cm*D(v[i])  cm*D(vext[0,i])
=  (gm + 2/Ra) * v[i]
+ v[i1]/Ra + v[i+1]/Ra
+ gm * vext[0,i]
Code: Select all
((xc[0] + cm)*D + (xg[0] + gm + 2/xraxial[0])) * vext[0,i]
= (cm*D + gm) * v[i]
+ (vext[0,i1] + vext[0,i+1])/xraxial[0]
+ (xc[0]*D + xg[0]) * vext[1,i]
Code: Select all
cm*D(v[i]) + (cm + xc[0])*D(vext[0,i])  xc[0]*D(vext[1,i])
= gm * v[i]
 (gm + xg[0] + 2/xraxial[0]) * vext[0,i]
+ (vext[0,i1] + vext[0,i+1])/xraxial[0]
+ xg[0] * vext[1,i]
Code: Select all
((xc[0] + xc[1])*D + (xg[0] + xg[1] + 2/xraxial[1])) * vext[1,i]
= (xc[0]*D + xg[0]) * vext[0,i]
+ (vext[1,i1] + vext[1,i+1])/xraxial[1]
+ xg[1] * e_extracellular[i]
Code: Select all
xc[0]*D(vext[0,i]) + (xc[0] + xc[1])*D(vext[1,i])
= xg[0] * vext[0,i]
 (xg[0] + xg[1] + 2/xraxial[1]) * vext[1,i]
+ (vext[1,i1] + vext[1,i+1]) / xraxial[1]
+ xg[1] * e_extracellular[i]
Comments:
These comments were added by ted on Wed Oct 10, 2018:
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[0], and vext[1] 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.
End of Comments
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:
now I write cm, gm, xc[0], xg[0], xc[1], xg[1] and the layer nominations into the schematics. Just to make sure that we are talking about the same things.
now for the voltages (shorthand for potential differences):
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)
rearranged to separate capacitive and resistive currents and ordering by the voltages / potentials, to compare with your equation:
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?
Proceeding as above, the currents are
or
So again there is this term (cm*D + gm)*vext[0,i], as above.
Here are the currents:
or
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
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[1]  
/`o'\/\/`o'\/\/`o'\/\/`o'\ vext[1]
   
    the series xg[1], e_extracellular
        combination is in parallel with
        the xc[1] capacitance. This is
        identical to a membrane with
    cm, g_pas, e_pas
   
 ground
Code: Select all
Ra
o/`o'\/\/`o'\/\/`o'\/\/`o'\o vext + v intracellular layer
   
   
      cm gm
   
   
   
xraxial[0]  
/`o'\/\/`o'\/\/`o'\/\/`o'\ vext[0] layer 0
   
   
      xc[0] xg[0]
   
   
   
xraxial[1]  
/`o'\/\/`o'\/\/`o'\/\/`o'\ vext[1] layer 1
   
   
      xc[1] xg[1]
       
        e_extracellular
   
   
 ground
 v is the voltage between the intracellular layer and layer 0.
 vext[0] is the voltage between layer 0 and ground.
 vext[1] is the voltage between layer 1 and ground.
 vext[0]vext[1] is the voltage between layer 0 and layer 1.
OK. Did you write the first equation directly from inspection of the schematics? Then what is the physical meaning behind this arrangement?ted wrote: ↑Mon Oct 08, 2018 3:11 pm Begin by focussing on the intracellular nodes.which rearranges toCode: Select all
(cm*D + gm + 2/Ra) * v[i] = v[i1]/Ra + v[i+1]/Ra + (cm*D + gm) * vext[0,i]
Code: Select all
cm*D(v[i])  cm*D(vext[0,i]) =  (gm + 2/Ra) * v[i] + v[i1]/Ra + v[i+1]/Ra + gm * vext[0,i]
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[i1]  v[ i])/Ra: resistive from node i1
Code: Select all
(v[i+1] + v[i1]  2*v[ i])/Ra  gm*v[i]  cm * D(v[i]) = 0
Code: Select all
cm * D(v[i])
=  (gm + 2/Ra)*v[i])
+ v[i+1]/Ra + v[i1]/Ra
Hmmm... I still don't follow. Remember, I am just a physicist, so I need to stick to Kirchhoff. ;)ted wrote: ↑Mon Oct 08, 2018 3:11 pm Now shift to the nodes in layer 0.which rearranges toCode: Select all
((xc[0] + cm)*D + (xg[0] + gm + 2/xraxial[0])) * vext[0,i] = (cm*D + gm) * v[i] + (vext[0,i1] + vext[0,i+1])/xraxial[0] + (xc[0]*D + xg[0]) * vext[1,i]
Code: Select all
cm*D(v[i]) + (cm + xc[0])*D(vext[0,i])  xc[0]*D(vext[1,i]) = gm * v[i]  (gm + xg[0] + 2/xraxial[0]) * vext[0,i] + (vext[0,i1] + vext[0,i+1])/xraxial[0] + xg[0] * vext[1,i]
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[0]: resistive from node i+1
 (vext[0,i1]  vext[0,i])/xraxial[0]: resistive from node i1
 xg[0] * (vext[0,i]  vext[1,i]): resistive between layer 0 and layer 1
 xc[0] * D(vext[0,i]  vext[1,i]): capacitive between layer 0 and layer 1
Code: Select all
cm * D(v[i]) + gm * v[i] + (vext[0,i+1] + vext[0,i1]  2*vext[0,i])/xraxial[0]
 (xg[0] + xc[0] * D) * (vext[0,i]  vext[1,i]) = 0
Code: Select all
cm*D(v[i]) + xc[0]*D(vext[0,i])  xc[0]*D(vext[1,i])
= gm * v[i]
+ (xg[0]  2/xraxial[0]) * vext[0,i]
+ (vext[0,i+1] + vext[0,i1])/xraxial[0]
+ xg[0] * vext[1,i]
Kirchhoff, help!ted wrote: ↑Mon Oct 08, 2018 3:11 pm Finally deal with the nodes in layer 1.which rearranges toCode: Select all
((xc[0] + xc[1])*D + (xg[0] + xg[1] + 2/xraxial[1])) * vext[1,i] = (xc[0]*D + xg[0]) * vext[0,i] + (vext[1,i1] + vext[1,i+1])/xraxial[1] + xg[1] * e_extracellular[i]
Code: Select all
xc[0]*D(vext[0,i]) + (xc[0] + xc[1])*D(vext[1,i]) = xg[0] * vext[0,i]  (xg[0] + xg[1] + 2/xraxial[1]) * vext[1,i] + (vext[1,i1] + vext[1,i+1]) / xraxial[1] + xg[1] * e_extracellular[i]
Here are the currents:
 xg[0] * (vext[0,i]  vext[1,i]): resistive between layer 0 and layer 1
 xc[0] * D(vext[0,i]  vext[1,i]): capacitive between layer 0 and layer 1
 (vext[1,i+1]  vext[1,i])/xraxial[1]: resistive from node i+1
 (vext[1,i1]  vext[1,i])/xraxial[1]: resistive from node i1
 xg[1] * (vext[1,i]  e_extracellular[ i]): resistive between layer 1 and ground
 xc[1] * D(vext[1,i]): capacitive between layer 1 and ground
Code: Select all
(xg[0] + xc[0] * D) * (vext[0,i]  vext[1,i]) + (vext[1,i+1] + vext[1,i1]  2*vext[1,i])/xraxial[1]
 xg[1] * (vext[1,i]  e_extracellular)  xc[1] * D(vext[1,i]) = 0
Code: Select all
xc[0] * D(vext[0,i]) + (xc[0] + xc[1]) * D(vext[1,i])
= xg[0] * vext[0,i]
 (xg[0] + xg[1] + 2/xraxial[1]) * vext[1,i]
+ (vext[1,i+1] + vext[1,i1])/xraxial[1]
+ xg[1] * e_extracellular[i]
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

 Site Admin
 Posts: 5810
 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. Consistencytreating 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[0].
Of course, there is an alternative way to achieve a different consistencyleave the meaning of v and vext[1] unchanged, but replace vext[0] with a variable equal to vext[0]  vext[1], 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.
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. Consistencytreating 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[0].
Of course, there is an alternative way to achieve a different consistencyleave the meaning of v and vext[1] unchanged, but replace vext[0] with a variable equal to vext[0]  vext[1], 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.
Re: The math behind extracellular mechanisms
OK, this explains the "mysterious" term. Since in the post it was written
Case closed for now as far as I am concerned... :)
Matthias
and this diagram in the documentation shows the potential at the innercellular layer to be v+vext[0], I didn't get the different meaning of v.
Case closed for now as far as I am concerned... :)
Matthias

 Site Admin
 Posts: 5810
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: The math behind extracellular mechanisms
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.. . . in the post it was written