# 程序代写代做代考 python Computation Neuroscience – coursework 1

Computation Neuroscience – coursework 1

Coursework 1

Solving differential equations with Euler’s method

The following questions are to help you practise your Python, they are not to be submitted
and will not be marked, instead you can compare to the model graphs available in the same
github folder.

1. Solve numerically in Python using Euler’s method the differential equation

df

dt
= f2 − 3f + e−t (1)

on the interval [0, 3] with time step δt = 0.01 and graph the solution, taking care to
label the axes. Although Python has good libraries for solving differential equations
numerically it would be useful educationally not to use them for these question.

2. For the problem above try solve with δt = 0.01, 0.1, 0.5 and one. Plot all the curves on
one graph. What is a good value of δt for this equation.

Integrate and fire neurons

The questions in this section are to be submitted for marking and will make up 10% of your
final mark. In this and next assignments, all the plots should have axes labels, and if there are
multiple graphs on a plot, the legend (or key) should be included. For each missing label or
legend, 1% of mark will be subtracted.

Write a brief report, no longer than three pages including the figures and the comments
specified above; submissions exceeding the page limit will be rejected, I will take a dim view
of super-narrow margins or tiny fonts. Submit it in the pdf format together with the Python
code by the deadline. Remember, provided it is in good time, I am happy to answer questions
about Python and to help debug faulty code.

1. Simulate an integrate and fire model with the following parameters for 1 s: τm = 10ms,
EL = Vr = −70 mV, Vt = −40 mV, Rm = 10 MΩ, Ie = 3.1 nA. Use Euler’s method
with timestep δt = 1 ms. Here EL is the leak potential, Vr is the reset voltage, Vt is
the threshold, Rm is the membrane resistance, that is one over the conductance, and τm
is the membrane time constant. Plot the voltage as a function of time. For simplicity
assume that the neuron does not have a refractory period after producing a spike. [20%
of marks]. You do not need to plot spikes – once membrane potential exceeds threshold,
simply set the membrane potential to Vr.

2. Compute analytically the minimum current Ie required for the neuron with the above
parameters to produce an action potential. [10% of marks].

3. Simulate the neuron for 1 s for the input current with amplitude Ie which is 0.1 [nA]
lower than the minimum current computed above, and plot the voltage as a functions of
time. [15% marks].

4. Simulate the neuron for 1s for currents ranging from 2 [nA] to 5 [nA] in steps of 0.1
[nA]. For each amplitude of current count the number of spikes produced, that is the
firing rate. Plot the firing rate as the function of the input current. [15% of marks]. It

1

Computation Neuroscience – coursework 1

is possible to calculate this curve analytically; there is no requirement that you do this,
but you might find it interesting to try.

5. Simulate two neurons which have synaptic connections between each other, that is the
first neuron projects to the second, and the second neuron projects to the first. Both
model neurons should have the same parameters: τm = 20 ms, EL = −70 mV Vr =
−80 mV Vt = −54 mV RmIe = 18 mV and their synapses should also have the same
parameters: Rmḡs = 0.15, P = 0.5, τs = 10 ms; don’t get confused by being given Rmḡs
rather than ḡs on its own, to get τm rather than the capacitance on the left hand side of
the integrate and fire equation everything is multiplied by Rm. For simplicity take the
synaptic conductance to satisfy

τs
ds

dt
= −s (2)

with a spike arriving causing s to increase by P . This is equivalent to the simple synapse
model in the lectures. Simulate two cases: a) assuming that the synapses are excitatory
with Es = 0 mV, and b) assuming that the synapses are inhibitory with Es = −80 mV.
For each simulation set the initial membrane potentials of the neurons V to different
values chosen randomly from between Vr and Vt and simulate 1 s of activity. For each
case plot the voltages of the two neurons on the same graph (with different colours).
[20% of marks].

6. In many real neurons the firing rate falls off after the first few spikes. This can be
simulated with a slow potassium current. For the neuron described in the first question
add a slow potassium current. This current should have reversal potential EK = −80 mV,
its conductance should increase by 0.005 (MΩ)−1 every time there is a spike, otherwise
it should decay towards zero with time constant τ = 200 ms. Plot the voltage of this
neuron for one second. [10% of marks].

7. This is a slightly more open-ended question. Consider the model with coupled neurons,
but use an alpha function to model s(t) rather than the single exponential model. Does
this change the behaviour? [10% of marks].

2