Documente Academic
Documente Profesional
Documente Cultură
Abstract
CL MATCONT and its GUI version MATCONT are MATLAB pack-
ages for the study of dynamical systems and their bifurcations for small
and moderate size problems. CL MATCONTL is an extension of the
functionality of CL MATCONT to large-scale computations of equilibria
bifurcations, via subspace reduction. It allows to compute curves of equi-
libria, limit points, Hopf points, and branch switching. CL MATCONTL
can also monitor user - defined functions and locate their roots along com-
puted curves. It can compute all necessary derivatives by finite differences,
from file or by using the symbolic toolbox of MATLAB.
In this tutorial we describe a numerical study of a finite difference
discretization of the 1-D Brusselator, a well known model system for au-
tocatalytic chemical reactions with diffusion. Most of the capabilities of
CL MATCONTL are illustrated.
Contents
1 Introduction. 2
35899. The author was supported in part under NSF DMS-0209536 and NSF ATM-0417774.
¶ Mathematisch Instituut Budapestlaan 6, 3584CD Utrecht, The Netherlands.
1
2 bruss 1d1, bruss 1d2: Tutorial Demos, 1-D Brusselator. 5
2.1 Tutorial Demo: bruss 1d1. . . . . . . . . . . . . . . . . . . . . . 6
2.1.1 Copying the demo files. . . . . . . . . . . . . . . . . . . . 6
2.1.2 Continuation of equilibrium: testbruss BP0, testbruss LP0. 6
2.1.3 Continuation of fold points: testbruss LP1. . . . . . . . 8
2.1.4 Restarting at a user point: testbruss U0, testbruss U1. 8
2.1.5 Switching a branch: testbruss BP1. . . . . . . . . . . . . 10
2.2 Tutorial Demo: bruss 1d2. . . . . . . . . . . . . . . . . . . . . . 13
4 Options. 20
1 Introduction.
2
and sparse. In this case, an invariant subspace R(s) corresponding to a few
eigenvalues near the imaginary axis provides information about stability and
bifurcations.
CL MATCONT [7] and its GUI version MATCONT [6] are MATLAB pack-
ages for the study of dynamical systems and their bifurcations for small and
moderate size problems.
The CIS algorithm is an algorithm for computing a smooth orthonormal
basis for an invariant subspace R(s) of a parameter-dependent matrix A(s)
[5, 8, 11, 1], [2], [3]. This allows for computation and continuation of a much
smaller restriction C(s) := A(s)|R(s) of A(s) onto R(s). And C(s) provides the
relevant information about bifurcations.
We have incorporated the CIS algorithm (in this case A(x(s)) = fu (x(s)))
into CL MATCONT to extend its functionality to large-scale computations of
equilibria bifurcations, via subspace reduction, see [1], [4], [9], [3], [10], for
some initial results. This has resulted in a MATLAB bifurcation package
CL MATCONTL. This toolbox is developed with the following targets in mind:
3
H a Hopf point on a curve of equilibria
BP a branch point on a curve of equilibria
LP a limit point on a curve of equilibria
BT a Bogdanov-Takens point on a curve of limit points or Hopf points
ZH a zero-Hopf point on a curve of limit points or Hopf points
CP a cusp point on a curve of limit points
BP a branch point on a curve of limit points
DH a double-Hopf point on a curve of Hopf points
GH a generalized Hopf, or Bautin point on a curve of Hopf points
a the normal form coefficient of a limit point
We assume that the reader is familiar with dynamical systems theory and
knows about equilibria, Hopf points, etc., [12], [13]. We also assume an ele-
mentary knowledge of MATLAB but do not assume familiarity with numerical
methods.
4
2 bruss 1d1, bruss 1d2: Tutorial Demos, 1-D Brus-
selator.
The 1D Brusselator is a well known model system, intended to model the
Belusov - Zhabotinsky reaction, for autocatalytic chemical reactions with diffu-
sion:
d1 00 d2 00
l2 u − (b + 1)u + u2 v + a = 0, l2 v + bu − u2 v = 0, in Ω = (0, 1),
(3)
u(0) = u(1) = a, v(0) = v(1) = ab .
This problem exhibits a rich bifurcation scenario and has been used in the litera-
ture as a standard model for bifurcation analysis. The approximate equilibrium
nonconstant solution is:
½
u(x) = a + 2 sin(πx)
(4)
v(x) = ab − 12 sin(πx).
Running all the demos in sequence: rundemos. One can run all the demos
in sequence using a script to rundemos.m located in the /Testruns directory.
The text output from that script is saved in the file demos in the /Testruns
directory.
5
2.1 Tutorial Demo: bruss 1d1.
2.1.1 Copying the demo files.
Assume, you are in the ’CL MATCONTL’ directory
6
0.26
BPLP
0.24
BP
0.22
0.2
0.18
BP
0.16
0.14
0.12
0.1
BP
0.08
LP
0.06
1.98 1.99 2 2.01 2.02 2.03 2.04
7
tangent vector to first point found
Step 23: Singularity 3 detected ...
LP located: u = (+2.018576e+000,...,+2.295406e+000)
Active parameters = [+6.063973e-002 ]
Lyupanov Coefficient = 4.902650e+002
Last Point Found: u = (+2.020614e+000,...,+2.294900e+000)
Active parameters = [+6.081415e-002 ]
elapsed time = 8.8 secs
Number of Points in curve = 50
8
2.304
2.303
2.302
2.301
2.3
2.299
2.298
2.297
2.296
LP
2.295
2.294
2.011 2.012 2.013 2.014 2.015 2.016 2.017 2.018 2.019 2.02
9
6.5
u1
5.5
LP
5
4.5
4
2.2 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29
10
switch to the second branch and perform its continuation. The branch point
data can be obtained in one of three ways:
1. Calculating the normal form coefficients and then finding a tangent vector
to the second branch by using the algebraic branching equation (ABE).
2. Finding an orthogonal vector to the tangent vector to the first branch,
in the Null space of the Jacobian at the branch point, and using it as an
initial guess for a tangent vector to the second branch.
3. A bisection-like procedure, which is an improved version of 2.
Remark 1 In the tesrbruss BP0 run, the data for the run was saved using the
command:
s = saveSingPoints(’testbruss Branch’,s,p,ap1);
The data is then loaded in tesrbruss BP1, and the following lines are used
to perform continuation along the second branch.
load testbrussBranch s;
data = s(3);
ap1 = data.ap;
[s,filename] = run continuer(@bruss 1d1, @equilibriumL, data.p, ap1,
opt, data);
11
0.26
BPLP
0.25
0.24
BP
0.22
0.2
0.18
BP
BP
0.16
L
0.14
0.12
0.1
BP
0.08
LP
0.06
Figure 4: Switching a branch: the first branch of equilibria and the second
branch.
12
2.2 Tutorial Demo: bruss 1d2.
13
label = DH located: u=(+4.000000e+000,...,+4.302080e+000)
Active parameters = [ +1.720832e+001 +1.039496e+000]
Neutral saddle
Step 73: Singularity 3 detected ...
label = DH located: u=(+4.000000e+000,...,+4.302250e+000)
Active parameters = [ +1.720900e+001 +1.049407e+000]
Neutral saddle
Step 96: Singularity 3 detected ...
label = DH located: u=(+4.000000e+000,...,+4.302539e+000)
Active parameters = [ +1.721015e+001 +1.066266e+000]
Neutral saddle
Last Point Found: u = (+4.000000e+000,...,+4.302539e+000)
Active parameters = [+1.721016e+001 +1.066282e+000 ]
elapsed time = 159.2 secs
Number of Points in curve = 100
3.1 init
[tspan,y0,options] = init(p1 , ..., pn )
init is the first function handle defined in the primary function. It takes
the full list of parameters that are being used for the problem. It must return
14
17.35
17.3
17.25
H
17.2
17.15
17.1
3 3.5 4 4.5 5
15
17.2105
DH
17.21
17.2095
DH
17.209
17.2085 DH
17.208
17.2075
17.207
17.2065
17.206 DH
17.2055
3 3.5 4 4.5 5
16
the value for y0, but the values tspan and options can be empty. This is the
starting point for continuation.
17
3.7 M-file: bruss 1d1.m
This is the file used for all examples in this tutorial.
function out = bruss 1d1
%
% Odefile of 1-d Brusselator model
% This file uses a non-constant approximate solution as a starting
guess.
out{1} = @init;
out{2} = @fun eval;
out{3} = @jacobian;
out{4} = [];%@jacobianp;
out{5} = @usernorm;
out{6} = @user1;
% ----------------------------------------------------------------------
function dxdt = fun eval(t,x,N,L,A,B,Dx,Dy)
y = x(N+1:2*N);
x(N+1:2*N) =[];
x0 = A; x1 = A;
y0 = B/A; y1 = B/A;
L2 = L^2;
h = 1/(N+1);
cx = (Dx/L2)/(h*h);
cy = (Dy/L2)/(h*h);
dxdt = zeros(N,1);
dydt = zeros(N,1);
dxdt(1) = (x0-2*x(1)+x(2))*cx + A - (B+1)*x(1) + x(1)*x(1)*y(1);
dxdt(N) = (x(N-1)-2*x(N)+x1)*cx + A - (B+1)*x(N) + x(N)*x(N)*y(N);
dydt(1) = (y0-2*y(1)+y(2))*cy + B*x(1) - x(1)*x(1)*y(1);
dydt(N) = (y(N-1)-2*y(N)+y1)*cy + B*x(N) - x(N)*x(N)*y(N);
i=2:N-1;
dxdt(i) = (x(i-1)-2*x(i)+x(i+1))*cx + A - (B+1)*x(i) + x(i).*x(i).*y(i);
dydt(i) = (y(i-1)-2*y(i)+y(i+1))*cy + B*x(i) - x(i).*x(i).*y(i);
dxdt = [dxdt; dydt];
% --------------------------------------------------------------------------
function [tspan,x0,options] = init(N,L,A,B,Dx,Dy)
tspan = [0; 10];
x0 = zeros(2*N,1);
i=1:N;
x0(i) = A + 2*sin(pi*i/(N+1));
x0(N+i) = B/A - 0.5*sin(pi*i/(N+1));
handles = feval(@bruss 1d1);
options = odeset(’Vectorized’,’on’, ’Jacobian’, handles(3));
% --------------------------------------------------------------------------
function dfdx = jacobian(t,x,N,L,A,B,Dx,Dy)
y = x(N+1:2*N);
18
x(N+1:2*N) =[];
x0 = A; x1 = A;
y0 = B/A; y1 = B/A;
L2 = L^2;
h = 1/(N+1);
cx = (Dx/L2)/(h*h);
cy = (Dy/L2)/(h*h);
% Sparse jacobian
A = zeros(2*N,3);
A(1:N-1,2)=cx;
A(1:N,3)=-2*cx -(B+1) + 2*x(1:N).*y(1:N);
A(1:N,4)=cx;
A(N+1:2*N,2) = cy;
A(N+1:2*N,3) = -2*cy -x(:).*x(:);
A(N+2:2*N,4) = cy;
A(1:N,1) = B - 2*x(:).*y(:);
A(N+1:2*N,5) = x(:).*x(:);
dfdx = spdiags(A, [-N,-1:1,N] , 2*N, 2*N);
% --------------------------------------------------------------------------
function dfdp = jacobianp(t,x,N,L,A,B,Dx,Dy)
y = x(N+1:2*N);
x(N+1:2*N) =[];
x0 = A; x1 = A;
y0 = B/A; y1 = B/A;
L2 = L^2;
h = 1/(N+1);
cx = (Dx/L2)/(h*h);
cy = (Dy/L2)/(h*h);
kx = (-2/L)*cx;
ky = (-2/L)*cy;
Sx = zeros(N,1);
Sy = zeros(N,1);
Sx(1) = kx*(x0-2*x(1)+x(2));
Sy(1) = ky*(y0-2*y(1)+y(2));
Sx(N) = kx*(x(N-1)-2*x(N)+x1);
Sy(N) = ky*(y(N-1)-2*y(N)+y1);
i=2:N-1;
Sx(i) = kx*(x(i-1)-2*x(i)+x(i+1));
Sy(i) = ky*(y(i-1)-2*y(i)+y(i+1));
dfdp = [ zeros(2*N,1) [Sx;Sy] ];
% -------------------------------------------------------------------------
function normuser = usernorm(arg)
n = length(arg);
normuser = sqrt(1/n)*norm(arg);
% -------------------------------------------------------------------------
function uf1 = user1(t,x,N,L,A,B,Dx,Dy)
19
uf1 = L - 6.5e-002;
% ---------------------------------------------------------------------
4 Options.
It is possible to specify various options. The continuer stores the handle to the
options in the variables contopts. A call to feval(cds.curve.options) must
return a structure created with contset:
options = contset();
20
Cont VarTolerance tolerance of coordinates: ||δx|| ≤ VarTolerance is the
second convergence criterion of the Newton iteration (default: 10−6 )
Cont IncrFinDiff the increment to compute the derivatives numerically (de-
fault: 10−5 )
Cont Singularities boolean indicating the presence of test functions and a
singularity matrix (default: 0)
Cont Testfunctions boolean indicating the presence of test functions and sin-
gularity matrix (default: 0)
Cont Eigenvalues boolean indicating the computation of the eigenvalues (de-
fault: 0)
Cont Userfunctions boolean indicating the presence of user functions (de-
fault: 0)
Cont UserFuncInfo is an array with structures containing information about
the userfunctions. This structure has the following fields:
.label label of the userfunction
.name name of this particular userfunction
.state boolean indicating whether the userfunction has to be evaluated or not
Cont LogFile Generate disgnostic log file in the .../Logs/ directory (default:
0)
Cont DiagnosticsLevel Diagnostic level changes the amount of information
written to screen/logfile, -inf to suppress all output ( default: 0 )
Loc UseLocators boolean vector indicating the user has provided his own
locator code to locate zeroes of test functions. Otherwise the default
locator will be used (default: empty)
21
Loc MaxIters Maximum iterations for the locator function (default: 5)
Loc MaxTestIters Maximum number of iterations to locate a zero of a test-
function (default: 10)
Loc TestTolerance Tolerance of test functions when used as a locator (de-
fault: 10−5 )
Loc VarTolerance Tolerance for variables used in locator function (default:
10−4 )
Loc FunTolerance Tolerance for residuals used in locator function (default:
10−5 )
Loc IgnoreSings vector containing indices of singularities which are to be
ignored (default: empty)
CIS usingCIS Choose whether to calculate subspace (default: 1 )
CIS AdaptOnOverlap Whether to adapt space on overlap or not? (default:
1)
CIS SparseSolvers Whether to use sparse solver or not? (default: 0 )
CIS InitNUnstable Number of initial unstable eigenvalues. A negative num-
ber forces contCIS to compute the number of unstable eigenvalues. (
default: −1 )
CIS NUnstableGuess Initial guess for the number of unstable eigenvalues. (
default: 15 )
CIS MaxUnstable Maximum number of the unstable eigenvalues. ( default:
40 )
CIS InitSubSize Initial Subspace Size (default:4)
CIS NStableRef The number of stable Reference Eigenvalues for CIS ( de-
fault: 4 )
CIS NExtra The number of extra eigenvalues to compute. This is used in
overlap detection. ( default: 4 )
Ric Euler Use Euler predictor in ricatti solvers (default: 1 )
22
Ric Transform ricatti solver transformation (’none’/’invert’/’cayley’) (default:
’none’ )
Ric Cayley Shift Cayley transform shift parameter in ricatti solvers (default:
1)
Ric Select Method used to select subspace in ricatti solvers ( default: ’ric’ )
Ric Partial Q Keep only Q1 even in dense case in ricatti solvers (default: 0 )
EQ BranchingMethod Method used for branch switching (0,1,2) ( default:
0)
EQ SingLinSystTol Tolerance for singular linear system in equilibrium loca-
tors (default: 0.1)
TestPath This should always be present in any testrun and should always be
mfilename(’fullpath’). It is the full path the the test run file.
Options The standard options and CIS options are set and stored in a structure
Continuation A call to run continuer(...) is made
Saving Data After continuation, data can be saved.
Here is an example of a testrun script m-file testbruss BP0.m:
23
opt = contset(opt,’RIC Cayley Shift’, 10);
opt = contset(opt,’EQ BranchingMethod’, 2);
opt = contset(opt,’Loc UseLocators’, [1 1 1]);
opt = contset(opt,’TestPath’,mfilename(’fullpath’));
N = 500; L = 0.06; A = 2; B = 4.6; Dx = 0.0016; Dy = 0.008;
p = [N; L; A; B; Dx; Dy]; ap1 = 2;
[s,filename] = run continuer(@bruss 1d1, @equilibriumL, p, ap1, opt,[]);
plotL(filename,s,[1 2*N+1]);
s = saveSingPoints(’testbruss Branch’,s,p,ap1);
PROBDEF The problem definition file to be used for continuation; this is user
supplied.
CURVEDEF The curve definition file to be used you can choose from the
following:
The function run continuer returns the signgularity sturcture s and name
of the data file where the data for that run is stored.
5.2 plotL
The function plotL takes the following inputs:
plotL(filename,s,plotaxes)
filename The name of the data file created by run continuer. It is stored in
the .../Data/(PROBDEF) directory.
24
s The singularities data structure returned by run continuer.
plotaxes A two or three diminsional row vector indicating which indices
are to be plotted.
5.3 saveSingPoints
This function saves the output singularities so they can be used by run continuer
to start the appropriate continuation.
saveSingPoints(’filename’,s,p,ap)
It saves data for branch, Hopf, fold, user, start, and end points and saves
them in filename.mat the data can be loaded using the command
load filename s
For continuation starting from a saved point, the correct point must be
chosen from the list of singularities saved in s; s(i).label contains a two
character label for the singularity that defines its type. These are the labels
for the singularities that saveSingPoints stores.
00 Starting Point for a curve, this is an equilibrium point
99 Ending Point for a curve, this is an equilibrium point
H Hopf Point
BP Branch Point
LP Limit Point
References
[1] D. Bindel, J. Demmel, and M. Friedman, Continuation of invariant
subspaces for large bifurcation problems, in Proceedings of the SIAM Con-
ference on Linear Algebra, Williamsburg, VA, 2003.
[2] , Continuation of invariant subspaces for large bifurcation problems,
Tech. Report UCB/EECS-2006-13, EECS Department, University of Cali-
fornia, Berkeley, February 13 2006.
[3] , Continuation of invariant subspaces for large bifurcation problems,
SIAM J. Sci. Comput., 30 (2008), pp. 637–656.
25
[4] D. Bindel, W. Demmel, M. Friedman, W. Govaerts, and
Y. Kuznetsov, Bifurcation analysis of large equilibrium systems in mat-
lab, in Proceedings of the ICCS conference 2005, volume 3514/2005, At-
lanta, GA, 2005, pp. 50–57.
[5] J. W. Demmel, L. Dieci, and M. J. Friedman, Computing connecting
orbits via an improved algorithm for continuing invariant subspaces, SIAM
J. Sci. Comput., 22 (2001), pp. 81–94.
[6] A. Dhooge, W. Govaerts, and Yu.A. Kuznetsov, matcont: A mat-
lab package for numerical bifurcation analysis of odes., ACM TOMS., 29
(2003), pp. 141–164.
[7] A. Dhooge, W. Govaerts, Yu.A. Kuznetsov, W. Mestrom, and
A. M. Riet, MATLAB continuation software package CL MATCONT,
Jan. 2003. http://www.math.uu.nl/people/kuznet/cm/.
[8] L. Dieci and M. J. Friedman, Continuation of invariant subspaces, Nu-
merical Linear Algebra and Appl., 8 (2001), pp. 317–327.
[9] M. Friedman, W. Govaerts, Y. Kuznetsov, and B. Sautois, Con-
tinuation of homoclinic orbits in matlab, in Proceedings of the ICCS con-
ference 2005, volume 3514/2005, Atlanta, GA, 2005, pp. 263–270.
[10] M. Friedman and W. Qiu, On the location and continuation of hopf
bifurcations in large-scale problems, Int. J. Bif. and Chaos, 18 (2008),
pp. 1589–1597.
26