{"version":10,"randomSeed":"3d6ec00ea09eb3f189f167061c782035","graph":{"viewport":{"xmin":-1.506672176523292,"ymin":-15.803199641330888,"xmax":32.49542539058618,"ymax":17.306178002646465},"showGrid":false,"showXAxis":false,"showYAxis":false},"expressions":{"list":[{"type":"text","id":"131","text":"You should be able to use this without messing with the crazy maths. The graphic has axon at the bottom and extracellular space at the top; the colours correspond to concentrations of ions. The yellow segment in the middle is the membrane, and translucent blue and pink marks on it are (closed) sodium and potassium channels, respectively. Drag the orange dot to pick where to start an action potential, then click the arrow on the line below."},{"type":"expression","id":"132","color":"#000000","latex":"A"},{"type":"text","id":"134","text":"Channel markers become darker/more opaque to show the channels opening, then disappear to show refractory state (they will return to the resting state eventually)."},{"type":"folder","id":"69","title":"K, Na concentrations in Axon and Exterior","collapsed":true},{"type":"expression","id":"1","folderId":"69","color":"#c74440","latex":"K_{A}=\\left[1.3173612312975689,1.3172890089050044,1.3171473264624272,1.3169416692743878,1.3166801570359166,1.316373388564211,1.316034198512674,1.3156773059335092,1.3153188410313543,1.314975747609728,1.3146650731382048,1.3144031740462219,1.3142048784711755,1.3140826600057438,1.3140458821583154,1.3141001731059334,1.3142469835941912,1.3144833681513675,1.3148020125858095,1.3151915110814225,1.3156368764449777,1.3161202494798472,1.3166217599534222,1.3171204834112693,1.3175954355693373,1.3180265487518814,1.3183955817006547,1.3186869234716865,1.3188882623400167,1.3189911001296786\\right]"},{"type":"expression","id":"5","folderId":"69","color":"#000000","latex":"N_{A}=\\left[0.08308196308907717,0.08308196308907717,0.08308196308907717,0.08308196308907718,0.08308196308907718,0.08308196308907718,0.08308196308907718,0.08308196308907718,0.0830819630890772,0.08308196308907723,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725,0.08308196308907725\\right]"},{"type":"expression","id":"6","folderId":"69","color":"#c74440","latex":"K_{E}=\\left[0.3493054353692176,0.34937765776178187,0.3495193402043591,0.3497249973923981,0.34998650963086925,0.3502932781025747,0.3506324681541115,0.35098936073327586,0.35134782563543004,0.35169091905705635,0.352001593528579,0.3522634926205616,0.3524617881956074,0.3525840066610385,0.3526207845084664,0.3525664935608476,0.35241968307258925,0.3521832985154126,0.35186465408096984,0.35147515558535636,0.35102979022180086,0.3505464171869313,0.35004490671335614,0.34954618325550874,0.3490712310974406,0.3486401179148962,0.3482710849661223,0.34797974319509034,0.34777840432676,0.34767556653709797\\right]"},{"type":"expression","id":"7","folderId":"69","color":"#2d70b3","latex":"N_{E}=\\left[1.950251370244249,1.9502513702442492,1.9502513702442492,1.9502513702442494,1.9502513702442497,1.9502513702442497,1.9502513702442497,1.9502513702442497,1.9502513702442499,1.95025137024425,1.95025137024425,1.95025137024425,1.95025137024425,1.95025137024425,1.95025137024425,1.95025137024425,1.95025137024425,1.95025137024425,1.95025137024425,1.9502513702442503,1.9502513702442505,1.9502513702442505,1.9502513702442505,1.9502513702442505,1.9502513702442505,1.9502513702442505,1.9502513702442505,1.9502513702442505,1.9502513702442505,1.9502513702442503\\right]"},{"type":"text","id":"30","text":"reset random concentrations"},{"type":"expression","id":"8","color":"#388c46","latex":"\\left(K_{A}\\to\\operatorname{shuffle}\\left(\\frac{\\left[1...L_{A}\\right]}{L_{A}}\\right),N_{A}\\to\\operatorname{shuffle}\\left(\\frac{\\left[1...L_{A}\\right]}{L_{A}}\\right),K_{E}\\to\\operatorname{shuffle}\\left(\\frac{\\left[1...L_{A}\\right]}{L_{A}}\\right),N_{E}\\to\\operatorname{shuffle}\\left(\\frac{\\left[1...L_{A}\\right]}{L_{A}}\\right)\\right)"},{"type":"text","id":"85","text":"reset to resting potential (weird constants can be calculated by randomising and converging to rest)"},{"type":"expression","id":"91","color":"#2d70b3","latex":"\\left(K_{A}\\to0\\cdot\\left[1...L_{A}\\right]+\\frac{40}{L_{A}},N_{A}\\to0\\cdot\\left[1...L_{A}\\right]+\\frac{1}{L_{A}},K_{E}\\to0\\cdot\\left[1...L_{A}\\right]+\\frac{10}{L_{A}},N_{E}\\to0\\cdot\\left[1...L_{A}\\right]+\\frac{60}{L_{A}},C_{N}\\to0\\cdot\\left[1...L_{A}\\right],C_{K}\\to0\\cdot\\left[1...L_{A}\\right]\\right)"},{"type":"text","id":"32","text":"length of axon (\"cells\", in the simulation sense, not the biological sense)"},{"type":"expression","id":"2","color":"#2d70b3","latex":"L_{A}=30","slider":{"hardMin":true,"hardMax":true,"min":"1","max":"100","step":"1"}},{"type":"text","id":"36","text":"linear interpolation"},{"type":"expression","id":"21","color":"#000000","latex":"I_{L}\\left(a,b,t\\right)=a+t\\left(b-a\\right)"},{"type":"text","id":"34","text":"colours to depict concentration (greenish-blue for sodium to purplish-magenta for potassium)"},{"type":"expression","id":"18","color":"#2d70b3","latex":"H_{N}=180","slider":{"hardMin":true,"hardMax":true,"min":"0","max":"360"}},{"type":"expression","id":"119","color":"#c74440","latex":"H_{Np}=\\operatorname{hsv}\\left(H_{N},1,1\\right)"},{"type":"expression","id":"19","color":"#388c46","latex":"H_{K}=320","slider":{"hardMin":true,"hardMax":true,"min":"0","max":"360"}},{"type":"expression","id":"120","color":"#2d70b3","latex":"H_{Kp}=\\operatorname{hsv}\\left(H_{K},1,1\\right)"},{"type":"expression","id":"20","color":"#6042a6","latex":"H_{A}=\\operatorname{hsv}\\left(I_{L}\\left(H_{N},H_{K},\\frac{K_{A}}{K_{A}+N_{A}}\\right),1,1\\right)"},{"type":"expression","id":"22","color":"#c74440","latex":"H_{E}=\\operatorname{hsv}\\left(I_{L}\\left(H_{N},H_{K},\\frac{K_{E}}{K_{E}+N_{E}}\\right),1,1\\right)"},{"type":"expression","id":"15","color":"#000000","latex":"H_{M}=\\operatorname{hsv}\\left(60,0.5,1\\right)"},{"type":"text","id":"38","text":"axon and exterior"},{"type":"expression","id":"16","color":"#c74440","latex":"W=5"},{"type":"expression","id":"11","color":"#c74440","latex":"\\left[\\operatorname{polygon}\\left(\\left(k-1,0\\right),\\left(k,0\\right),\\left(k,-W\\right),\\left(k-1,-W\\right)\\right)\\operatorname{for}k=\\left[1...L_{A}\\right]\\right]","lines":false,"colorLatex":"H_{A}","fillOpacity":"\\frac{K_{A}+N_{A}}{K_{E}+N_{E}}"},{"type":"expression","id":"14","color":"#6042a6","latex":"\\operatorname{polygon}\\left(\\left(0,0\\right),\\left(L_{A},0\\right)\\right)","fill":false,"colorLatex":"H_{M}","lineOpacity":"1","lineWidth":"20"},{"type":"expression","id":"13","color":"#388c46","latex":"\\left[\\operatorname{polygon}\\left(\\left(k-1,0\\right),\\left(k,0\\right),\\left(k,W\\right),\\left(k-1,W\\right)\\right)\\operatorname{for}k=\\left[1...L_{A}\\right]\\right]","lines":false,"colorLatex":"H_{E}","fillOpacity":"\\frac{K_{E}+N_{E}}{K_{A}+N_{A}}"},{"type":"text","id":"41","text":"diffuse along a line"},{"type":"expression","id":"47","color":"#c74440","latex":"\\delta=1","slider":{"hardMin":true,"hardMax":true,"min":"1"}},{"type":"expression","id":"23","color":"#2d70b3","latex":"D_{L}\\left(L\\right)=\\left[\\left\\{k=1:I_{L}\\left(L\\left[1\\right],L\\left[2\\right],\\min\\left(\\frac{1}{2}\\delta,0.25\\right)\\right),k=\\operatorname{length}\\left(L\\right):I_{L}\\left(L\\left[k\\right],L\\left[k-1\\right],\\min\\left(\\frac{1}{2}\\delta,0.25\\right)\\right),I_{L}\\left(L\\left[k\\right],\\frac{L\\left[k-1\\right]+L\\left[k+1\\right]}{2},\\min\\left(\\delta,0.5\\right)\\right)\\right\\}\\operatorname{for}k=\\left[1...\\operatorname{length}\\left(L\\right)\\right]\\right]"},{"type":"expression","id":"24","color":"#388c46","latex":"S_{L}=\\left(K_{A}\\to D_{L}\\left(K_{A}\\right),N_{A}\\to D_{L}\\left(N_{A}\\right),K_{E}\\to D_{L}\\left(K_{E}\\right),N_{E}\\to D_{L}\\left(N_{E}\\right)\\right)"},{"type":"text","id":"43","text":"transport by Na/K pump"},{"type":"expression","id":"77","color":"#2d70b3","latex":"\\varepsilon=0.3","slider":{"hardMin":true,"hardMax":true,"min":"0","max":"1"}},{"type":"expression","id":"104","color":"#388c46","latex":"D_{MK}\\left(X\\right)=\\left(K_{A}\\to K_{A}-X,K_{E}\\to K_{E}+X\\right)"},{"type":"expression","id":"105","color":"#6042a6","latex":"D_{MN}\\left(X\\right)=\\left(N_{A}\\to N_{A}-X,N_{E}\\to N_{E}+X\\right)"},{"type":"expression","id":"48","color":"#2d70b3","latex":"P_{S}=\\varepsilon\\min\\left(\\frac{N_{A}}{3},\\frac{K_{E}}{2}\\right)","hidden":true},{"type":"expression","id":"106","color":"#000000","latex":"D_{P}=\\left(D_{MK}\\left(-2P_{S}\\right),D_{MN}\\left(3P_{S}\\right)\\right)"},{"type":"text","id":"93","text":"transport by voltage-gated ion channels"},{"type":"folder","id":"99","title":"channel states: -1 = refractory, 0 = deactivated, 1 = activated","collapsed":true},{"type":"expression","id":"95","folderId":"99","color":"#000000","latex":"C_{N}=\\left[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\\right]"},{"type":"expression","id":"96","folderId":"99","color":"#c74440","latex":"C_{K}=\\left[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\\right]"},{"type":"expression","id":"121","color":"#388c46","latex":"\\left[\\operatorname{polygon}\\left(\\left(i-\\frac{4}{5},0\\right),\\left(i-\\frac{3}{5},0\\right)\\right)\\operatorname{for}i=\\left[1...L_{A}\\right]\\right]","fill":false,"colorLatex":"H_{Np}","lineOpacity":"C_{N}+\\frac{1}{4}","lineWidth":"20"},{"type":"expression","id":"122","color":"#388c46","latex":"\\left[\\operatorname{polygon}\\left(\\left(i-\\frac{2}{5},0\\right),\\left(i-\\frac{1}{5},0\\right)\\right)\\operatorname{for}i=\\left[1...L_{A}\\right]\\right]","fill":false,"colorLatex":"H_{Kp}","lineOpacity":"C_{K}+\\frac{1}{4}","lineWidth":"20"},{"type":"expression","id":"100","color":"#6042a6","latex":"D_{G}=\\left(C_{K}\\to\\left[\\left[\\left\\{u<-60:0,-1\\right\\},\\left\\{u>-45:1,0\\right\\},\\left\\{u<-20:-1,1\\right\\}\\right]\\left[C_{K}\\left[i\\right]+2\\right]\\operatorname{with}u=E_{A}\\left(i\\right)\\operatorname{for}i=\\left[1...L_{A}\\right]\\right],C_{N}\\to\\left[\\left[\\left\\{u<-60:0,-1\\right\\},\\left\\{u>-50:1,0\\right\\},\\left\\{u>10:-1,1\\right\\}\\right]\\left[C_{N}\\left[i\\right]+2\\right]\\operatorname{with}u=E_{A}\\left(i\\right)\\operatorname{for}i=\\left[1...L_{A}\\right]\\right],D_{MK}\\left(\\left[\\left\\{C_{K}\\left[i\\right]=1:\\sqrt{\\delta\\varepsilon}K_{A}\\left[i\\right],\\frac{\\sqrt{\\delta\\varepsilon}}{30}K_{A}\\left[i\\right]\\right\\}\\operatorname{for}i=\\left[1...L_{A}\\right]\\right]\\right),D_{MN}\\left(\\left[\\left\\{C_{N}\\left[i\\right]=1:-\\sqrt{\\delta\\varepsilon}N_{E}\\left[i\\right],-\\frac{\\sqrt{\\delta\\varepsilon}}{30}N_{E}\\left[i\\right]\\right\\}\\operatorname{for}i=\\left[1...L_{A}\\right]\\right]\\right)\\right)"},{"type":"text","id":"58","text":"charge at each point (mV, axon relative to surroundings)"},{"type":"expression","id":"81","color":"#c74440","latex":"E_{p}\\left(n\\right)=70\\left(\\left(N_{A}\\left[n\\right]+K_{A}\\left[n\\right]\\right)-\\left(N_{E}\\left[n\\right]+K_{E}\\left[n\\right]\\right)\\right)","hidden":true},{"type":"expression","id":"83","color":"#388c46","latex":"V_{D}\\left(x,u\\right)=\\left\\{x+1>x:x,u\\right\\}"},{"type":"expression","id":"126","color":"#2d70b3","latex":"r_{a}=4","slider":{"hardMin":true,"hardMax":true,"min":"1","step":"1"}},{"type":"expression","id":"59","color":"#6042a6","latex":"E_{A}\\left(n\\right)=\\frac{\\sum_{j=-r_{a}}^{r_{a}}\\left(\\frac{1}{\\left|j\\right|+1}V_{D}\\left(E_{p}\\left(n+j\\right),-70\\right)\\right)}{\\sum_{j=-r_{a}}^{r_{a}}\\frac{1}{\\left|j\\right|+1}}","hidden":true},{"type":"expression","id":"127","color":"#c74440","latex":"E_{A}\\left(\\operatorname{floor}\\left(x\\right)\\right)+\\operatorname{mod}\\left(x,1\\right)\\left(E_{A}\\left(\\operatorname{floor}\\left(x\\right)+1\\right)-E_{A}\\left(\\operatorname{floor}\\left(x\\right)\\right)\\right)","hidden":true},{"type":"text","id":"55","text":"unify all the steps"},{"type":"folder","id":"114","title":"state variable","collapsed":true},{"type":"expression","id":"109","folderId":"114","color":"#388c46","latex":"s=2","slider":{"hardMin":true,"hardMax":true,"min":"0","max":"2","step":"1"}},{"type":"expression","id":"110","color":"#6042a6","latex":"S=\\left(\\left\\{s=0:S_{L},s=1:D_{P},s=2:D_{G}\\right\\},s\\to\\operatorname{mod}\\left(s+1,3\\right)\\right)"},{"type":"text","id":"117","text":"make an action potential!"},{"type":"expression","id":"118","color":"#000000","latex":"A=D_{MN}\\left(-0.3\\cdot\\left[\\frac{1}{\\left(\\frac{i-x_{AP}}{4}\\right)^{2}+1}\\operatorname{for}i=\\left[1...L_{A}\\right]\\right]\\right)"},{"type":"expression","id":"128","color":"#2d70b3","latex":"x_{AP}=0.74","slider":{"hardMin":true,"hardMax":true,"min":"0","max":"L_{A}"}},{"type":"expression","id":"129","color":"#fa7e19","latex":"\\left(x_{AP},1\\right)"}],"ticker":{"handlerLatex":"S","minStepLatex":"100","playing":true,"open":true}}}