Академический Документы
Профессиональный Документы
Культура Документы
M AIKEL M. B OSSCHAERT
Department of Mathematics
Hasselt University
Diepenbeek Campus
Agoralaan Gebouw D
3590 Diepenbeek
September 8, 2016
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
6. Assignment 21
2
1. Numerical Continuation
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.
2. Stability
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
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,
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).
f ( x, . . . , x, )
S f ( x, q, ) = ( x, , 0)q = 0 (6)
cT q 1
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
3. DDE-BifTool
3.1. Installation
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.
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
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
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.
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;
end
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;
end
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.
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
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)
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]);
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 ;
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.
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]
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
% 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
branch1 =
ans =
free: 1
min_bound: [2x2 double]
max_bound: []
max_step: []
ans =
5 0
6 0
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 =
branch1 =
method: [1x1 struct]
parameter: [1x1 struct]
point: [1x42 struct]
s =
22
f =
0
r =
0
branch1 =
method: [1x1 struct]
parameter: [1x1 struct]
point: [1x43 struct]
s =
19
f =
0
r =
0
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
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 ) ;
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
16
col: 1
func: ''
ym =
field: 'stability'
subfield: 'l1'
row: 'all'
col: 1
func: 'real'
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 ) ) ;
% 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.
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 ) ;
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 ] ) ;
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 , : ) )
19
102
0
x
t
(a)
0
x
2
0 200 400 600 800 1,000 1,200 1,400 1,600 1,800
t
(b)
20
6. Assignment
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,
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 = [];
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
24