Example Project and Numerical Integration Computational Neuroscience 03 Lecture 11.

Slides:



Advertisements
Similar presentations
Formal Computational Skills
Advertisements

Chapter 6 Differential Equations
Ch 2.7: Numerical Approximations: Euler’s Method
Arc-length computation and arc-length parameterization
A Sampling Distribution
Computational Methods in Physics PHYS 3437
Ordinary Differential Equations
Lecture 18 - Numerical Differentiation
1cs542g-term Notes  Notes for last part of Oct 11 and all of Oct 12 lecture online now  Another extra class this Friday 1-2pm.
Lecture 2: Numerical Differentiation. Derivative as a gradient
MATLAB Simulation Numerical Integration Dr. I.Fletcher School of Computing & Technology University of Sunderland.
INTEGRALS 5. INTEGRALS We saw in Section 5.1 that a limit of the form arises when we compute an area.  We also saw that it arises when we try to find.
16 MULTIPLE INTEGRALS.
In previous lecture, we dealt with the unboundedness problem of LPM using the logit model. In this lecture, we will consider another alternative, i.e.
Molecular Dynamics Classical trajectories and exact solutions
Copyright © Cengage Learning. All rights reserved. 5 Integrals.
Ordinary Differential Equations (ODEs)
Chapter 9 Numerical Integration Numerical Integration Application: Normal Distributions Copyright © The McGraw-Hill Companies, Inc. Permission required.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
Professor Walter W. Olson Department of Mechanical, Industrial and Manufacturing Engineering University of Toledo Solving ODE.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Ch 8.3: The Runge-Kutta Method
Tutorial 5: Numerical methods - buildings Q1. Identify three principal differences between a response function method and a numerical method when both.
EE3561_Unit 8Al-Dhaifallah14351 EE 3561 : Computational Methods Unit 8 Solution of Ordinary Differential Equations Lesson 3: Midpoint and Heun’s Predictor.
Javier Junquera Molecular dynamics in the microcanonical (NVE) ensemble: the Verlet algorithm.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
INTEGRALS Areas and Distances INTEGRALS In this section, we will learn that: We get the same special type of limit in trying to find the area under.
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
Integration of 3-body encounter. Figure taken from
INTEGRALS 5. INTEGRALS In Chapter 2, we used the tangent and velocity problems to introduce the derivative—the central idea in differential calculus.
Integrals  In Chapter 2, we used the tangent and velocity problems to introduce the derivative—the central idea in differential calculus.  In much the.
Professor Walter W. Olson Department of Mechanical, Industrial and Manufacturing Engineering University of Toledo Performance & Stability Analysis.
+ Numerical Integration Techniques A Brief Introduction By Kai Zhao January, 2011.
Finite Difference Methods Definitions. Finite Difference Methods Approximate derivatives ** difference between exact derivative and its approximation.
Engineering Analysis – Computational Fluid Dynamics –
© Imperial College London Numerical Solution of Differential Equations 3 rd year JMC group project ● Summer Term 2004 Supervisor: Prof. Jeff Cash Saeed.
12 INFINITE SEQUENCES AND SERIES. In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series.
Ch 8.2: Improvements on the Euler Method Consider the initial value problem y' = f (t, y), y(t 0 ) = y 0, with solution  (t). For many problems, Euler’s.
INTEGRALS We saw in Section 5.1 that a limit of the form arises when we compute an area. We also saw that it arises when we try to find the distance traveled.
5 INTEGRALS.
Lecture 40 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
ECE 576 – Power System Dynamics and Stability Prof. Tom Overbye Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
1/14  5.2 Euler’s Method Compute the approximations of y(t) at a set of ( usually equally-spaced ) mesh points a = t 0 < t 1
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapters 22 and 23.
1 Spring 2003 Prof. Tim Warburton MA557/MA578/CS557 Lecture 32.
NUMERICAL ANALYSIS I. Introduction Numerical analysis is concerned with the process by which mathematical problems are solved by the operations.
INFINITE SEQUENCES AND SERIES In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series and.
Announcements Please read Chapters 11 and 12
Numerical Integration Methods
Part 7 - Chapter 25.
Ordinary Differential Equations
ECE 576 – Power System Dynamics and Stability
Class Notes 18: Numerical Methods (1/2)
Class Notes 19: Numerical Methods (2/2)
CSE 245: Computer Aided Circuit Simulation and Verification
Finite Volume Method for Unsteady Flows
Ordinary differential equaltions:
Chapter 26.
Part 7 - Chapter 25.
Numerical Analysis Lecture 37.
SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM (Term 101) Section 04 Read , 26-2, 27-1 CISE301_Topic8L2.
Numerical Analysis Lecture 38.
Numerical Integration Methods
MATH 175: Numerical Analysis II
Errors and Error Analysis Lecture 2
Modeling and Simulation: Exploring Dynamic System Behaviour
Presentation transcript:

Example Project and Numerical Integration Computational Neuroscience 03 Lecture 11

Example Project: Investigation into Integrate and fire models Build a model integrate and fire neuron using Augmented by the rule that if V reaches V th an AP is fired after which V is reset to V reset Use E L = -80mV, V rest = -70mV, R m = 10M m = 10 ms. Initially set V=V rest. When the membrane potential reaches V th = -54mV make the neuron fire a spike and reset the potential to V reset = -80mV. Show sample voltage traces (with spikes) for a 300ms long current pulse centered in a 500ms long simulation.

