Answers to homework


Homework 1.3

3
# the number of things to plot is 3

# declare the variables setting v(0) to rest
variable v=-60

# declare other stuff to plot
aux ica,il

# declare the parameters
param vl=-60,vca=120
param i=0,gl=2,gca=4,c=20
param v1=-1.2,v2=18

# user defined functions 
user minf 1 .5*(1+tanh((arg1-v1)/v2))

# right-hand sides of ODES in order of declaration
odev (i+gl*(vl-v)+gca*minf(v)*(vca-v))/c

# definitions of auxiliary quantities in order of declaration
oica gca*minf(v)*(v-vca)
oil gl*(v-vl)

done

In the new format:
# One fast persistent calcium channel
# Here is the equation
dv/dt=(i+gl*(vl-v)+gca*minf(v)*(vca-v))/c

#and the initial condition
V(0)=-60

# and the calcium current
aux ica=gca*minf(v)*(v-vca)
aux il=gl*(v-vl)
# and the parameters
param vl=-60,vca=120
param i=0,gl=2,gca=4,c=20
param v1=-1.2,v2=18

# and the functions
minf(v)=.5*(1+tanh((v-v1)/v2))
done

Homework 1.4b

The old style:

1
v a=0
par beta=2,theta=1,i=0,tau=1,w=1
user f 1 1/(1+exp(-beta*(arg1-theta)))
o (-a+w*f(a)+i)/tau
done
In the new style
# nnet1
da/dt = (-a+w*f(a)+i)/tau
f(a)=1/(1+exp(-beta*(a-theta)))
par beta=2,theta=1,i=0,tau=1,w=1
done

PIR ODE file

Here it is in the old style
5
v v,h,sa,tb,sb
f ssyn
p gca=1,vk=-90,fh=2,vca=120
p gl=.1,vl=-70,i=0
p gsyna=0,gsynb=0,vsyna=-85,vsynb=-90,tvsyn=-40
p fka=2,rka=.08
u ph 1 1/(1+exp((arg1+79)/5))
u ps 1 1/(1+exp(-(arg1+65)/7.8))
u tauh 1 ph(arg1)*exp((arg1+162.3)/17.8)+20
#
ov'= gl*(vl-v)+gca*(vca-v)*h*ps(v)^3+i
oh'= (ph(v)-h)*fh/tauh(v)
# GABA A synapse
osa'= fka*ssyn*(1-sa)-rka*sa
# GABA B synapse
otb'= 5*ssyn*(1-tb)-.007*tb
osb'= .03*tb*(1-sb)-.005*sb
#
ossyn= 1/(1+exp(-(v+40)/2))
done
and again in the new style
# PIR Model with GABA_A and GABA_B synapses
p gca=1,vk=-90,fh=2,vca=120
p gl=.1,vl=-70,i=0
p gsyna=0,gsynb=0,vsyna=-85,vsynb=-90,tvsyn=-40
p fka=2,rka=.08
ph(v)=1/(1+exp((v+79)/5))
ps(v)= 1/(1+exp(-(v+65)/7.8))
tauh(v)= ph(v)*exp((v+162.3)/17.8)+20
#
v'= gl*(vl-v)+gca*(vca-v)*h*ps(v)^3+i
h'= (ph(v)-h)*fh/tauh(v)
#
# GABA A synapse
sa'= fka*ssyn*(1-sa)-rka*sa
#
# GABA B synapse
tb'= 5*ssyn*(1-tb)-.007*tb
sb'= .03*tb*(1-sb)-.005*sb
#
ssyn= 1/(1+exp(-(v+40)/2))
done
Return to tutorial