You are on page 1of 24

TUTORIAL II:

C ONTINUATION OF EQUILIBRIA IN ONE PARAMETER


AND DETERMINING THEIR STABILITY. D ETECTION OF
CODIM 1 ( FOLD AND H OPF ) BIFURCATIONS OF
EQUILIBRIA .

M AIKEL M. B OSSCHAERT

Department of Mathematics
Hasselt University
Diepenbeek Campus
Agoralaan Gebouw D
3590 Diepenbeek

September 8, 2016

U NDER SUPERVISION OF P ROF. D R . Y URI A. K UZNETSOV


Contents

1. Numerical Continuation 3

2. Stability 3
2.1. Fold (1 = 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2. Hopf (1,2 = i0 ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3. DDE-BifTool 5
3.1. Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2. System Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2.1. Right-hand side sys_rsh . . . . . . . . . . . . . . . . . . . . . . . 6
3.2.2. Delays sys_tau . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.3. Jacobians of right-hand side sys_deri (optional, but recommended) 8

4. Collecting user functions into a structure call set_funcs 9

5. Continuation and detection in DDE-BifTool 10


5.1. Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.2. Define steady state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.3. Linear stability of initial equilibrium . . . . . . . . . . . . . . . . . . . . . 11
5.4. Initialize branch of trivial equilibria . . . . . . . . . . . . . . . . . . . . . 13
5.5. Extend and continue branch of trivial steady states . . . . . . . . . . . . . 13
5.6. Stability of branch of equilibria . . . . . . . . . . . . . . . . . . . . . . . . 14
5.7. Locating the first Hopf point . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.8. Dynamics near Hopf point . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

6. Assignment 21

A. System function neural_deri.m 22

2
1. Numerical Continuation

Consider a system of Delay Differential Equations (DDEs) with constant delays,

x (t) = f ( x (t 0 ), x (t 1 ), . . . , x (t m ), ), (1)
where x (t) Rn , f : Rn(m+1) R p Rn is a smooth function depending on a number
of parameters R p , and i , i = 0, . . . , m are delays, ordered such that 0 = 0 1
m . Assume for the moment that p = 1 and

f ( x , . . . , x , 0 ) = 0.

Then x is called an equilibrium, stationary point or steady-state at the parameter value


= 0 . Tracing this equilibrium solution is the basic goal of a numerical continuation
routine. In this way we obtain a branch of equilibria x () for which x (0 ) = x . During
continuation, the branch is extended by a combination of predictions and corrections. A
new point is predicted based on previously computed points using secant prediction
over an appropriate steplength. The prediction is then corrected using the determining
system
f ( x , . . . , x , 0 ) = 0
bordered with a steplength condition which requires orthogonality of the correction to
the secant vector.

2. Stability

Let x be a stationary point at = 0 of the DDE (1). The (local) stability of x is


generically determined by the stability of the trivial solutions of the linearized problem
m
y(t) = A0 ( x , 0 )y(t) + Ai ( x , 0 )y(t i ), (2)
i =1

where, using f f ( x0 , x1 , . . . , x m , ),

f
A i ( x , 0 ) = ( x (0), x (1 ), . . . , x (m ), 0 ), i = 0, . . . , m (3)
xi
Define the n n-dimensional matrix as
m
( x , 0 , ) = I A0 ( x , 0 ) Ai ( x , 0 )ei . (4)
i =1

Then the characteristic equation reads

det(( x , 0 , )) = 0. (5)

3
Equation (5) has an infinite number of eigenvalues C of x , which determine
the linearized stability of the steady state solution x . The steady state solution is
(asymptotically) stable provided all roots of the characteristic equation (5) have negative
real part; it is unstable if there exists a root with positive real part. It is known that the
number of roots in any right half plane <() > , R is finite, hence, the stability is
always determined by a finite number of roots. n. These roots are first approximated
using a linear multistep method (LMS-method) applied to (2) and then corrected using a
Newton iteration on the determining system
(
()v = 0,
H
c v 1 = 0,

where as initial value for v, the eigenvector of () corresponding to the smallest


eigenvalue (in modulus), see [3].
Bifurcations occur whenever roots arrive at the imaginary axis as one or more parameters
are changed. A function along the considered branch that has a regular zero at a
bifurcation is called a test function.
After a test function indicates a bifurcation by changing its sign, we need to locate the
bifurcation point accurately. Depending on the point under consideration we use the
bisection method or apply Newton on a special defining system to achieve this.
When continuing a steady-state of a DDE, we generally expect to encounter codimension-
1 bifurcations, that is fold or Hopf bifurcations. We therefore start by defining test
functions for these two bifurcations.

2.1. Fold (1 = 0)

At a fold point the characteristic equation (5) has a simple eigenvalue 1 = 0 and no other
eigenvalues on the imaginary axis. A test function to detect this bifurcation is given by

f = det (0).

To locate the fold point, the defining system

f ( x, . . . , x, )

S f ( x, q, ) = ( x, , 0)q = 0 (6)
cT q 1

is used. Here c T q 1 presents a suitable normalization of q Rn . The vector c Rn is


T
chosen as c = q(0) /(q(0) q(0) ), where q(0) is the initial value of q. Solving this system by
Newtons method gives ( x, q, ), corresponding to the fold point.
If the steady-state x 0 of (1) has a fold bifurcation at the parameter value 0 = 0,
then generically, as passes through = 0 , two equilibria collide, form a critical
saddle-node equilibrium, and disappear, see [2].

4
2.2. Hopf (1,2 = i0 )

At a (Andronov-)Hopf bifurcation point the characteristic equation (5) has a simple pair of
purely imaginary complex conjugate eigenvalues 1,2 = i, with > 0, and no other
eigenvalues on the imaginary axis. For a test function we look at the sign of the smallest
real part of the complex eigenvalue pairs.
When a bifurcation is detected we locate the Hopf point using the defining system

f ( x, . . . , x, )

S H ( x, q, , ) = ( x, , i )q = 0. (7)
H
c q1

Here c H q 1 presents a suitable normalization of q Cn . The vector c Cn is chosen as


H
c = q(0) /(q(0) q(0) ), where q(0) is the initial value of q. Solving this system by Newtons
method gives ( x, q, , ), corresponding to the Hopf point.
If the steady-state x 0 of (1) has a Hopf bifurcation at the parameter value 0 = 0,
then generically, as passes through = 0 , the equilibrium changes stability and
a unique limit cycle bifurcates from it, see [2]. Depending on the sign of the first
Lyapunov coefficient `1 (0), see (12), the bifurcation can be supercritical or subcritical,
resulting in stable or unstable (within an invariant two-dimensional manifold) limit
cycle, respectively.

3. DDE-BifTool

3.1. Installation

DDE-BifTool is a set of routines for performing numerical bifurcation analysis of delay-


differential equations running in Matlab1 or GNU Octave2 . The installation files for
DDE-BifTool can be retrieved from sourceforge.net3 as a ZIP file. Upon unzipping
the file, a new directory dde_biftool_vx.x is created, where x.x depend on the version
number. This folder should be placed somewhere that is already in the Matlab path,
or should be added to the path manually. The directory dde_biftool_vx.x contains the
following subfolders
ddebiftool basic DDE-BifTool routines,
demos example scripts illustrating the use of DDE-BifTool (a new folder under this
directory is an appropriate location for adding new examples),
ddebiftool_extra_psol extension for local bifurcations of periodic orbits,
ddebiftool_extra_nmfm extension for normal form coefficient computations at local bi-
furcations of equilibria in DDEs with constant delay,
1 http://www.mathworks.com
2 http://www.gnu.org/software/octave
3 https://sourceforge.net/projects/ddebiftool/files/latest/download

5
ddebiftool_utilities auxiliary functions,
ddebiftool_extra_rotsym extension for systems with rotational symmetry.
external_tools support scripts, such as a Mathematica and a Maple script for generating
derivative functions used in DDE-BifTool.

3.2. System Functions

Before we can start using DDE-BifTool we first need to create the system files. As
an illustrative example the following model of two interacting layers of neurons is
considered

x1 (t) = x1 (t) ag(bx1 (t 1 )) + cg(dx2 (t 2 )),



(8)
x2 (t) = x2 (t) ag(bx2 (t 1 )) + cg(dx1 (t 2 )),

see [5] and [4]. The variables x1 (t) and x2 (t) represent the population-averaged neural
activity at time t in layers one and two, respectively. The parameter a > 0 is a measure of
the strength of inhibitory feedback, while c > 0 measures the strength of the excitatory
effect of one layer on the other. The parameters b > 0 and d > 0 are saturation rates
and the delays 1,2 represent time lags in the inhibitory feedback loop and excitatory
inter-layer connection. Note that the system is symmetric with respect to interchanging
the labels 1 and 2, so equilibria are necessarily of the form ( x0 , x0 ). The function g is
smooth, strictly increasing and satisfies g(0) = 0 and g0 (0) = 1. We fix the numerical
parameter values

b = 2.0, d = 1.2, 1 = 12.7, 2 = 20.2

and take for g : R R the sigmoidal form

g(z) = [tanh(z 1) + tanh(1)] cosh(1)2 .

For more information about the system and the meaning of the parameters we refer to
[5] and [4].
To define system (8), the user should provide several Matlab functions, given in the
following paragraphs.

3.2.1. Right-hand side sys_rsh

The right-hand side is a function of two arguments. For our example (8), this would
have the form (giving the right-hand side the name neuron_sys_rhs)
function f = neuron_sys_rhs(xx,par)

f(1,1) = -xx(1,1)-par(1)*(tanh(par(2)*xx(1,2)-1)+tanh(1))*cosh(1)^2...
+par(3)*(tanh(par(4)*xx(2,3)-1)+tanh(1))*cosh(1)^2;
f(2,1) = -xx(2,1)-par(1)*(tanh(par(2)*xx(2,2)-1)+tanh(1))*cosh(1)^2...

6
+par(3)*(tanh(par(4)*xx(1,3)-1)+tanh(1))*cosh(1)^2;

% par = [a, b, c, d, tau1, tau2];

end

Listing 1: Definition for right-hand side of (8) as a variable.

Meaning of the arguments of the right-hand side function:


xx Rn(m+1) contains the state variable(s) at the present and in the past
par R1 p contains the parameters par = .
The delays i (i = 1 . . . , m) are considered to be part of the parameters (i = j(i) , i =
1, . . . , m). This is natural since the stability of steady solutions and the position and
stability of periodic solutions depend on the values of the delays. Furthermore delays
can occur both as a physical parameter and as delay, as in x = x (t ). From these
inputs the right hand side f is evaluated at time t. Note that the parameters have a
specific order in par indicated in the comment line.
An alternative (vectorized) form would be
function f = neuron_sys_rhs(xx,par)

f(1,1) = -xx(1,1,:)-par(1)*(tanh(par(2)*xx(1,2,:)-1)+tanh(1))*cosh(1)^2...
+par(3)*(tanh(par(4)*xx(2,3,:)-1)+tanh(1))*cosh(1)^2;
f(2,1) = -xx(2,1,:)-par(1)*(tanh(par(2)*xx(2,2,:)-1)+tanh(1))*cosh(1)^2...
+par(3)*(tanh(par(4)*xx(1,3,:)-1)+tanh(1))*cosh(1)^2;

% par = [a, b, c, d, tau1, tau2];

end

Listing 2: Alternative definition of the right-hand side of vectorized of (8) speed-up of


periodic orbit computations.

Note the additional colon (:) in argument xx. The form shown in Listing 2 can be called
in many points along a mesh simultaneously. Therefore, when continuing periodic,
homoclinic or heteroclinic orbits the form in Listing 2 is recommended.

3.2.2. Delays sys_tau

For constant delays another function is required which returns the position of the delays
in the parameter list. For our example, this is
neuron_tau=@()[5 6];

This function has no arguments for constant delays, and returns a row vector of indices
into the parameter vector.

7
length(nx) length(np) v J
f
1 0 empty = Anx(1) Rnn
xnx(1)
f
0 1 empty Rn 1
np(1)
2 f
1 1 empty nx(1)
Rn n
x np(1)
f
2 0 Cn 1 Anx(1) Cnn

x nx(2)

Table 1

3.2.3. Jacobians of right-hand side sys_deri (optional, but recommended)

Several derivatives of the right hand side function f need to be evaluated during
bifurcation analysis. By default, DDE-BifTool uses a finite-difference approximation,
implemented in f_deriv.m. For speed-up or in case of convergence difficulties the user
may provide the Jacobians derivatives of the right-hand side analytically as a separate
function. Its header is of the format
function J=sys_deri(xx,par,nx,np,v)

Arguments:
xx Rn(m+1) contains the state variable(s) at the present and in the past (as for
the right-hand side);
par R1 p contains the parameters par = . (as for the right-hand side);
nx (empty, one integer or two integers) index (indices) of xx with respect to which
the right-hand side is to be differentiated
np (empty or integer) whether right-hand side is to be differentiated with respect
to parameters
v (empty or Cn ) for mixed derivatives with respect to xx , only the product of the
mixed derivative with v is needed.
The result J is a matrix of partial derivatives of f which depends on the type of derivative
requested via nx and np multiplied with v (when nonempty), see table deri_requested.
J is defined as follows. Initialize J with f . If nx is nonempty take the derivative of
J with respect to those arguments listed in nxs entries. Each entry of nx is a number
between 0 and m based on f f ( x0 , x1 , . . . , x m , ). E.g., if nx has only one element take
the derivative with respect to xnx(1) . If it has two elements, take, of the result, the
derivative with respect to xnx(2) and so on. Similarly, if np is nonempty take, of the
resulting J, the derivative with respect to np(i) where i ranges over all the elements
of np, 1 i p. Finally, if v is not an empty vector multiply the result with v. The
latter is used to prevent J from being a tensor if two derivatives with respect to state
variables are taken (when nx contains two elements). Not all possible combinations

8
of these derivatives have to be provided. In the current version, nx has at most two
elements and np at most one. The possibilities are further restricted as listed in table 1.
In the last row of table 1 the elements of J are given by,

n
!
fi
 

J i,j =
xnx(2)
Anx(1) v = vk ,
i,j xnx(2)
j k =1 xknx(1)

with Al as defined in (3).


The resulting routine is quite long, even for the small system (8) . Furthermore, imple-
menting so many derivatives is an activity prone to a number of typing mistakes. There-
fore two scripts are provided with DDE-BifTool to automatically generate the system
files: a Mathematica notebook genr_sys.mth and the Maple script Maple_gen_sys.mw.
The Maple script is able to generate higher order derivatives needed for computation of
normal form coefficients. The script is easy to use and self explanatory. Alternatively,
a default routine df_deriv can be used which implements finite difference formulas to
approximate the requested derivatives (using several calls to the right-hand side). It is,
however, recommended to provide at least the first order derivatives with respect to the
state variables using analytical formulas. These derivatives occur in the determining
systems for fold and Hopf bifurcations and for connecting orbits, in the computation of
characteristic roots and Floquet multipliers and computation of normal form coefficients.
Remark. Note that when using the vectorized form, see Section 3.2.1, then the derivative
file should also be written in vectorized form. This has not been implemented in the
automatic generation scripts and should be done by hand.

4. Collecting user functions into a structure call set_funcs

The user-provided (anonymous) functions described in the previous section are passed
on as an additional argument to all routines of DDE-BifTool (similar to standard Matlab
routines such as ode45). The additional argument is a structure funcs containing all
the handles to all user-provided functions. In order to create this structure the user is
recommended to call the function set_funcs at the beginning of the script performing
the bifurcation analysis:
function funcs = set_funcs (...)

Its argument format is in the form of name-value pairs (in arbitrary order, similar to
options at the end of a call to plot). For the example system (8) the call to set_funcs
could look as follows:
funcs = set_funcs (...
'sys_rhs',@neuron_sys_rhs, ...
'sys_tau',@() [5 ,6] ,...
'sys_deri', @neuron_sys_deri...
);

9
If one does wish to not provide analytical derivatives, one may drop the 'sys_deri' pair
(then a finite-difference approximation, implemented in df_deriv, is used):
funcs = set_funcs ('sys_rhs',@neuron_sys_rhs,'sys_tau',@() [5 ,6]);

5. Continuation and detection in DDE-BifTool

In this Section we start using DDE-BifTool. As before, the Matlab code in the Listings
below is located in the folder demos/tutorials/II of the DDE-BifTool package. It is
strongly recommended follow the results by executing the code.

5.1. Initialization

First, we load the DDE-BifTool core and the DDE-BifTool utilities. Then we initialize
the funcs structure.
clear variables ;
close a l l ;

addpath ( ' . . / . . / . . / d d e b i f t o o l ' , . . .


' ../../../ ddebiftool_utilities ' );

g = @( z ) ( tanh ( z 1)+ tanh ( 1 ) ) * cosh ( 1 ) ^ 2 ;


neuron_sys_rhs = @( xx , par ) [
xx (1 ,1) par ( 1 ) * g ( par ( 2 ) * xx ( 1 , 2 ) ) + par ( 3 ) * g ( par ( 4 ) * xx ( 2 , 3 ) ) ;
xx (2 ,1) par ( 1 ) * g ( par ( 2 ) * xx ( 2 , 2 ) ) + par ( 3 ) * g ( par ( 4 ) * xx ( 1 , 3 ) )
];

funcs = set_funcs ( . . .
' s y s _ r h s ' , neuron_sys_rhs , . . .
' s y s _ t a u ' ,@ ( ) [ 5 , 6 ] , . . .
' s y s _ d e r i ' , @neuron_deri . . .
);

Once the user-defined functions are prepared, DDE-BifTool can compute and con-
tinue equilibria of the DDE, and compute their linearized stability, thus detecting
local bifurcations. The file neuron_deri.m has been generated with the Maple script
Maple_gen_sys.mw, see the Listing in Appendix A for its contents.

5.2. Define steady state

As an initial steady state we take the trivial solution ( x1 , x2 ) = (0, 0) with parameter
values
15
a = 0.25, b = 2.0, c = , d = 1.2, 1 = 12.7, 2 = 20.2.
29
In DDE-BifTool a single steady state is defined as a structure containing 4 fields, see
Table 2 and the code below.

10
field content
'kind' 'stst'
'parameter' R1 p
'x' Rn 1
'stability empty or struct

Table 2: Field names and corresponding content for the point structures used to represent
a steady state solution

% s e t parameter v a l u e s
a =0.25;
b=2.0;
c =15/29;
d=1.2;
tau1 = 1 2 . 7 ;
tau2 = 2 0 . 2 ;

% d e f i n e p o i n t s t r u c t u r e f o r a s i n g l e st e ad y s t a t e
s t s t . kind= ' s t s t ' ;
s t s t . parameter =[ a , b , c , d , tau1 , tau2 ] ;
stst . x=[0;0]

stst =

kind: 'stst'
parameter: [0.2500 2 0.5172 1.2000 12.7000 20.2000]
x: [2x1 double]
stability: [1x1 struct]

5.3. Linear stability of initial equilibrium

We get default point method parameters for the steady state using the function df_mthod.
These parameters, such as max_number_of_eigenvalues, max_newton_iterations and
minimal_real_part, are used for continuation, solving and stability. For a complete
list of the parameters we refer to the DDE-BifTool manual [3]. We adjusted the default
value of minimal_real_part to 0.04, see Figure 1. Next we correct the point with
p_correc. The stability is then computed with p_stabil and added to the stability
field of the steady state stst. In Figure 1 the stability of the steady state is plotted with
the function p_stabil. It reveals that the steady state only has eigenvalues in the left
half open complex plane. Therefore the steady state is stable.
method=df_mthod ( funcs , ' s t s t ' ) ;
method . s t a b i l i t y . m i n i m a l _ r e a l _ p a r t = 0.04;
[ s t s t , s u c c e s s ]= p _ c o r r e c ( funcs , s t s t , [ ] , [ ] , method . p o i n t )

% compute i t s s t a b i l i t y :
s t s t . s t a b i l i t y = p _ s t a b i l ( funcs , s t s t , method . s t a b i l i t y )

11
2

1.5

=() 0.5

0.5

1.5

2
4 3.5 3 2.5 2 1.5 1 0.5 0

<() 102

Figure 1: Spectrum of equilibrium. Approximated () and corrected () roots of the


characteristic equation of neuron system at its steady state solution ( x1 , x2 ) =
(0, 0). Real parts computed up to <() 0.04.

% plot s t a b i l i t y
figure ( 1 ) ; c l f ;
p_splot ( s t s t ) ; % plot i t s s t a b i l i t y :

stst =

kind: 'stst'
parameter: [0.2500 2 0.5172 1.2000 12.7000 20.2000]
x: [2x1 double]
stability: []

success =

stst =

kind: 'stst'
parameter: [0.2500 2 0.5172 1.2000 12.7000 20.2000]
x: [2x1 double]
stability: [1x1 struct]

12
5.4. Initialize branch of trivial equilibria

In DDE-BifTool a branch is represented by a structure containing three fields:


point: contains an array of points that are on the branch
method: parameters are set for continuation, solving and stability
parameter: information about which parameters to continued, the maximum step
size and boundaries for these parameters
We will use the point stst as a first point to compute a branch of steady state solutions.
First, we obtain an empty branch with free parameter a, bounded by 0 a 0.5 and
a 0.005 between points.
% g e t an empty branch with ind_a as a f r e e parameter :
ind_a = 1 ;
branch1=df_brnch ( funcs , ind_a , ' s t s t ' )
branch1 . parameter
branch1 . parameter . min_bound
% s e t bounds f o r c o n t i n u a t i o n parameter
branch1 . parameter . min_bound ( ind_a , : ) = [ ind_a 0 ] ;
branch1 . parameter . max_bound ( ind_a , : ) = [ ind_a . 5 ] ;
branch1 . parameter . max_step ( ind_a , : ) = [ ind_a 0 . 0 5 ] ;
% use s t s t as a f i r s t branch p o i n t :
branch1 . p o i n t = s t s t ;

branch1 =

method: [1x1 struct]


parameter: [1x1 struct]
point: []

ans =

free: 1
min_bound: [2x2 double]
max_bound: []
max_step: []

ans =

5 0
6 0

5.5. Extend and continue branch of trivial steady states

To obtain a second starting point we change parameter value a slightly and correct again.
stst2=stst ;
s t s t 2 . parameter ( ind_a )= s t s t 2 . parameter ( ind_a ) 0 . 0 0 1 ;
[ s t s t 2 , s u c c e s s ]= p _ c o r r e c ( funcs , s t s t 2 , [ ] , [ ] , method . p o i n t )
% use as a second branch p o i n t :
branch1 . p o i n t ( 2 ) = s t s t 2 ;
branch1 . method . c o n t i n u a t i o n . p l o t = 1 ;

13
% c o n t i n u e i n one d i r e c t i o n :
[ branch1 , s , f , r ]= br_contn ( funcs , branch1 , 3 0 0 ) ;
% turn t h e branch around :
branch1= b r _ r v e r s ( branch1 ) ;
% continue in the other d i r e c t i o n :
[ branch1 , s , f , r ]= br_contn ( funcs , branch1 , 3 0 0 ) ;

stst2 =

kind: 'stst'
parameter: [0.2490 2 0.5172 1.2000 12.7000 20.2000]
x: [2x1 double]
stability: []

success =

BR_CONTN warning: boundary hit.

branch1 =
method: [1x1 struct]
parameter: [1x1 struct]
point: [1x42 struct]

s =
22
f =
0
r =
0

BR_CONTN warning: boundary hit.

branch1 =
method: [1x1 struct]
parameter: [1x1 struct]
point: [1x43 struct]

s =
19
f =
0
r =
0

The plot of branch1 is shown in Figure 2.

5.6. Stability of branch of equilibria

During continuation, sixteen points were successfully computed (s = 22) before the
right boundary a = 0.4 was hit (signalled by a warning). No corrections failed ( f = 0)
and no computed points were later rejected (r = 0). Reversing the order of the branch
points allows to continue to the left.
We calculate the stability of the points on the branch by calling the function br_stabl.

14
1

0.8

0.6

0.4

0.2
x1

0.2

0.4

0.6

0.8

1
0.1 0 0.1 0.2 0.3 0.4 0.5

Figure 2: Plot of branch1

After obtaining suitable measure structures we plot the real part of the approximated
and corrected roots of the characteristic equation along the branch, see Figure 3.
branch1 . method . s t a b i l i t y . m i n i m a l _ r e a l _ p a r t = 0.01;
branch1= b r _ s t a b l ( funcs , branch1 , 0 , 1 ) ;

% o b t a i n s u i t a b l e s c a l a r measures t o p l o t s t a b i l i t y along branch :


[xm,ym]= df_measr ( 1 , branch1 )
figure ( 3 ) ; c l f ;
b r _ p l o t ( branch1 , xm, ym, ' b ' ) ; % p l o t s t a b i l i t y along branch :
ym. s u b f i e l d = ' l 0 ' ;
b r _ p l o t ( branch1 , xm, ym, ' c ' ) ;
% plot ([0 5] ,[0 0] , ' . ');
% a x i s ( [ 0 5 2 1 . 5 ] ) ;
x l a b e l ( ' a ' ) ; y l a b e l ( ' \Re\lambda ' ) ;
% p l o t s t a b i l i t y v e r s u s p o i n t number :
figure ( 4 ) ; c l f ;
b r _ p l o t ( branch1 , [ ] , ym, ' b ' ) ;
b r _ p l o t ( branch1 , [ ] , ym, ' b . ' ) ;
% plot ([0 30] ,[0 0] , ' . ');
x l a b e l ( ' p o i n t number along branch ' ) ; y l a b e l ( ' \Re (\ lambda ) ' ) ;

xm =

field: 'parameter'
subfield: ''
row: 1

15
102
1

0.5
<()

0.5

1
0 5 102 0.1 0.15 0.2 0.25 0.3 0.35 0.4

a
(a)

102
1

0.5
<()

0.5

1
5 10 15 20 25 30 35 40 45

point number along branch


(b)

Figure 3: Stability plot of branch1.

16
col: 1
func: ''

ym =

field: 'stability'
subfield: 'l1'
row: 'all'
col: 1
func: 'real'

5.7. Locating the first Hopf point

Where eigenvalue curves in the stability plot, see Figure 3, cross the zero line, bifurcations
occur. If we want to compute the Hopf bifurcation near a 0.8 we need its point
number. This is most easily obtained by plotting the stability versus the point numbers
along the branch. We select the last point with positive eigenvalues and turn it into
an (approximate) Hopf bifurcation point. We correct the Hopf point using appropriate
method parameters and one free parameter (a). We then copy the corrected point to
keep it for later use. Computing and plotting stability of the Hopf point clearly reveals
the pair of purely imaginary eigenvalues.
%% L o c a t i n g t h e f i r s t Hopf p o i n t
ind_hopf= f i n d ( a r r a y f u n (@( x )~ isempty ( x . s t a b i l i t y . l 0 ) . . .
&& r e a l ( x . s t a b i l i t y . l 0 ( 1 ) ) > 0 , branch1 . p o i n t ) , 1 , ' f i r s t ' ) ;
hopf=p_tohopf ( funcs , branch1 . p o i n t ( ind_hopf ) ) ;

% g e t hopf c a l c u l a t i o n method parameters :


method=df_mthod ( funcs , ' hopf ' , flag_newhheur ) ;
method . s t a b i l i t y . m i n i m a l _ r e a l _ p a r t = 0.02;

% c o r r e c t hopf
[ hopf , s u c c e s s ]= p _ c o r r e c ( funcs , hopf , ind_a , [ ] , method . p o i n t )

% compute s t a b i l i t y o f hopf p o i n t
hopf . s t a b i l i t y = p _ s t a b i l ( funcs , hopf , method . s t a b i l i t y ) ;

% plot s t a b i l i t y
figure ( 5 ) ; c l f ;
p _ s p l o t ( hopf ) ;

hopf =

kind: 'hopf'
parameter: [0.2989 2 0.5172 1.2000 12.7000 20.2000]
x: [2x1 double]
v: [2x1 double]
omega: 0.2711

success =

17
1.5

=() 0.5

0.5

1.5
2 1.5 1 0.5 0 0.5
<() 102
Figure 4: Stability plot of the Hopf point located at the parameter values
( a, b, c, d, 1 , 2 ) (0.29892, 0.5172, 1.2000, 12.70002, 0.2000). Here we see two
eigenvalues 0.2711i on the imaginary axis.

TIME_H warning: h_min is reached.

5.8. Dynamics near Hopf point

To determine the type of Hopf bifurcation we calculate the first Lyapunov coefficient
(see details in Tutorial III).
%% Compute t h e f i r s t Lyapunov c o e f f i c i e n t
addpath ( ' . . / . . / . . / ddebiftool_extra_nmfm ' ) ; % load t h e normal form package
hopf=nmfm_hopf ( funcs , hopf ) ;
f p r i n t f ( ' F i r s t Lyapunov c o e f f i c i e n t l 1 : %g\n ' , hopf . nmfm . L1 ) ;

First Lyapunov coefficient l1: -0.00545806

Since the sign of the first Lyapunov coefficient in negative the Hopf bifurcation is
supercritical.
We simulate the dynamics near the Hopf point with dde23 as in tutorial I. The listing
below generates Figure 5.
%% p l o t dynamics near Hopf
figure

18
% j u s t b e f o r e t h e Hopf b i f u r c a t i o n
history =[0.1 0 ] ;
par=hopf . parameter ;
par ( 1 ) = par ( 1 ) 0 . 0 4 ;
t f i n a l =1800;
s o l 1 = dde23 (@( t , y , Z) f u n c s . s y s _ r h s ( [ y , Z ] , par ) , par ( f u n c s . s y s _ t a u ( ) ) , . . .
history , [ 0 t f i n a l ] ) ;

plot ( sol1 . x , sol1 . y ( 2 , : ) )

xlabel ( ' t ' ) ;


ylabel ( ' x ' ) ;

par=hopf . parameter ;
par ( 1 ) = par ( 1 ) + 0 . 0 4 ;
s o l 1 = dde23 (@( t , y , Z) f u n c s . s y s _ r h s ( [ y , Z ] , par ) , par ( f u n c s . s y s _ t a u ( ) ) , . . .
history , [ 0 t f i n a l ]);
h i s t o r y =[1 0 ] ;
s o l 2 = dde23 (@( t , y , Z) f u n c s . s y s _ r h s ( [ y , Z ] , par ) , par ( f u n c s . s y s _ t a u ( ) ) , . . .
history , [ 0 t f i n a l ]);

figure
hold
plot ( sol1 . x , sol1 . y ( 2 , : ) )
plot ( sol2 . x , sol2 . y ( 2 , : ) )

xlabel ( ' t ' ) ;


ylabel ( ' x ' ) ;

19
102

0
x

0 200 400 600 800 1,000 1,200 1,400 1,600 1,800

t
(a)

0
x

2
0 200 400 600 800 1,000 1,200 1,400 1,600 1,800

t
(b)

Figure 5: Supercritical Hopf bifurcation in equation (8) at ( a, b, c, d, 1 , 2 )


(0.29892, 0.5172, 1.2000, 12.70002, 0.2000). In (a) the time series is plotted at
a 0.29892 0.04 with history function 1 (t) = [0.1; 0]. The solution con-
verges to the stable equilibrium x (t) = [0; 0] oscillating. In (b) the time series is
plotted at a 0.29892 + 0.04 just after the Hopf bifurcation. The red and blue
curves have history functions 1 (t) = [0.1; 0] and 2 (t) = [1; 0] respectively.
Both the solutions converge to the same stable cycle.

20
6. Assignment

Consider the following model


(
u1 (t) = u1 (t) + q11 (u1 (t-T )) q12 u2 (t-T ) + e1 ,
(9)
u2 (t) = u2 (t) + q21 (u1 (t-T )) q22 u2 (t-T ) + e2 ,

which describes the dynamics of a neural network consisting of an excitatory and


inhibitory neurons [1]. The variables and parameters occurring in (9) have the following
neurophysiological meaning:
u1 , u2 : R R denote the total post-synaptic potential of the excitatory and
inhibitory neurons, respectively.
> 0 is a time constant characterizing the dynamical properties of cell membrane.
qik 0 represents the strength of the connection line from the kth neuron to the ith
neuron.
: R R is the transfer function which describes the activity generation of the
excitatory neuron as a function of its total potential u1 . The function is smooth,
increasing and has an unique turning point at u1 = . The transfer function
corresponding to the inhibitory neuron is assumed to be the identity.
T 0 is a time delay reflecting synaptic delay, axonal and dendritic propagation
time.
e1 and e2 are external stimuli acting on the excitatory and inhibitory neuron,
respectively.
We consider equation (9) with

1 1
( u1 ) = 4u
, q11 = 2.6, q21 = 1.0, q22 = 0.0,
1+e 1 2
= 1.0, T = 1.0, e2 = 0.0,

and Q := q12 , E := e1 as bifurcation parameters. Substituting into (9) yields


(
u1 (t) = u1 (t) + 2.6(u1 (t-T )) Qu2 (t-T ) + E,
(10)
u2 (t) = u2 (t) + (u1 (t-T )).

A steady state solution of (10) is given by (u1? , u2? ) (0, 0) with E = 0 and Q arbitrary.
1. Generate the user functions for the DDE (10) with the Maple script Maple_gen_sys.mw
located in the external_tools folder.
2. Continue the steady state (u1? , u2? ) in Q.
3. Determine and plot the stability of the continued points.
4. Locate the fold point.
5. Plot the dynamics near the fold point with dde23.

21
A. System function neural_deri.m
f u n c t i o n J = n e u r a l _ d e r i ( xx , par , nx , np , v )

J = [];

i f l e n g t h ( nx ) == 1 && isempty ( np ) && isempty ( v )


switch nx
case 0
J = [ 1 , 0 ; 0 , 1];
case 1
J = [ par ( 1 ) * par ( 2 ) * (1 tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) ^2) * cosh ( 1 ) ^2 , 0 ; 0 , par ( 1 ) * par ( 2 ) * (1 tanh ( par ( 2 ) * xx
( 2 , 2 ) 1) ^2) * cosh ( 1 ) ^ 2 ] ;
case 2
J = [ 0 , par ( 3 ) * par ( 4 ) * (1 tanh ( par ( 4 ) * xx ( 2 , 3 ) 1) ^2) * cosh ( 1 ) ^ 2 ; par ( 3 ) * par ( 4 ) * (1 tanh ( par ( 4 ) * xx ( 1 , 3 )
1) ^2) * cosh ( 1 ) ^2 , 0 ] ;
end
e l s e i f isempty ( nx ) && l e n g t h ( np ) == 1 && isempty ( v )
switch np
case 1
J = [ ( tanh ( par ( 2 ) * xx ( 1 , 2 ) 1)+tanh ( 1 ) ) * cosh ( 1 ) ^ 2 ; (tanh ( par ( 2 ) * xx ( 2 , 2 ) 1)+tanh ( 1 ) ) * cosh ( 1 ) ^ 2 ] ;
case 2
J = [ par ( 1 ) * xx ( 1 , 2 ) * (1 tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) ^2) * cosh ( 1 ) ^ 2 ; par ( 1 ) * xx ( 2 , 2 ) * (1 tanh ( par ( 2 ) * xx ( 2 , 2 )
1) ^2) * cosh ( 1 ) ^ 2 ] ;
case 3
J = [ ( tanh ( par ( 4 ) * xx ( 2 , 3 ) 1)+tanh ( 1 ) ) * cosh ( 1 ) ^ 2 ; ( tanh ( par ( 4 ) * xx ( 1 , 3 ) 1)+tanh ( 1 ) ) * cosh ( 1 ) ^ 2 ] ;
case 4
J = [ par ( 3 ) * xx ( 2 , 3 ) * (1 tanh ( par ( 4 ) * xx ( 2 , 3 ) 1) ^2) * cosh ( 1 ) ^ 2 ; par ( 3 ) * xx ( 1 , 3 ) * (1 tanh ( par ( 4 ) * xx ( 1 , 3 ) 1)
^2) * cosh ( 1 ) ^ 2 ] ;
case 5
J = [0; 0];
case 6
J = [0; 0];
end
e l s e i f l e n g t h ( nx ) == 1 && l e n g t h ( np ) == 1 && isempty ( v )
switch nx
case 0
switch np
case 1
J = [0 , 0; 0 , 0];
case 2
J = [0 , 0; 0 , 0];
case 3
J = [0 , 0; 0 , 0];
case 4
J = [0 , 0; 0 , 0];
case 5
J = [0 , 0; 0 , 0];
case 6
J = [0 , 0; 0 , 0];
end
case 1
switch np
case 1
J = [ par ( 2 ) * (1 tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) ^2) * cosh ( 1 ) ^2 , 0 ; 0 , par ( 2 ) * (1 tanh ( par ( 2 ) * xx ( 2 , 2 ) 1)
^2) * cosh ( 1 ) ^ 2 ] ;
case 2
J = [ par ( 1 ) * (1 tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) ^2) * cosh ( 1 ) ^2+2 * par ( 1 ) * xx ( 1 , 2 ) * tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) *
par ( 2 ) * (1 tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) ^2) * cosh ( 1 ) ^2 , 0 ; 0 , par ( 1 ) * (1 tanh ( par ( 2 ) * xx ( 2 , 2 ) 1)
^2) * cosh ( 1 ) ^2+2 * par ( 1 ) * xx ( 2 , 2 ) * tanh ( par ( 2 ) * xx ( 2 , 2 ) 1) * par ( 2 ) * (1 tanh ( par ( 2 ) * xx ( 2 , 2 ) 1)
^2) * cosh ( 1 ) ^ 2 ] ;
case 3
J = [0 , 0; 0 , 0];
case 4
J = [0 , 0; 0 , 0];
case 5
J = [0 , 0; 0 , 0];
case 6
J = [0 , 0; 0 , 0];
end
case 2
switch np
case 1
J = [0 , 0; 0 , 0];
case 2
J = [0 , 0; 0 , 0];
case 3
J = [ 0 , par ( 4 ) * (1 tanh ( par ( 4 ) * xx ( 2 , 3 ) 1) ^2) * cosh ( 1 ) ^ 2 ; par ( 4 ) * (1 tanh ( par ( 4 ) * xx ( 1 , 3 ) 1) ^2) *
cosh ( 1 ) ^2 , 0 ] ;
case 4
J = [ 0 , par ( 3 ) * (1 tanh ( par ( 4 ) * xx ( 2 , 3 ) 1) ^2) * cosh ( 1 ) ^2 2* par ( 3 ) * xx ( 2 , 3 ) * tanh ( par ( 4 ) * xx ( 2 , 3 )
1) * par ( 4 ) * (1 tanh ( par ( 4 ) * xx ( 2 , 3 ) 1) ^2) * cosh ( 1 ) ^ 2 ; par ( 3 ) * (1 tanh ( par ( 4 ) * xx ( 1 , 3 ) 1) ^2)
* cosh ( 1 ) ^2 2* par ( 3 ) * xx ( 1 , 3 ) * tanh ( par ( 4 ) * xx ( 1 , 3 ) 1) * par ( 4 ) * (1 tanh ( par ( 4 ) * xx ( 1 , 3 ) 1) ^2)

22
* cosh ( 1 ) ^2 , 0 ] ;
case 5
J = [0 , 0; 0 , 0];
case 6
J = [0 , 0; 0 , 0];
end
end
e l s e i f l e n g t h ( nx ) == 2 && isempty ( np ) && ~isempty ( v )
nx1 = nx ( 1 ) ; nx2 = nx ( 2 ) ;
switch nx1
case 0
switch nx2
case 0
J = [0 , 0; 0 , 0];
case 1
J = [0 , 0; 0 , 0];
case 2
J = [0 , 0; 0 , 0];
end
case 1
switch nx2
case 0
J = [0 , 0; 0 , 0];
case 1
J = [ 2 * par ( 1 ) * par ( 2 ) ^2 * tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) * (1 tanh ( par ( 2 ) * xx ( 1 , 2 ) 1) ^2) * cosh ( 1 ) ^2 * v ( 1 ) ,
0 ; 0 , 2 * par ( 1 ) * par ( 2 ) ^2 * tanh ( par ( 2 ) * xx ( 2 , 2 ) 1) * (1 tanh ( par ( 2 ) * xx ( 2 , 2 ) 1) ^2) * cosh ( 1 ) ^2 *
v(2) ] ;
case 2
J = [0 , 0; 0 , 0];
end
case 2
switch nx2
case 0
J = [0 , 0; 0 , 0];
case 1
J = [0 , 0; 0 , 0];
case 2
J = [ 0 , 2* par ( 3 ) * par ( 4 ) ^2 * tanh ( par ( 4 ) * xx ( 2 , 3 ) 1) * (1 tanh ( par ( 4 ) * xx ( 2 , 3 ) 1) ^2) * cosh ( 1 ) ^2 * v
( 2 ) ; 2* par ( 3 ) * par ( 4 ) ^2 * tanh ( par ( 4 ) * xx ( 1 , 3 ) 1) * (1 tanh ( par ( 4 ) * xx ( 1 , 3 ) 1) ^2) * cosh ( 1 ) ^2 *
v(1) , 0];
end
end
end
i f isempty ( J )
d i s p l a y ( [ nx np s i z e ( v ) ] ) ;
e r r o r ( ' SYS_DERI : r e q u e s t e d d e r i v a t i v e could not be computed ! ' ) ;
end

23
References

[1] F. Giannakopoulos and A. Zapp. Bifurcations in a planar system of differential delay


equations modeling neural activity. Phys. D, 159(3-4):215232, 2001.
[2] Yu.A. Kuznetsov. Elements of Applied Bifurcation Theory, volume 112 of Applied
Mathematical Sciences. Springer-Verlag, New York, third edition, 2004.
[3] J. Sieber, K. Engelborghs, T. Luzyanina, G. Samaey, and D. Roose. DDE-
BifTool Manual-Bifurcation analysis of delay differential equations. arXiv preprint
arXiv:1406.7144, 2014.
[4] S. Visser. From spiking neurons to brain waves. PhD thesis, University of Twente,
Enschede, March 2013. http://eprints.eemcs.utwente.nl/23164/.
[5] S. Visser, H. G. E. Meijer, M. J. A. M. van Putten, and S. A. van Gils. Analysis of
stability and bifurcations of fixed points and periodic solutions of a lumped model
of neocortex with two delays. J. Math. Neurosci., 2:Art. 8, 24, 2012.

24

You might also like