Determine the firing rate of the model and compare it with the theoretical prediction:

Investigate the behaviour of this neuron and see how the outputs change if different parameters are modelled. Eg above we see what happens if the current injection is not constant.

Alternatively one could investigate introducing spike rate adaptation by adding a conductance Where r m g sra = 0.06, sra = 100ms E K =-70mV And after a spike is fired

Or one can simulate adding an excitatory synaptic conductance with I e =0 P s is probability of firing and changes whenever the presynaptic neuron fires using: And after a spike is fired Here use E s = 0 r m g s = 0.5, s = 10ms P max =0.5. Plot V(t) and the synaptic current and trigger synaptic events at times: 50, 150, 190, 300, 320 and 400 Another interesting avenue is to add a calcium-based conductance and see if one can get bursting behaviour Or one can couple 2 IAF neurons etc etc

Numerical Integration However whatever scheme one attempts it will be necessary to use some numerical integration (although the equation can be solved for constant I e ). The idea behind numerical integration is very simple and intuitive and can be seen from the following figure: Here we estimate the area under the curve by summing the areas of the trapezium. But what if we are dealing with a differential equation?

Difference Equations Eg consider the IAF equation: The key idea here is to go back to the definition of the differential ie We can then replace the differential (LHS of above) with the finite difference (RHS of above). Alternatively we note that: and iteratively solve: Eulers method

tt+h y(t) y(t+h) h dy/dt Eulers method effectively evaluates the function at the future timestep by evaluating the gradient at t and assuming it is constant over the range h Thus the accuracy of y(t+h) is increased (in one sense, see later) by making the increase in time-step h small

t t+h y(t) y(t+h) t+2h y(t+2h) We then iteratively produce the rest of the y-values as illustrated above ie dy/dt evaluated at t+h and h times this value added to y(t+h) to get y(t+2h) etc etc

Can make the reliance of the accuracy of Eulers method on h explicit by examining the Taylor expansion of y(t) ie: So if we say: y(t+h) = y(t) +h dy/dt +err Then the error term is: Thus for small h the error is determined by the factor h 2 ie O(h 2 ) and the method is said to be first order accurate (as we would divide by h to estimate dy/dt) NB note error does also depend on higher order differentials so normally have to assume y is sufficiently smooth

However, this procedure is assymetric as we assume dy/dt has a constant value evaluated at beginning of the time interval More symmetric (and accurate) to use an estimate from the middle of the interval ie at h/2 tt+h y(t) y(t+h) h dy/dt tt+h y(t) y(t+h) h dy/dt t+h/2

However to do this we will need to use the value of y at t+h/2 which we do not yet know Thus we first have to estimate y(t+h/2) using dy/dt evaluated at t and then use this estimate to evaluate dy/dt at t+h/2 as illustrated below: tt+h y(t+h/2) t+h/2 Ie if dy/dt= f(y,t): y(t+h/2) = y(t) + h/2 f( y(t), t) (estimate 1 in figure) y(t+h) = y(t) + h f( y(t+h/2), t+h/2) (estimate 2 in figure) This is the 2 nd Order Runge-Kutta method 1 2

As the name suggests it is 2 nd order accurate (method called nth order if error term is O(h n+1 ) Why? So comparing this estimate with the Taylor expansion: We see the error is O(h 3 )

Using a similar procedure but using 4 evaluations of dy/dt we get the commonly used 4 th order Runge-Kutta (again dy/dt written as f(y, t) k 1 = h f( y(t), t) k 2 = h f( y(t)+k 1 /2, t+h/2) = h f( y(t+h/2), t+h/2) k 3 = h f( y(t)+k 2 /2, t+h/2) k 4 = h f( y(t)+k 3, t+h) y(t+h) = y(t) + k 1 /6 + k 2 /3 + k 3 /3 + k 4 /6 + O(h 5 )

However, note that high order does NOT imply high accuracy: rather it means that the method is more efficient ie quicker to run Generally, for difficult functions (non-smooth) the simpler methods will be more accurate Errors can also arise as a consequence of round-off errors due to computer evaluation Unfortunately, while truncation error reduces as we lower h, round-off errors will increase This results in constraints being placed on step-sizes used so that algorithm remains stable and round-off errors do not swamp the solution

Note that one can get an estimate of the gradient from an advanced timestep (forward differencing) or from a previous timestep (backward difference) Using forward differences (or mix of forwards and backwards) is a lot more computationally intensive as we then have to solve a set of simultaneous equations (though system is usually tridiagonal), but often need to do so as these schemes (implicit) are much more stable

EG: IAF equation Back to the IAF equation: Becomes: Where timestep is 1 ms (as long as it doesnt vary too quickly).

If there are gating variables for conductances etc they can be integrated in the same way eg These should be updated at different times to the voltage ie if V is computed at times 0, t, 2t, 3t etc, then z would be updated at times t/2, 3t/2, 5t/2 etc If calcium based conductances are included, they should be updated simultaneously with V Also, remember that if you can analytically integrate an equation you should eg