М.Г.Гоман, А.В.Храмцовский «Пакет программ КРИТ. Руководство пользователя. Версия 2.43», Центральный Аэрогидродинамический институт (ЦАГИ), г.Жуковский, 1993 г., 138 стр.
Руководство пользователя содержит краткое описание функциональных возможностей и командного языка пакета программ КРИТ (ранней версии, написанной на языке Фортран). Пакет программ был создан для численного исследования нелинейных систем обыкновенных дифференциальных уравнений. В пакете программ КРИТ использовалась методология, основанная на достижениях современной теории динамических систем и бифуркационного анализа.
Mikhail Goman, Andrew Khramtsovsky - KRIT Scientific Package, User Guide. Version 2.43, Central Aerohydrodynamics Institute (TsAGI), Zhukovsky, Russia, 1993, 138 p.
The user guide contains brief description of the possibilities and command language of the Krit scientific package (early Fortran version). The package was designed for studying nonlinear systems of the ordinary differential equations. Krit package employs the methodology based on the achievements of the modern theory of dynamical systems and bifurcation analysis.
5. Introduction
We present in this book a brief description of the possibilities and command language of
the Krit scienti c package. The package was designed for studying nonlinear systems
of the ordinary di erential equations.
Krit package employs the methodology based on the achievements of the modern
theory of dynamical systems and bifurcational analysis. Today it is not an easy-to-
study/easy-to-use software. To use it e ciently, user is to know about frequently en-
countered nonlinear phenomena (such as bifurcation of solutions, branching, etc.), and
to know in detail the package layout and basic algorithms. Krit is a working horse",
and in many applications it showed itself to be a rather powerful and useful one.
Our software enables the user to do the following:
to nd equilibrium solutions, to study their local stability, and to track them while
changing a parameter (in this case the original continuation algorithm is applied),
to nd periodic solutions (closed orbits), to study their local stability, and to
investigate their dependence on a parameter,
to nd bifurcation points (i.e. limit and branching points), and to examine their
dependence on a parameter,
to nd a set of isolated real solutions of a system of nonlinear equations (knowing in
advance one of these solutions, the original systematic search method is applied),
to simulate the dynamics of the system of nonlinear di erential equations using
di erent numerical procedures,
to study complex attractors by means of Poincare mapping technique,
to investigate the domains of attraction of the stable steady-state solutions (equi-
librium points and closed orbits).
The package has simple run-time graphics, and stores the results in les for later
processing and drawing.
Krit is rather young. It was born in 1980, and now it just begins to do real job.
The package remains experimental, so the algorithms and programs undergo permanent
4
6. Introduction 5
modi cations. At the same time there is a stable core" of the package comprising algo-
rithms and methods that proved to be useful and e ective for investigation of nonlinear
problems.
Designing the package, one of the goals was to minimize the programming needed to
study a new task (note, that the programming cannot be eliminated, especially if the
e ciency of the code is of importance). We also attempted to implement a compact and
powerful command language. We suppose that to a certain extent we succeeded to do
so.
Of course, Krit looks somewhat old-fashioned. You can't nd here neither colorful
windows nor on-line help nor mouse support... In general, that's due to historical reasons
since it's hard enough to change the technology of the sophisticated package.
Now we are re-writing the package using present-day friendly interface" concepts
and C++ programming language. But, since Fortran language programs are much more
easy to transfer to new types of computers/CPUs, we continue the development of this
version of the package. Now the 32-bit version based on NDP Fortran is operational.
At the same time old-fashioned systems has their own charm and beauty. We hope
that Krit as it is may be useful for scientists despite all the shortcomings. Love it and
you will be rewarded!
Moscow, August 1993. Mikhail Goman
Andrew Khramtsovsky
7. Version 2.43 release notes 6
Version 2.43 release notes
Version 2.43 of the Krit package is an expansion and re nement of the version 2.4.
The versions are upward compatible i.e. all the commands of the version 2.4 will work
properly under new version.
There are the following di erences between versions:
The capabilities of the Krit built-in calculator are greatly increased. That's why
this manual contains re-written full descriptions of the calculator.
The macroprocessing of the input commands is added. Now the user can access
some vital information about program environment.
New conditional commands (IF, CSS, CSI) appeared. IF command is especially
useful for making jumps.
Some new features are added to Run-time graphics.
A set of commands for creating demonstration procedures is added to the package.
The Esc key may be used to interrupt calculations as well as Control-C combina-
tion. Now these signals can interrupt the procedure (the user then is returned on
"ground" level of the Krit interpreter). The combination Control-X may be used
to halt the package.
New version of the Krit utility VISU is supplied with this version of the package.
Now the user can invoke it as follows:
VISU filespec]
where filespec is the name of the le with stored screen image.
The call of the DOS command is simpli ed. One may use the following syntax of
the $ command:
$DOS command
i.e. without space between $ sign and the command.
The F: and E: logical drives are no longer in service. The process of creating Krit
EXE- le and its starting sequence was changed.
The restriction on the usage of DO command (User Guide, version 2.4, p.106) is
removed.
The bug in SSNE command is detected. This command cannot be used properly
with jobs formed using special data cards.
When forming output lists by means of EDIT, EDAR, EDPLTY commands,
the user can access not only parameters, but also the data from other data arrays.
8. Chapter 1
Package Installation
The Krit package is supplied on two distribution disks. The rst oppy disk contains the
own" software of the package, the installation program and this manual. The second
disk contains Fortran compiler, linker, as well as Fortran and C libraries.
To install the package, please follow these instructions :
1. Place the rst distribution disk into A: (1.2 Mb, 5 inch) oppy disk drive. If your
5-inch oppy drive is called B:, place the disk into that drive and then execute a
DOS command (at that very moment your current directory must be somewhere
on the hard disk):
SUBST A: B:
If you have no suitable drives at your PC, copy the les from the distribution disks
into some directory on the hard disk ( through some other PC). Then execute DOS
command:
SUBST A: <full_name_of_the_directory>
2. Run the installation program INSTALL. If you have got the Microsoft Fortran 5.
compiler, Microsoft linker and the library for Microsoft C 6.0 compiler, then use
the installation program as follows:
INSTALL d :
where d: is the name of the drive on which you want to install the package. Be
ready to answer the questions about the paths to that software.
Example: INSTALL C:
Choosing the drive for installation, note, that it is much more convenient to work
with the package provided work directories are located on the same drive.
If you have no Fortran or C software, use the installation program with the /FULL
ag:
INSTALL d : =FULL
7
9. CHAPTER 1. PACKAGE INSTALLATION 8
You need 3.2 Mb of disk space for "full mode" installation, and about 1.8 Mb for
"small mode" installation.
3. The installation program begins a dialog in order to set proper paths to the Fortran
compiler and library, C6 library, linker and (optionally) to the CAD "Dynamics"
library. You'll get the following menu on the screen:
The settings are :
1. Path to Fortran 5 compiler : <default path>
2. Path to Fortran 5 library : <default path>
3. Path to C6 library : <default path>
4. Path to CAD libraries: <default path>
5. Path to linker : <default path>
Press number 1-5 to change, 0 to install, ESC to quit
If you press keys 1...5 on the keyboard, you'll receive a prompt "Enter full path : "
and you will be able to change the corresponding path. "Empty" path is also OK,
it means that the corresponding software must be accessed using DOS technique of
searching the programs (based on PATH command in the AUTOEXEC.BAT
le).
You may quit the installation by pressing ESC key.
When all the paths are set properly, press '0' key to perform the installation. As
a result, you'll get the following tree of directories:
d: root directory
- VK directory
-- BAT subdirectory
-- O subdirectory
-- PRO subdirectory
-- DEMO subdirectory
The directories contain the following les:
VK { contains the main library of the package
BAT { the directory for Krit command les and utilities
O { the directory for object les and linker response les necessary to
create overlays while making user program.
PRO { the directory for "shared" Krit procedures. When somebody makes a
good procedure useful for a number of Krit users, place it into that directory.
10. CHAPTER 1. PACKAGE INSTALLATION 9
DEMO { the directory that contains the example problem (well-known van
der Pol oscillator) and demonstrator. Use it to check quickly the success of
installation.
4. If you started the installation program with /FULL option, you will be prompted
to set up the Microsoft Fortran 5.0 compiler (and after that Microsoft C ver. 6.0
library). You may accept the installation pressing 'Y', reject it pressing 'N' or quit
the installation program pressing ESC key.
if you accepted the installation of the Fortran compiler, all the necessary les
will be placed into the directory d:FOR5 .
if you accepted the installation of the C library, you will get the following
directory structure:
d: root directory
- C6 directory (no files)
-- LIB subdirectory (file LLIBC7.LIB)
5. At the end of installation the program will remind you about actions necessary to
make the installation complete.
First, include the path to the d:VKBAT directory into the list of default
paths set by PATH command in AUTOEXEC.BAT le (located in the
root directory on your primary hard disk partition)
By default, the package will use the current directory to store some auxiliary
les. You can rede ne this using KRITTMP (or TMP if KRITTMP is
not set) environment variables. If you have a RAM (i.e. electronic) disk,
it is highly recommended to include the following statement into your AU-
TOEXEC.BAT le:
SET KRITTMP=E:
where E: is a RAM disk drive
6. You may make you work with the package easier if you are using Norton Comman-
der. Place the following line into the NC.EXT le
krt : prepkrt !
(in Norton Commander, press F9, then select Commands menu item and after
that select ExtensionsFileEdit item. Then edit the extensions le (add the line
mentioned above) and press F2 and ESC to save your edits and exit).
After that (after the installation is complete) you make work with the package
as follows. Place your Fortran-language code into the le with the .krt exten-
sion. Place the "bar" on that le and press ENTER. The PREPKRT making
command will be executed with this le.
11. CHAPTER 1. PACKAGE INSTALLATION 10
7. Reboot your computer.
8. Now you may work with the package. Prepare a Fortran-language le with FUNC
user-de ned subroutine (and other subroutines if necessary), as described in User
Guide. You may use either .krt or .for extensions for the name of that le.
Than make the EXE- le:
for a .for"- le, execute a command
PREP <filename_without_extension>
for a .krt"- le, run the Norton Commander, go to the corresponding direc-
tory, place the "bar" onto that le and press ENTER key.
Check the < lename>.log le containing compiler and linker' messages.
If everything is OK, you'll get a < lename>.EXE le. You may run it and begin
your work. You also may use some options when starting the EXE- le:
/S=<skf_filename> - allows you to use the status-keeping le with the
name that di ers from the default one (i.e.
<EXE_filename_without_extension>.)
/L=<lst_filename> - allows you to use the listing le with the name that
di ers from the default one (i.e.
<EXE_filename_without_extension>.LST)
/G=<grf_filename> - allows you to use the "graphical information" le
with the name that di ers from the default one (i.e.
<EXE_filename_without_extension>.GRF)
/B=<filename> - allows you to to run the package in batch mode, the
procedure <filename> will be executed.
<filename> - allows you to to run the package in batch mode, the
procedure <filename> will be executed.
/D=<directory> - allows you to use the directory for "common" pro-
cedures with the name, that di ers from the default
one ( VKPRO on current drive )
/P=<directory> - allows you to use the directory for users`s procedures
with the name, that di ers from the default one (
current directory name )
/U=<directory> - allows you to use the directory for Krit utilities with
the name, that di ers from the default one ( VKBAT
on current drive )
12. CHAPTER 1. PACKAGE INSTALLATION 11
/Z=d - d is a drive letter. This drive will be used to store
some temporary les. Use it if the environment variables
KRITTMP or TMP are not set properly.
/I - allows you to get the information message about free
memory in default data segment.
9. The Krit user is to know, that his EXE-program starts as follows:
the STARTUP.COM procedure from VKBAT directory is executed (if it
exists). The procedure must nish its activities with END command. The
installation program creates "default" STARTUP.COM procedure which
writes the information about every started Krit EXE- le into system journal
le SYSTEM.LOG in the VKBAT directory.
the STARTUP.COM procedure from current directory is executed (if it
exists). Place your "standard" initialization commands into it. The procedure
must be nished with END command.
if batch procedure was mentioned when EXE-program was started, the pack-
age begins the execution of that procedure in batch mode. Otherwise the
interactive session is activated.
10. To test quickly the success of installation, go to d:VKDEMO directory. Prepare
the EXE- le using one of the following commands:
PREP VANPOL
or
PREPKRT VANPOL
If the EXE- le is build successfully, try to run the demonstrator procedure:
VANPOL DEMO
13. Chapter 2
Getting started
2.1 That's what you are to do rst
So, now you know about the existence of the Krit package, and you are ready to try
it despite all the doubts and di culties. Well, take a pen and a sheet of paper and
write down the system of di erential equations you want to study. It may look like the
following one:
_x = x (x2
+ y2
; R2
) ; y
_y = y (x2 + y2 ; R2) + x
_z = ; z
Variables x, y, z are state variables for the system since there are di erential equations
for them. Other variables ( R, , ) are parameters.
Array of parameters
Krit package requires all the state variables, parameters and auxiliary output variables
(except for the independent variable - time" ) to be placed in a single data array called
array Y" or array of parameters". The maximum size of array Y depends on the
version of the software. Most likely it equals to 499 ( in this case 500-th element of the
array is reserved for system ).
You can access the elements of the array Y using their numbers. We apologize for
that (and many more !) inconvenience.
Now you are to construct the array of parameters. You may do it by many di erent
ways. Here is an example:
Table of Parameters
parameter no. 1 2 3 ::: 10 11 12 ::: 20 :::
parameter x y z R
We added one output variable =
p
x2 + y2 to the parameter table.
Write down the parameter table. It is necessary when you'll work with Krit package.
12
14. CHAPTER 2. GETTING STARTED 13
User supplied subroutine
The next vital feature of the Krit package is the way the equations are programmed.
The user writes a subroutine which receives the value of independent variable, values
of variables in parameter table and a number, indicating a formula to be calculated.
Subroutine returns the result of calculation.
To de ne a system of di erential equations, you are to inform Krit about:
order of system N
position of the n-th state variable in parameter table, n = 1:::N
number of formula to be used in calculation of the derivative of the n-th state
variable, n = 1:::N
The most exciting feature of Krit is that you de ne a system of di erential equations
when you are running Krit ! You may construct system to be studied from prepro-
grammed formulas at your will. At the preliminary stage all that you are to do is to
program all the formulas necessary for all variants of the system of equations.
Is it clear ? It is extremely important that you understand this mechanism. Below you
can see an example { a FORTRAN-77 subroutine calculating formulas for our example
problem:
SUBROUTINE FUNC (IN,OUT,Y,TIME)
REAL Y(1)
C----------------------------------------------------------------
C
C FUNC - standard name for this subroutine
C IN - number of formula to be calculated, input
C Y - array of parameters, passed by address, input/output
C TIME - value of independent variable, input
C OUT - the result of calculation, output
C
C----------------------------------------------------------------
IF (IN.EQ.1) THEN
C formula no.1 is required
OUT=Y(1)*(Y(1)**2+Y(2)**2-Y(10)**2)-Y(11)*Y(2)
ELSE IF (IN.EQ.2) THEN
C formula no.2 is required
OUT=Y(2)*(Y(1)**2+Y(2)**2-Y(10)**2)+Y(11)*Y(1)
ELSE IF (IN.EQ.3) THEN
C formula no.3 is required
OUT=-Y(12)*Y(3)
ELSE
15. CHAPTER 2. GETTING STARTED 14
C returns zero, if formula number is incorrect
OUT=0.
END IF
RETURN
END
This subroutine works well. But some expressions are calculated more then once.
And we are to evaluate the output variable { but where ? It is impossible to calculate
it simultaneously with some formula since there are no guarantees that this formula will
be active. Of course we can evaluate at every call to the FUNC subroutine, but it is
too expensive.
To solve the problem, the intrinsic Krit routine evaluating right hand sides of the
system of equations initially calls FUNC subroutine with parameter IN=0. This allows
the user to make preliminary calculations only once. Now we may rewrite our example
subroutine as follows :
SUBROUTINE FUNC (IN,OUT,Y,TIME)
REAL Y(1)
SAVE
C----------------------------------------------------------------
C
C FUNC - standard name for this subroutine
C IN - number of formula to be calculated, input
C Y - array of parameters, passed by address, input/output
C TIME - value of independent variable, input
C OUT - the result of calculation, output
C
C----------------------------------------------------------------
IF (IN.EQ.0) THEN
C preliminary calculations
C parameter Y(21) is used as temporary variable
Y(21)=Y(1)**2+Y(2)**2
Y(20)=SQRT(Y(21))
Y(21)=Y(21)-Y(10)**2
ELSE IF (IN.EQ.1) THEN
C formula no.1 is required
OUT=Y(1)*Y(21)-Y(11)*Y(2)
ELSE IF (IN.EQ.2) THEN
C formula no.2 is required
OUT=Y(2)*Y(21)+Y(11)*Y(1)
16. CHAPTER 2. GETTING STARTED 15
ELSE IF (IN.EQ.3) THEN
C formula no.3 is required
OUT=-Y(12)*Y(3)
ELSE
C returns zero, if formula number is incorrect
OUT=0.
END IF
RETURN
END
Below you can see one more example of programming FUNC subroutine where all
formulas are evaluated during preliminary calculations:
SUBROUTINE FUNC (IN,OUT,Y,TIME)
REAL Y(1),F(3)
SAVE
C----------------------------------------------------------------
C
C FUNC - standard name for this subroutine
C IN - number of formula to be calculated, input
C Y - array of parameters, passed by address, input/output
C TIME - value of independent variable, input
C OUT - the result of calculation, output
C
C----------------------------------------------------------------
IF (IN.EQ.0) THEN
C preliminary calculations
C parameter Y(21) is used as temporary variable
Y(21)=Y(1)**2+Y(2)**2
Y(20)=SQRT(Y(21))
Y(21)=Y(21)-Y(10)**2
C all formulas are calculated here
F(1) =Y(1)*Y(21)-Y(11)*Y(2)
F(2) =Y(2)*Y(21)+Y(11)*Y(1)
F(3) =-Y(12)*Y(3)
ELSE IF (IN.GT.0.AND.IN.LE.3) THEN
C formula IN is required
OUT=F(IN)
ELSE
C returns zero, if formula number is incorrect
17. CHAPTER 2. GETTING STARTED 16
OUT=0.
END IF
RETURN
END
Making an executable le
Suppose that le containing FUNC subroutine (and other routines called by FUNC, if
necessary) is ready. Let the name of the le be test.for ( extension .for is obligatory
for PC version of Krit package ). If Krit package has been correctly installed, execute
a command on the DOS prompt:
prep test
File test.forwill be compiled and the object module will be linked with Krit package
library. If everything goes well, you will nd le test.exein your current directory. This
is an executable le we will work with.
2.2 Starting a program
The Krit program is prepared by means of prep command, as described above.
To start the program, enter its name on DOS prompt:
test
When you run the le under version 2.43, it asks no questions (there are all the
necessary default settings). If new status-keeping le is created, then the corresponding
message is displayed.
By default, the package will use the current directory to store some auxiliary les.
You can rede ne this using KRITTMP (or TMP if KRITTMP is not set) environ-
ment variables. If you have a RAM (i.e. electronic) disk, it is highly recommended to
include the following statement into your AUTOEXEC.BAT le:
SET KRITTMP=E:
where E: is a RAM disk drive
The user also may use some options when starting the EXE- le to change the default
settings:
/S=<skf_filename> - allows you to use the status-keeping le with
the name that differs from the default one (i.e.
<EXE_filename_without_extension>.)
/L=<lst_filename> - allows you to use the listing le with the name that
differs from the default one
(i.e. <EXE_name_without_ext>.LST)
18. CHAPTER 2. GETTING STARTED 17
/G=<grf_filename> - allows you to use the "graphical information" le
with the name that di ers from the default one (i.e.
<EXE_name_without_ext>.GRF)
/B=<filename> - allows you to to run the package in batch mode, the
procedure <filename> will be executed.
<filename> - allows you to to run the package in batch mode, the
procedure <filename> will be executed.
/D=<directory> - allows you to use the directory for "common" proce-
dures with the name, that di ers from the default one (
VKPRO on current drive )
/P=<directory> - allows you to use the directory for users`s procedures
with the name, that di ers from the default one ( current
directory name )
/U=<directory> - allows you to use the directory for Krit utilities with
the name, that di ers from the default one ( VKBAT on
current drive )
/Z=d - d is a drive letter. This drive will be used to store
some temporary les. Use it if the environment variables
KRITTMP or TMP are not set properly.
/I - allows you to get the information message about free
memory in default data segment.
The program starts with the following actions:
the STARTUP.COM procedure from VKBAT directory is executed (if it exists).
The procedure must nish its activities with ENDcommand. The installation pro-
gram creates "default" STARTUP.COM procedure which writes the information
about every started Krit EXE- le into system journal le SYSTEM.LOG in
the VKBAT directory.
the STARTUP.COM procedure from current directory is executed (if it exists).
Place your "standard" initialization commands into it. The procedure must be
nished with END command.
if batch procedure was mentioned when EXE-program was started, the package
begins the execution of that procedure in batch mode. Otherwise the interactive
session is activated.
But now you dont't need to think about all that. Run the test program by entering
only the name of the program:
test
19. CHAPTER 2. GETTING STARTED 18
After that you'll get Krit welcome message and receive Krit prompt { a percent
sign. Percent sign prompt means that program expects a command. If sometimes some
data are to be entered, a question sign prompt will appear.
Note, that all Krit commands are to be entered in upper-case letters.
Now enter END command and see your rst session with Krit package successfully
terminated !
2.3 Basic Krit data arrays. Data input and output.
Krit package employs a number of prede ned data arrays. The user can read and write
data in these arrays using standard" names.
Three arrays are located in the permanent memory, i.e. in the so-called status{
keeping le". They are:
Name Contents
YMIN YMIN(i) is the lower limit for the i-th element of the table of
parameters Y(i)
YMAX YMAX(i) is the upper limit for the i-th element of the table
of parameters Y(i)
DY
DY(i) is a maximum allowed increment for the i-th element of
the table of parameters Y(i) per one step of iterative algorithms.
It is recommended that
DY(i) YMAX(i) ; YMIN(i)
100
Other data arrays are located in the temporary RAM memory. The most important
is array Y. It contains current values of the elements of the parameter table.
Krit also has a number of arrays where di erent state vectors are stored. State
vector contains values of state variables, and its size equals the order of the system of
equations. Usage of these vectors will be discussed later. The list of most frequently
used state vectors and some auxiliary arrays associated with them is given below.
Name Contents
X state vector used for the search of stationary solutions of the
system of equations
DX
DX(i) is a maximum allowed increment for the i-th element of
the state vector X(i) per one step of iterative search for the
solution of the system of equations.
(to be continued)
20. CHAPTER 2. GETTING STARTED 19
( continued )
Name Contents
F after commands RTN, RTNP, RTNSP etc. contains right
hand sides of the corresponding system of equations
XP state vector used for the search of periodic solutions of the sys-
tem of equations
DXP
DXP(i) is a maximum allowed increment for the i-th element
of the state vector XP(i) per one step of iterative search for the
periodic solution of the system of equations.
XB state vectorcontaining coordinates of a point belonging to secant
hyperplane (in a mapping algorithm).
XB1 vector normal to a secant hyperplane (in a mapping algorithm).
XRK state vector used for mathematical simulation
SX0 state vectorcontaining coordinates of a point belonging to secant
hyperplane (in a mapping algorithm, TRP command).
SAN vector normal to a secant hyperplane (in a mapping algorithm,
TRP command).
XS vector containing coordinates of a point on a secant hyperplane
( SEP command ).
DXS
DXS(i) is a maximum allowed increment for the i-th element
of the vector XS per one step of iterative search for the solution
( SEP command ).
XSF vector belonging to a secant hyperplane ( algorithm for studying
separating surfaces ).
XAN vector normal to the separating surface at the saddle{type point
(algorithm for studying separating surfaces).
Lately, there is array XOGR of the dimension (2 N) where N is the order of the
system of equations. The values XOGR(1,i) and XOGR(2,i) are the minimum and
maximum allowed values for the i-th component of state vectors correspondingly.
2.4 Output of data from Krit data arrays
Data from arrays can be viewed using the L command:
i1] i2] i3] L=name=
21. CHAPTER 2. GETTING STARTED 20
where
name - name of the array
i1 - number of the rst array element to be viewed,
default i1 = 1
i2 - number of the last array element to be viewed,
if i1 is set, default is i2 = i1,
if i1 isn't set, default is i2 = nsys, where nsys - dimension of studied
system
i3 - element number increment, default i3 = 1.
There is a special command LI, which is able to display values of parameters (from
Y array) in random order:
i1 i2 :::ik] LI
where i1 i2 :::ik] { numbers of elements to be displayed.
2.5 Input of data into arrays
Krit has three commands S, U, I for data input.
Command S allows to entry the same value into subsequent elements of data array:
i1 i2] i3] r1 r2] S=name=
where
name - name of the data array
i1 - number of the rst element to be lled
i2 - number of the last of the input elements of array,
default is i2 = i1
i3 - element number increment, default i3 = 1
r1 - input value,
(for XOGR two-dimensional array a pair of values (r1 r2) is needed)
Command U allows to entry di erent values into subsequent elements of data
array:
i1 i2] i3] r1 :::rk] U=name=
where
name - name of the data array
i1 - number of the rst element to be lled
i2 - number of the last of the input elements of array,
default is i2 = i1
i3 - element number increment, default i3 = 1
r1 :::rk - list of values,
(for XOGR array pairs of values (rk1 rk2) are needed as input)
22. CHAPTER 2. GETTING STARTED 21
Command Iallows to entry di erent values into random elements of the data array:
i1 r1 i2 r2] :::ik rk] I=name=
where
name - name of the data array
ik rk - number and value of input element.
(for XOGR array pairs of values (rk1 rk2 ) are needed as input)
Command I can also be entered without parameters:
I=name=
In this case the user must enterpairs (ik rk) interactively, on the ?" prompt. Each
pair is to be entered on separate input line. Empty or blank input line terminates
the dialog.
2.6 Keeping and restoring of arrays
As stated above, YMIN YMAX DY arrays are stored in the status-keeping le, so it
is not necessary to worry about them.
The parameter array and state vectors can be saved and restored using commands
V and R, correspondingly:
n] V=name= - save the data array
n] R=name= - restore the data array
where
name - the name of data array
n - variant number of array, in the range:
for parameter array Y 0 < n < 100,
for state-vector arrays (X XP etc.) 0 < n < 31
ATTENTION! In case n is set, the commands nV=name1= and nV=name2=, where
name1 and name2 are state vector names, write into the same memory location. In case
n isn't set, every array ( parameter array or state-vector arrays with di erent names )
is written or restored using his own speci c memory location.
Array XOGR can't be saved or restored using these commands. This array is lled
automatically during task de nition (with command JOB ) using data from YMIN
and YMAX arrays.
2.7 Moving state vectors
Data from one state vector can be copied into another one using the following command:
B=nameto=F=namefrom=
23. CHAPTER 2. GETTING STARTED 22
where
nameto - name of destination array
namefrom - name of source array
2.8 Calculation of right hand sides. System de ni-
tion.
This section is devoted to some very important aspects of Krit layout. You are to
understand :
how system of equations is formed using preprogrammed formulas
how right hand sides of the system of equations are evaluated
what side e ects are possible
User{supplied subroutine FUNC is able to calculate a number of expressions know-
ing values of the parameters. Now we are to de ne full" system of equations for the
problem in question ( it will be called job or task below ).
Let's form a table comprising all the necessary information for de ning a job for our
example problem:
Number of
equation or
state variable
Number of a
parameter to be
corresponding
state variable
Number of formula (preprogrammed in
FUNC subroutine) to be used for calcula-
tion of the derivative of the corresponding
state variable
1 1 1
2 2 2
3 3 3
We can report this table to Krit package using JOB command. JOB command
also executes the following:
if n-th parameter corresponds to the k-th component of the state vector, and if mk-th
formula is used for the calculation of the derivative, then
value of Y(n) is written into X(k) ,
value of DY(n) is written into DX(k) and DXP(k) ,
value of YMIN(n) is written into XOGR(1 k), and value of YMAX(n) is
written into XOGR(2 k).
So, as a result of the execution of the JOB command all the information necessary
for the evaluation of the right hand sides of the system of equations is supplied to the
package. Arrays X, DX, DXP and XOGR are lled using data from arrays Y,
YMIN, YMAX, DY.
24. CHAPTER 2. GETTING STARTED 23
Only now Krit is able to compute right-hand sides of the system of equations. On
every call to subroutine calculating right-hand sides package does the following:
1. value of the k-th component of the currently used state vector is written into Y(n),
k = 1:::N, where N is the order of studied system
2. user's subroutine FUNC is called with parameter IN=0. At that time all the
preliminary calculations may be performed
3. The derivative for the k-th component of the state vector is computed, calling
FUNC subroutine with IN=mk, for k = 1:::N
4. the value of Y(n) is written into k-th component of the currently used state vector,
for k = 1:::N. This enables the user to a ect the state vector elements. We advise
to use this feature only as a last chance" option.
The mechanism described above guarantees, that values of the parameter and corre-
sponding element of the state vector are the same.
Now we proceed with the syntax of the JOB command.
If the k-th element of the state vector is to be linked with Y(k) and the corresponding
derivative is to be calculated using k-th formula, for k = 1:::N, where N is the order
of the system, then the following simpli ed form of the JOB command may be used to
de ne a job:
JOB=N=
Otherwise, enter command without parameters:
JOB
After that Krit will prompt you for data lines, prompt ?" will be used. Dialog is
terminated when empty or blank line is encountered. Common" data line comprises
three integer numbers separated with commas:
?k n m
where
k - number of the element of the state vector for which
relationships are de ned,
n - number of the corresponding parameter,
m 6= 900 - formula number passed to the FUNC routine
when derivative is calculated.
There is one sometimes very useful feature. If you need a formula of the form:
Y(i) (Y(j) ; Y(l))
25. CHAPTER 2. GETTING STARTED 24
to calculate a derivative and if you don't preprogrammed the formula in the FUNC
subroutine, then you may get it using the special form of the data card in the JOB
command:
?k n 900 j i l ;1]]
where
k - number of the element of the state vector for which
relationships are de ned,
n - number of the corresponding parameter,
900 - indicates that special routine will be used to
calculate the derivative,
i - if i = 0 then 1. will be used instead of coe cient Y(i)
j - if j = 0 then 0. will be used instead of coe cient Y(j)
l - if l is not set, then l = n by default
;1 - a cleaning ag.
Use it when and only when you enter the rst of the
special data cards during dialog with JOB command.
When system is de ned, the user may display the job de nition using a command:
JOB =?
Always display and check job de nition if special data cards were used.
Job de nition sometimes may be very complex, and you might wish to keep it for
later usage. There are two ways to do so:
1. Best way is to create Krit batch procedure and place into it all the commands
necessary to de ne a job. Procedure is a text le, and any text editor may be
used. The name of the le (i.e. the name of the procedure) may not coincide with
the names of Krit built-in commands. File name must have no extension. At run
time this le must be in the current directory on the current drive.
Consider as an example the de nition of the system of the 3-rd order mentioned
above. Let's prepare le{procedure with name JOB3. You can see commands
enteredduring interactive session in the left column (package prompt is not shown),
and the text of the equivalent batch procedure in the right column:
interactive session le JOB3
JOB
1,1,1
2,2,2
3,3,3
( blank line )
%PROC JOB3
%JOB
?1,1,1
?2,2,2
?3,3,3
?
%PEND
26. CHAPTER 2. GETTING STARTED 25
Procedures are called in the same way as built-in commands are called { by their
names. To activate JOB3 procedure, enter it's name on Krit prompt:
2. Note: Not applicable to descriptions made by JOB command with special data
cards.
Up to 10 job de nitions can be stored in status-keeping le at the special memory
area. This area is to be initialized once before entering job de nitions using a
command:
MNEMO = KILL
This command can be used for deleting of all stored descriptions.
The user must do the following:
job description is prepared using JOB command,
storing is made by the command:
i1 r1] :::ik rk] MNEMO =name tcomment]
where:
ij rj j = 1:::k - when job is restored, the value of Y(ij)
will be set equal to rj
name - name to be assigned to stored job de ni-
tion
comment - when job is restored, this text will be dis-
played. Comment is separated from the
rest of command by space symbol.
Description may be restored using the following form of the JOB command:
JOB =name
where name - name of the stored job de nition.
List of the stored descriptions may be displayed using the command
MNEMO =?
And now one more useful feature of the JOBcommand. A number of job descriptions
can be concatenated. It can be done this way:
JOB =n=] = name1 : name2 ::: : namek]]
where
27. CHAPTER 2. GETTING STARTED 26
namei i = 1:::k - either name of the stored description or one of the fol-
lowing standard" names:
JOB - means current job de nition, so current
de nition may be appended. Must be in
the place of name1 if used.
* - requires input of data cards
n - see description of the JOB=n= command given above
Examples:
a) JOB = JOB - Job remains the same. Used for the sake
of side e ects ( data arrays are re- lled ).
b) JOB = - Equivalent of JOB without parameters
c) JOB = JOB : - Current job will be appended with addi-
tional equations entered from data cards.
2.9 First Krit session with new task
Let's return to our sample program. Remember, we've got executable le test.exe and
status-keeping le test.sav.
Now we are begining our rst Krit session with our new task. What we are to do ?
Here is the plan:
initialize everything that needs initialization,
ll arrays DY, YMIN, YMAX with data,
ll array of parameters Y and save it,
prepare a job de nition, check it and save it.
Now, let's go ( user commands are typed using bold letters).
C:DIRECTORY>test
(Krit welcome message is displayed)
%COPY - After COPY command copies of user-
supplied commands and package messages
will be written to the Listing le. Later
you may print this le.
(now initialization commands are executed)
%MNEMO=KILL
%EX=KILL
%EDPL=KILL
28. CHAPTER 2. GETTING STARTED 27
(now DY,YMIN,YMAX arrays are lled { example: )
%1,20,.02S/DY/
%1,3,-5.S/YMIN/
%1,3,5.S/YMAX/
%10,12,0.,0.,-.5U/YMIN/
%10,12,5.,10.,.5U/YMAX/
%12,.001I/DY/
%20,-100.I/YMIN/
%20,100.U/YMAX/
(check the data)
%1,20L/YMIN/
%1,20L/YMAX/
%1,20L/DY/
( ll Y array)
%1,20,0.S/Y/
%1,3,1.,0.,1.U/Y/
%10,12,1.,3.,-.25U/Y/
(check it)
%1,20L/Y/
(keep array of parameters)
%V/Y/
(de ne a job)
%JOB/3/
%JOB=?
(display X, DX, DXP, XOGR data arrays)
%L/X/
%L/DX/
%L/DXP/
%L/XOGR/
If values of elements of X, DX, DXP, XOGR vectors don't t, then enter values
you need. By the way, what array is better to correct { DX or DY ?
Now let's suppose that everything is OK. If you haven't changed X state vector
then it contains (1: 0: 1:). It is a good idea to check if right hand sides are calculated
correctly,so:
%RTN
Nice if you've got (0: 3: ;0:25) as a result. You can make a more deep test by
evaluating jacobian matrix of the system in question at a point set by X state vector {
rst time using pen and paper, and then using the following Krit command:
%ST,RF=0,JACOBY
Results matched, didn't they? OK! Finish the session:
29. CHAPTER 2. GETTING STARTED 28
%END
and print listing le L.DAT.
All other sessions will look like this:
C:DIRECTORY>test
(Krit welcome message is displayed)
(parameters are restored)
%R/Y/
(job is de ned)
%JOB3
(something useful is done, then session is nished)
:::
%END
NOW ALL KRIT WAYS ARE OPEN FOR YOU !
2.10 When you are in trouble...
When one works with the package, he gets a number of error messages. Some of them
are due to the evident errors (especially syntax errors). In this section we discuss the
most common error messages which will be received regularly.
30. CHAPTER 2. GETTING STARTED 29
error
message
explanation, possible reasons for the
message (in the order of decreasing
probability)
user
actions
END OF
REGION
nn, jnnj
order of the
system
The jnnj-th component of the state vector
is outside allowed limits. If nn > 0 then
the upper limit was exceeded, otherwise
the lower limit was violated.
1. The limits were not de ned properly
for the parameter that corresponds to this
state variable.
Set corresponding
elements of YMIN
and YMAX data
arrays, then re-set
the job (for
example, using
JOB=JOB
command).
2. The limits were set correctly, but for
the current command it is desirable to
"expand" them.
Set
XOGR(1 jnnj)
and
XOGR(2 jnnj) to
the desired values.
31. CHAPTER 2. GETTING STARTED 30
error
message
explanation, possible reasons for the
message (in the order of decreasing
probability)
user
actions
END OF
REGION
nn,
99 > jnnj >
order of the
system
Occurs during continuation or during
search for bifurcation or branching points.
For jnnj = order of system + i, means
that i-th of the parameters used in the
command exceeds the corresponding
limits. If nn > 0 then the upper limit was
exceeded, otherwise the lower limit was
violated.
Set YMIN and
YMAX to
appropriate values.
END OF
REGION
99
Occur when some mapping is used. The
message indicates that the corresponding
algorithm was not able to calculate the
mapping during allowed integration time
(set by TE or similar commands).
1. Insu cient integration time Set proper
integration time
using TE
command
2. (Often { for mapping on control
surface and for SEP command) Bad
control surface or (if a continuation was
used) too big increment of the parameter.
Reset the control
surface and/or
diminish the
increment of the
parameter(s).
SINGULA-
RITY
Severe error. The algorithm is unable to
look for solution because corresponding
jacobian matrix is singular.
1. Very often the singularity really takes
place. It may be due to programming
errors or erroneous JOB command.
Sometimes it may re ect the peculiarities
of the problem in question.
To identify the root
of the trouble, run
the same command
with the options
RF=0, JACOBY
in order to get the
jacobian matrix.
Check it, especially
for zero rows and
columns.
2. Too small allowed increments for some
components of the state vector.
Try to rise the
allowed increments.
32. CHAPTER 2. GETTING STARTED 31
error
message
explanation, possible reasons for the
message (in the order of decreasing
probability)
user
actions
Fail in
convergence
after nn
iterations
nn iterations was not enough to reach the
solution. In most cases it means not an
error, but a need to tune the algorithm.
1. Too small number of iterations. Set the appropriate
number of
iterations using
ITR = m
command.
2. The allowed increments for the
components of the state vector are too
small.
Rise the increments
(but don't forget
about the accuracy
of the solution)
3. Too high accuracy is required. Set proper
accuracy using AC
(or EP) command.
4. There is no solution, or else you
managed to fall into local minimum...
Change the initial
value of the state
vector. Use some
parameter to make
convergence easier.
5. (Rare) Too high sensibility of the
right-hand sides. Or, may be, Rafson
coe cient is set to some very small value.
Set proper value of
the Rafson
coe cient using
RF command.
2.11 Interrupts
Sometimes it is necessary to stop the execution of some command, or to perform emer-
gency exit from the program. There are two signals that can be used:
Esc signal generated by the corresponding button on the keyboard, or by pressing
Control and C buttons simultaneously. Interrupts either the command or some
process inside the command (SSNE command is an example). It is possible to
break a procedure by pressing Esc a number of times.
Abort signal generated by pressing Control-X key combination. Is is used for emer-
gency exit from the package.
33. Chapter 3
Quest for equilibrium solutions
3.1 Basic concepts
A system to be studied is a set of di erential equations. It depends on state variables
and other parameters. We may write it in the form:
_x = f (x u) x 2 RN u 2 RM (3.1)
where
x - state vector of the size N
u - vector of other parameters of the size M
f - vector{function of the size N
Equilibrium (or stationary) solution (x u ) to the system of di erential equa-
tions (3.1) is a state vector x satisfying the equation (3.2) at given values of parameters
u :
f (x u ) = 0 (3.2)
Search for and investigation of equilibrium solutions always is a vital part in a research
program for a given nonlinear system. We o er two basic algorithms for searching
equilibrium solutions:
Newton method, with all parameters (except state variables) xed.
Original continuation algorithm, able to calculate the dependence of equilibrium
solution vs certain parameter. This algorithm has a larger region of convergence
4].
Also, Krit has a number of specialized and auxiliary algorithms.
Getting ready" sequence for Krit user:
a) De ne a system of equations: load necessary values into Y parameter array and
de ne a job using JOB command.
32
34. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 33
b) Krit package always searches for a solution by means of iterative algorithms. User
may tune these algorithms changing the values of some special control parameters
(there are a number of Krit commands for that) and changing the values of
elements of some vectors.
Values of maximum allowed increments per one step of iterative algorithm for
the components of the state vector are to be loaded into DX vector .
Desired accuracy of the solution may be set. Accuracy is reached if the
following inequality is satis ed :
maxi
fi
dxi
mink
jdxkj < " i k = 1:::N
where
" - required accuracy,
fi - absolute error in i-th equation,
dxi - value of DX(i).
During initialization Krit sets the default accuracy " = 0:001. Sometimes
it's good enough, sometimes not. User may reset accuracy using a command:
AC =value
Maximum allowed number of iterations can be set by ITR command :
ITR =number
Default number of iterations is 50.
It is possible to change the value of so-called Rafson coe cient k. When
Newton{like algorithm is used, vector of correction is multiplied by k. Default
value is k = 1. The coe cient is set using a command :
RF =value
This feature is for experienced users only. But there is one trick which some-
times is very useful.
If zero coe cient RF = 0 is set on the same command line with ST or CO
commands, the corresponding command will not search for a solution. It will
only calculate the jacobian matrix d f
d x and then it will reset Rafson coe cient
to it's default value k = 1.
Load in X state vector some initial approximation to the solution.
To check that everything is OK, execute RTN command on the Krit prompt
and revise the values of the right-hand sides f (x u).
35. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 34
3.2 Search for equilibrium solution
After some preliminary actions (see section 3.1) everything is ready for a work. Now our
aim is to nd some equilibrium solution. There are two variants:
Only components of the state vector are allowed to change. Use the command:
ST RC] RT]
Components of the state vector and one extra parameter may vary. In this case
the command looks like this:
npar dynpar] ST RC] RT]
( in this case DY(npar), YMIN(npar), YMAX(npar) must be set to some
reasonable values ), where:
RT - option (i.e. subcommand) that requires jacobian eigen-
values at the equilibrium point to be computed and dis-
played,
RC - option that requires message about stability or instability
of the equilibrium solution to be displayed,
npar - number of the parameter to be varied
dynpar - value of maximum allowed increment of the parameter
Y(npar). Is set, this value is used instead of DY(npar)
during execution of the current command, the value of
DY(npar) is not changed.
3.3 Continuation of a solution while parameter is
changed
Suppose that initial search for a equilibrium solution was successful, and solution is in
the X vector. We want to investigate the dependence of this solution and it's stability
on a parameter Y(npar). DY(npar), YMIN(npar), YMAX(npar) must be set to
some reasonable values. Let's enter a command:
npar nstep] nout] dynpar] ST NEWT] options]
where
npar - number of the parameter to be varied
nstep - signed number of continuation steps. When sign of nstep
changes, the direction of motion" along a parameter al-
so changes. Default is nstep = 0. If nstep = 0, only
convergence to a solution is performed.
nout - results will be displayed or plotted on each nout-th con-
tinuation step. Default is nout = 1.
36. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 35
dynpar - value of maximum allowed increment of the parameter
Y(npar). Is set, this value is used instead of DY(npar)
during execution of the current command, the value of
DY(npar) is not changed.
NEWT - this option sets Newton method instead of default one
(default is continuation algorithm)
options - other options (i.e. subcommands) modifying the algo-
rithm.
Dependence of solution on a parameter usually is calculated using continuation al-
gorithm. But sometimes it is necessary to go along continuation curve with a xed
parameter increment on each step. In this case convergence is performed using Newton
method (when only state variables are allowed to vary). This regime is activated by
means of NEWT option.
3.4 Calculation of right-hand sides { RTN com-
mand
This section describes full syntax of RTN command. It is of interest for experienced
users only.
The command may be called in a cycle" { a number of calls with di erent X or Y
may be done. Syntax of the command is as follows:
nstep] nout] ivar] dvar] RTN
where
nstep - number of calls, default is nstep = 1
nout - results will be displayed on each nout-th call. Default is
nout = 1.
ivar - if ivar 6= 0 is set then after each call either X(ivar) when
ivar > 0 or Y(jivarj) when ivar < 0 will be incremented
with dvar. Default is ivar = 0 i.e. no incrementing.
dvar - value of increment (see ivar description), default is
dvar = 0.
3.5 Homotopy method for searching equilibrium
solution
There is nothing mysterious in this method despite its strange" name. Here we try
to nd a solution to the system in question beginning from known solution to some
standard" system. Special auxiliary parameter is introduced. Varying this parameter
one can smoothly proceed from standard" to original system.
Suppose that we are looking for a solution to the system of equations:
f (x) = 0 x f 2 RN (3.3)
37. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 36
We'll introduce standard" system of equations:
g(x) = 0 x f 2 RN (3.4)
and let x0 be a known solution to the system (3.4).
Now consider an auxiliary system of equations:
F (x ) = 0 where F (x ) = f (x) + (1 ; ) g (x) (3.5)
where is an auxiliary parameter.
It is obvious that F (x0 0) = 0. Applying a continuation algorithm 4] to the system
(3.5) with initial conditions x = x0 and = 0 and rising , one can get a dependence of
the solution on auxiliary parameter. If we are lucky to continue that solution to the value
of parameter = 1, and to get x1 : F (x1 1) = 0, then x1 obviously will be a solution
to the original system (3.3). Note that if x0 is the only solution to the standard" system
and if jacobian of the original system
J (x0) = dfi
dxj
is nonsingular at x0, then the spatial curve representing the dependence of the solution
to the auxiliary system on a parameter will not be able to return to parameter value
= 0. In that case the success of the method is much more likely.
Note the important feature of the algorithm. If the search for a solution x1 to the
system in question is successful, then x0 and x1 will have the same stability parity" i.e.
either odd or even number of unstable" eigenvalues. It means that, for example, one
can't access the so-called saddle{type solution (with one unstable" eigenvalue) to the
system in question starting from stable solution to the standard" system.
The sequence of starting the algorithm is as follows:
1. Do the preliminary actions as stated in 3.1, i.e. set required accuracy, number of
iterations etc.
2. Load X vector with x0, the corresponding standard" system will be formed au-
tomatically.
3. Activate the algorithm using a command:
nstep] ireg] ipri] d ] min max] ST HOMO
where
38. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 37
nstep - estimated number of continuation steps per unit incre-
ment of . Default is nstep = 50.
ireg - allows to choose one of the three possible variants of the
standard" system:
ireg system
0 g(x) = f (x) ; f (x0)
1 g(x) = x; x0
2 g(x) =
(
; (x0i ; xi) if i = 1
(x0i ; xi) if i 6= 1
ipri - ipri 6= 0 allows interim results (i.e. solutions to the aux-
iliary system of equations) to be displayed. These results
may also be plotted on screen using Run{time graphics
options.
d - maximum allowed increment of a parameter per itera-
tion or continuation step. Default is d = 1=nstep.
min max - set the minimum and maximum allowed values of the pa-
rameter. max should be greater than 1. Default settings
are: min = ;d , max = 1: + d .
Usually the parameter Y(500) is used as . User subroutines should not rede ne
this parameter.
The command may be interrupted if necessary. Press Esc button , or the buttons
Control and C simultaneously once or twice.
Remember ! This method sometimes works, sometimes doesn't. Novice user may
try it if everything else fails.
3.6 Searching for a set of solutions
In this section we discuss SSNE { Systematic Search for solutions to the system of
Nonlinear Equations method.
Suppose that you are hunting for equilibrium solutions to the given system of equa-
tions and that you've got one. You suspect there are some other solutions, and you need
a regular algorithm to do the job. SSNE method is a good choice for you. Very often it
is able to nd another solution (if it exists). And often it nds all the solutions!
Let's consider the method in brief. Suppose that a nonlinear system of equations is
studied:
f (x) = 0 where f x 2 RN (3.6)
and that a solution x0 to the system (3.6) is known: f (x0) = 0. Let's de ne an auxiliary
system of equations of the size N-1, depending on a parameter xk:
fi6=k (xi6=k xk) = 0 (3.7)
We'll also consider the value of fk (xi6=k xk) as a functional.
39. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 38
It is obvious that components of x0 t the auxiliary system (3.7). Now we'll apply
a continuation method 4] and calculate the dependence of the solution to (3.7) on a
parameter xk. So we'll get a spatial curve. Check if there is a point on that curve where
functional fk changes sign or equals to zero. If such a point x1i6=k x1k exists, then x1
is a solution (and may be a new one!) to the given system (3.6). It is useful to repeat
all that for k = 1:::N.
The sequence of actions for SSNE algorithm is as follows:
1. Make all preliminary actions as mentioned in 3.1. Set required accuracy, maximum
numberof iterations, etc. Payspecial attention to theXOGR and DXdata arrays.
Upper and lower limits on the components of the state vector are to be reasonable,
otherwise either search may take a lot of time or nothing will be found.
2. Load known solution x0 into X vector.
3. Execute (it's a simplest variant) a command:
ST SSNE
The command will write all the found solutions including initial one into special
stack". It is possible to get the desired solution out of the stack using special
form of B command:
iB=nameto=F= =
where
i - number of the solution in stack"
nameto - solution is copied into state vector nameto
Note, that some big" commands may destroy the stack". It is recommended to
keep solutions immediately after ST,SSNE command.
Below there are some advices on usage of SSNE method.
In the present version the SSNE command cannot be used if the job was formed
using special data cards.
This method is time consuming. The possibility of in nite loop also cannot be
excluded, though we've put much e ort to avoid it. User may cancel the command
by pressing Esc button, or Control and C keys simultaneously a number of times
(no more than 2 N where N is the order of system).
If either the task is very simple or your computer is very powerful, it is highly
recommended to restart the algorithm a number of times using every solution
found as initial point. Doing so you greatly rise the probability to nd all the
solutions.
40. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 39
The experienced user may enjoy full{syntax ST,SSNE command:
ix1] ix2] iout] cXOGR] ST SSNE REST] NOINIT]
where
ix1 ix2 - k index (see algorithm description given above) will get
values k = ix1 :::ix2. If ix1 is set, then by default ix2 =
ix1. Otherwise, ix1 = 1 ix2 = N by default, N is the
order of given system of equations.
iout - iout 6= 0 allow interim data (i.e. search trajectories) to
be displayed or plotted using Run-time graphics options.
REST - this options prevents stack" of solutions formed by pre-
vious ST,SSNE command from erasure. New solutions
will be appended.
NOINIT - if this ag is set, then state vector loaded into X array
is not checked for being a solution to the system. The
option may be used in a situation when you haven't got
any solution, but have found a state vector which satis es
all equations except k-th. Load this vector into X, then
execute ST,SSNE command with ix1 = ix2 = k.
cXOGR - if set, extends the region (i.e. modi es minimum and
maximum allowed values) for the temporary parameter
xk cXOGR times. Default is cXOGR = 1.
Try and use SSNE algorithm { and you'll be rewarded !
3.7 Bifurcation values of parameters. Bifurcation
curves.
Bifurcations are the moments of birth and death in nonlinear world. When some param-
eter (or a number of parameters { in complex situations) reaches critical (bifurcational)
value then solutions to the system of equations either appear or vanish. These solutions
might be equilibrium solutions or periodic solutions (loops) or even complex attractors.
This section is intended for those who are interested in bifurcations.
Krit package allows to trace the following bifurcational situations for equilibrium
solutions:
- variant 0: determinant of the jacobian matrix dfi
dxj
reaches zero,
- variant 1: real eigenvalue of the jacobian matrix crosses imaginary axis,
- variant 2: complex pair of eigenvalues crosses imaginary axis,
- variant 3: any eigenvalue of the jacobian crosses imaginary axis.
The sequence of preliminary actions before searching bifurcations is the following:
41. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 40
1. Actions mentioned in 3.1 are performed.
2. Load some equilibrium solution or approximation to it into X vector. Note, that
convergence to bifurcation solution may be poor if initial solution (i.e. state vector
Xand corresponding value(s) of varying parameter(s)) is too far away. A lot of time
will be saved if one gives initial solution as close to bifurcational one as possible.
User can nd such a solutions using continuation{along{parameter" form of ST
command.
3. Do not forget to set appropriate values for the parameters to be varied into
DY,YMIN,YMAX arrays.
4. It is possible to set accuracy to be reached for bifurcation criterion (see variants
0|3). Default value is 0.001. One can set the desired accuracy using command:
EP = value
The value will be kept until changed by another EP command.
5. You may choose the variant of bifurcation criterion. Default is variant 0. Use the
command:
BIF = nvar
where nvar is the variant number. The entered number becomes new default value.
Now, if you wish to nd bifurcational point using only one parameter, you are to
execute the following command:
npar dy] ST BIF = nvar] options]
where
npar - number of varying parameter.
dy - value of maximum allowed increment of the parameter
Y(npar). Is set, this value is used instead of DY(npar)
during execution of the current command, the value of
DY(npar) is not changed.
BIF - this obligatory option indicates that search for bifurca-
tional solution is required.
nvar - the variant number of bifurcation criterion.
options - some other options, AC,ITR,RC,RT for example.
If bifurcational solution is searched using two varying parameters, then the command
will look like that:
npar1 npar2 dy1] dy2] ST BIF = nvar] options]
where
42. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 41
npar1 - number of rst varying parameter.
npar2 - number of second varying parameter.
dy1 - value of maximum allowed increment of the parame-
ter Y(npar1). Is set, this value is used instead of
DY(npar1) during execution of the current command,
the value of DY(npar1) is not changed.
dy2 - value of maximum allowed increment of the parame-
ter Y(npar2). Is set, this value is used instead of
DY(npar2) during execution of the current command,
the value of DY(npar2) is not changed.
BIF - this obligatory option indicates that search for bifurca-
tional solution is required.
nvar - the variant number of bifurcation criterion.
options - some other options, AC,ITR,RC,RT for example.
If you need to get a bifurcational curve (i.e. to continue bifurcational solution varying
two parameters), you are to use full{scale syntax of ST,BIF command:
npar1 npar2 nstep nout] dy1] dy2] ST BIF = nvar] NEWT] options]
where
npar1 - number of rst varying parameter.
npar2 - number of second varying parameter.
nstep - signed number of continuation steps. When sign of nstep
changes, the direction of motion" along a parameter al-
so changes. Default is nstep = 0. If nstep = 0, only
convergence to a solution is performed.
nout - results will be displayed or plotted on each nout-th con-
tinuation step. Default is nout = 1.
dy1 - value of maximum allowed increment of the parame-
ter Y(npar1). Is set, this value is used instead of
DY(npar1) during execution of the current command,
the value of DY(npar1) is not changed.
dy2 - value of maximum allowed increment of the parame-
ter Y(npar2). Is set, this value is used instead of
DY(npar2) during execution of the current command,
the value of DY(npar2) is not changed.
BIF - this obligatory option indicates that search for bifurca-
tional solution is required.
nvar - the variant number of bifurcation criterion.
NEWT -
this option sets Newton method instead of default one
(default is continuation algorithm).
options - some other options, AC,ITR,RC,RT for example.
Novice user, be careful ! Searching for bifurcations is a hard job, the method requires
ne tuning. It is necessary to choose appropriate bifurcation criterion, DX and DY
43. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 42
values, etc. You need a good initial state vector too. The most common error is too
large dy values.
Try it, use it, enjoy it !
3.8 Bifurcations of codimension 2
There is an experimental algorithm that allows the user to nd the bifurcation of codi-
mension 2 when either two real eigenvalues are located on the imaginary axis or a complex
pair reaches zero.
The package allows to trace the following bifurcational situations for equilibrium
solutions:
- variant 1: two real eigenvalue of the jacobian matrix are located on the imaginary
axis,
- variant 2: complex pair of eigenvalues reaches the point (0,0).
The sequence of preliminary actions before searching bifurcations is the following:
1. Actions mentioned in 3.1 are performed.
2. Load some equilibrium solution or approximation to it into X vector.
3. Do not forget to set appropriate values for the parameters to be varied into
DY,YMIN,YMAX arrays.
4. It is possible to set accuracy to be reached for bifurcation criterion (see variants 1
and 2). Default value is 0.001. One can set the desired accuracy using command:
EP = value
The value will be kept until changed by another EP command.
5. You may choose the variant of bifurcation criterion. Default is not set. Use the
command:
CUSP = nvar
where nvar is the variant number. The entered number becomes new default value.
Attention! The commands BRP, BIF and CUSP commands share the same
internal variable to keep the number of criterion, thus undesirable interference
might take place.
Now, if you wish to nd bifurcational point using only two parameters, you are to
execute the following command:
npar1 npar2 dy1] dy2] ST CUSP = nvar] options]
44. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 43
If bifurcational solution is searched using three varying parameters, then the com-
mand will look like that:
npar1 npar2 npar3 dy1] dy2] dy3] ST CUSP = nvar] options]
If you need to get a bifurcational curve (i.e. to continue bifurcational solution varying
three parameters), you are to use full{scale syntax of ST,CUSP command:
npar1 npar2 npar3 nstep nout] dy1] dy2] dy3] ST CUSP = nvar] NEWT]
where
npar1 - number of rst varying parameter.
npar2 - number of second varying parameter.
npar3 - number of third varying parameter.
nstep - signed number of continuation steps. When sign of nstep
changes, the direction of motion" along a parameter al-
so changes. Default is nstep = 0. If nstep = 0, only
convergence to a solution is performed.
nout - results will be displayed or plotted on each nout-th con-
tinuation step. Default is nout = 1.
dy1 - value of maximum allowed increment of the parame-
ter Y(npar1). Is set, this value is used instead of
DY(npar1) during execution of the current command,
the value of DY(npar1) is not changed.
dy2 - value of maximum allowed increment of the parame-
ter Y(npar2). Is set, this value is used instead of
DY(npar2) during execution of the current command,
the value of DY(npar2) is not changed.
dy3 - value of maximum allowed increment of the parame-
ter Y(npar3). Is set, this value is used instead of
DY(npar3) during execution of the current command,
the value of DY(npar3) is not changed.
CUSP - this obligatory option indicates that search for bifurca-
tional (codimension 2) solution is required.
nvar - the variant number of bifurcation criterion.
NEWT - this option sets Newton method instead of default one
(default is continuation algorithm).
3.9 Branching points
Sometimes two or more branches of the equilibrium solutions (depending on a parameter)
intersect at some point in the extended state space (state vector is appended by a
correspondent parameter). The point is called the branching point.
Krit package is able to nd branching point and to calculate the dependence of it
on the second parameter.
45. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 44
The point is assumed to be branching when the extended jacobian matrix used to
calculate the continuation step (see 4]) becomes singular.
Krit package allows to trace the following critical situations for extended jacobian
matrix:
- variant 0: determinant of the matrix reaches zero,
- variant 1: real eigenvalue of the matrix crosses imaginary axis.
The sequence of preliminary actions before searching branching points is the follow-
ing:
1. Actions mentioned in 3.1 are performed.
2. Load some equilibrium solution or approximation to it into X vector. Note, that
convergence to the branching point may be poor if initial solution (i.e. state vector
X and corresponding value(s) of varying parameter(s)) is too far away. A lot of
time will be saved if one gives initial solution as close to branching one as possible.
User can nd such a solutions using continuation{along{parameter" form of ST
command.
3. Do not forget to set appropriate values for the parameters to be varied into
DY,YMIN,YMAX arrays.
4. It is possible to set accuracy to be reached for branching criterion (see variants 0
and 1). Default value is 0.001. One can set the desired accuracy using command:
EP = value
The value will be kept until changed by another EP command.
5. You may choose the variant of branching criterion. Default is variant 0. Use the
command:
BRP = nvar
where nvar is the variant number. The entered number becomes new default value.
Attention! Both BRP and BIF commands share the same internal variable to
keep the number of criterion, thus undesirable interference might take place.
Now, if you wish to nd branching point using only one parameter, you are to execute
the following command:
npar dy] ST BRP = nvar] options]
where
46. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 45
npar - number of varying parameter.
dy - value of maximum allowed increment of the parameter
Y(npar). Is set, this value is used instead of DY(npar)
during execution of the current command, the value of
DY(npar) is not changed.
BRP - this obligatory option indicates that search for branching
point is required.
nvar - the variant number of branching criterion.
options - some other options, AC,ITR,RC,RT for example.
If branching point is searched using two varying parameters, then the command will
look like that:
npar1 npar2 dy1] dy2] ST BRP = nvar] options]
where
npar1 - number of rst varying parameter.
npar2 - number of second varying parameter.
dy1 - value of maximum allowed increment of the parame-
ter Y(npar1). Is set, this value is used instead of
DY(npar1) during execution of the current command,
the value of DY(npar1) is not changed.
dy2 - value of maximum allowed increment of the parame-
ter Y(npar2). Is set, this value is used instead of
DY(npar2) during execution of the current command,
the value of DY(npar2) is not changed.
BRP - this obligatory option indicates that search for branching
point is required.
nvar - the variant number of branching criterion.
options - some other options, AC,ITR,RC,RT for example.
If you need to get a dependence of the branching point on a second parameter (i.e.
to continue branching point varying two parameters), you are to use full{scale syntax of
ST,BRP command:
npar1 npar2 nstep nout] dy1] dy2] ST BRP = nvar] NEWT] options]
where
47. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 46
npar1 - number of rst varying parameter.
npar2 - number of second varying parameter.
nstep - signed number of continuation steps. When sign of nstep
changes, the direction of motion" along a parameter al-
so changes. Default is nstep = 0. If nstep = 0, only
convergence to a solution is performed.
nout - results will be displayed or plotted on each nout-th con-
tinuation step. Default is nout = 1.
dy1 - value of maximum allowed increment of the parame-
ter Y(npar1). Is set, this value is used instead of
DY(npar1) during execution of the current command,
the value of DY(npar1) is not changed.
dy2 - value of maximum allowed increment of the parame-
ter Y(npar2). Is set, this value is used instead of
DY(npar2) during execution of the current command,
the value of DY(npar2) is not changed.
BRP - this obligatory option indicates that search for branching
point is required.
nvar - the variant number of branching criterion.
NEWT - this option sets Newton method instead of default one
(default is continuation algorithm).
options - some other options, AC,ITR,RC,RT for example.
The method remains experimental and requires ne tuning.
3.10 Solution sensitivity towards parameter varia-
tions
To evaluate the sensitivity of the equilibrium solution and its stability towards parameter
variations, one can use a command
npar dy] ST SENSE = nvar]
where
npar - number of varying parameter.
dy - value of maximum allowed increment of the parameter
Y(npar). Is set, this value is used instead of DY(npar)
during execution of the current command, the value of
DY(npar) is not changed.
nvar - the variant number of bifurcation criterion (see the de-
scription of ST,BIF command).
If command terminates normally, then the value of d~x
dynpar
and d
dynpar
will be dis-
played, where is the value of bifurcation criterion.
48. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 47
3.11 Functional minimization on equilibrium sur-
face
Suppose you are studying equilibrium solutions depending on a number of parameters.
You've got a solution at a certain values of these parameters. You also have a functional
(i.e. expression depending on values of state variables and parameters), and it's necessary
to get a solution at some other values of parameters when functional reachesit's minimum
(or maximum). Krit can do something for you in this situation. Of course, global
extremum is not guaranteed.
The sequence of actions is the following:
1. The calculation of the functional is to be preprogrammed in user{supplied FUNC
subroutine. The value of the functional may be either stored in some parameter
or accessible as a formula.
2. Preliminary actions mentioned in BasicSec are to be performed. Required accuracy,
number of iterations etc. may be set.
3. Load known solution into X state vector. (Corresponding set of parameters is to
be loaded into Y parameter array). Execute a command: RTN
4. Add one more equation to your job. Use the command:
JOB = JOB :
and enter on the question mark prompt:
if value of functional is calculated as formula with number n:
?99 500 n
?(empty data card)
if the value of functional is stored as Y(i):
?99 500 900 0 0 i ;1
?(empty data card)
In this case the sign of functional is inverted, and you should maximize the
functional formed instead of minimizing, and vice versa.
Note. Experienced user may restore the kept job instead of forming it here.
Use JOB=? command to check the formed job.
5. It is possible to set the critical level of functional derivative. If the value of func-
tional derivative is less than this value, the point is considered to be extremum.
Use the command:
ACM = value
49. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 48
6. Now we can start the algorithm:
npar iy1 ::: iynpar nstep nout] dy1 ::: dynpar]] MO options]
where
npar - how many parameters are varied.
iy1 ::: iynpar - numbers of varying parameters.
nstep - signed number of minimization steps. If nstep > 0 then
minimization is performed, else functional is maximized.
nout - results will be displayed or plotted on each nout-th con-
tinuation step. Default is nout = 1.
dy1 ::: dynpar - values of maximum allowed increments of the parameters
during minimization.
options - some other options, AC,ITR,RC,RT for example.
3.12 Calculating cross{section of separating sur-
face by plane
What is separating surface? It is an imaginary boundary in the space of state variables.
Separating surface separates regions of attraction to di erent stable solutions to the
given system of dynamic equations. Separating surfaces de ne regions of stability of the
stable solutions to nite perturbations. That's why they are of interest for researcher.
If dimension of the state space (i.e. the order of given system of equations) is N then
dimension of separating surface is N ; 1. If N > 3 then it would be di cult to calculate
and visualize the entire surface. Krit o ers you a tool for calculating two{dimensional
cross sections of separating surface. A set of such sections may provide vital information
about system's behaviour.
3.12.1 Three possible ways
Your choice of the algorithm to be applied depends on your already accumulated knowl-
edge about system in question. If you know nothing except the stable solution to the
system and if region of stability is to be de ned for that solution, then you can:
try very simple, reliable, and extremely time{consuming method, described in
3.12.3. It's rst way.
be curious and attempt to nd other possible solutions to the system, stable and
saddle-type (one unstable eigenvalue) solutions are most important.
Have you got any saddle solutions? Each saddle solution always lies on the separating
surface.
Really, there may be a number of separating surfaces. It is very simple to check if it
is a surface of interest. Make a little step from saddle point along unstable eigenvector
50. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 49
and simulate the dynamics of the system. Then repeat it with a little step against that
eigenvector. If one of the two calculated curves approaches initial stable solution, you've
got right way!
Now new branching point". There exists one old method for calculating of separat-
ing surface, passing through known saddle solution. You may choose a number of points
in the vicinity of saddle point and simulate system dynamics in reverse time starting
from each one of these points. A set of obtained trajectories might give you some idea
of system behaviour. That's second way.
We do not advice you to use this old method, it doesn't work well even for low
order systems. Sometimes it may be useful for nding rst point belonging to a surface
cross{section.
The third way is described below, in 3.12.2.
3.12.2 Goman{Khramtsovsky algorithm
As usual, the general idea of the algorithm is very simple. An initial point on a cross{
section is taken and simulation of system dynamics is performed. At a certain moment
simulation is nished and an error (a measure of miss) is calculated, the saddle point
being the target. Numerical methods are used to reduce the error to zero.
The most important and most interesting in this method are the following moments:
how the moment to stop simulation is de ned,
how a measure of miss is calculated.
Theoretical background of the method can be found in 5]. In brief, it is easy to
calculate a vector normal to separating surface at saddle point. The spatial cylinder with
given radius is de ned, the axis of the cylinder passes through saddle point and goes
along with normal vector. Simulation of system's dynamics is stopped at the moment
when trajectory passes through the surface of the cylinder from outside. A measure of
miss is a signed value of projection of vector connecting saddle point and nal point of
simulation onto normal vector.
To start the algorithm, it is necessary:
to point out saddle solution
to calculate normal vector to separating surface at the saddle point
to de ne a secant plane and to get some point on it
to de ne a cylinder radius and a number of other auxiliary settings
The sequence for a Krit user is the following:
1. Perform preliminary actions as stated in BasicSec.
51. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 50
2. Load an arbitrary point belonging to the secant plane into XSF data array. The
plane passes through XSF and is parallel to two unit vectors of the coordinate
system. These vectors will be indicated later.
3. Load vector of maximum allowed increments of state variables into DXS data
array.
4. Use the options for settings:
TE = value - maximum simulation time. If it is reached, error message
with code 99 and minimum distance from saddle point
(in DXS-units) to trajectory will be displayed. Default
is 30.
RAD = value - cylinder radius in DXS-units. Usually it is in the range
1:::5 depending on distance from current point on the
secant plane and saddle point. Default value is 1.
ACS = value - sets the desired accuracy. The algorithm tries to reduce
the miss to zero with this accuracy. Default value is 0.01.
5. Load normal vector to separating surface into XAN data array.
6. Load saddle solution into the top of the stack" of solutions on control i.e. into
data array C .
The simplest way to perform actions 5|6 is to load saddle solution into X vector
and execute a command:
SINIT
7. Report to the Krit package two numbers i1 and i2. The secant plane will be
parallel to unit vectors along corresponding axes of coordinate system.
8. Load an initial point on secant plane in coordinates (xi1,xi2) into XS vector of the
size 2.
To execute actions in 7|8 one may use a command calculating the value of miss
for initial point:
i1 i2 v1 v2 RTNSEP
where:
i1 i2 - de ne vectors parallel to the secant plane
(v1 v2) - initial point on secant plane
Now we are to nd an initial point suitable for starting iterative algorithm. We need
a trajectory starting at the initial point to cross the cylinder (for a miss value can be
computed). Search for such a point requires some e ort, and the following extended
form of RTNSEP command may be useful:
i1 i2 v1 v2 nstep dv1 dv2 RTNSEP
52. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 51
where:
i1 i2 - de ne vectors parallel to the secant plane
(v1 v2) - initial point on secant plane
nstep - number of calls to simple form" RTNSEP command
(dv1 dv2) - increments to (v1 v2) after each call
When unsuccessful, RTNSEP command displays error message and reports mini-
mum distance to saddle solution during simulation time. One can try to minimize that
distance varying (v1 v2). It is a good method for nding initial point.
If suitable initial point is found, you are halfway to the goal. Now let's use the main
tool { SEP command. To nd initial point with required accuracy, execute a command:
i1 i2 ] v1 v2 dv1 dv2] SEP INIT
where:
i1 i2 - de ne vectors parallel to the secant plane
(v1 v2) - initial point on secant plane
(dv1 dv2) - maximum allowed increments to (v1 v2)
As usual, square brackets indicate that a term is optional. You must use them only
if you want to change previous settings.
If everything is OK, keep the point. Now we can proceed with cross section:
i1 i2 nstep nout] v1 v2 dv1 dv2] SEP
" (
REST
INIT
)#
options]
where:
i1 i2 - de ne vectors parallel to the secant plane
nstep - signed number of continuation steps along the calculat-
ed curve. When sign of nstep changes, the direction of
motion" also changes.
nout - results will be displayed on each nout-th continuation
step. Default is nout = 1.
REST and INIT - SEP command always memorizes starting point and last
successfully calculated cross-section point, keeping them
in status-keeping le. By default, SEP commands tries
to continue the calculation of the cross-section beginning
from last successfully calculated point from previous run!
Sometimes it may bring about troubles. Two options are
used to modify the performance of the command:
INIT - if the values v1 v2 are set, they will be used as
initial point. Otherwise XS vector will be used.
Without this option v1 v2 are ignored.
REST - calculations will start from the point used as
initial on the previous run of SEP command.
(v1 v2) - initial point on secant plane
53. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 52
(dv1 dv2) - maximum allowed increments to (v1 v2)
options - other options (i.e. subcommands) modifying the algo-
rithm.
These are main features of the command. Below some additional information can be
found.
Protection against other stable solutions
If there are other stable solutions to the studied system, then there is a possibility of
being captured by them during simulation. To protect somehow against such a situation,
do the following:
load stable equilibrium points or arbitrary points belonging to more complex stable
attractors (i.e. limit cycles, tori etc.) into C data array. First place the point into
one of state vectors, and then execute a command:
iB=C=F=id=
where
i - number of this solution in stack". Note, that i > 1 since
saddle solution is the rst in stack".
id - name of state vector
Stable solution must be loaded in stack" C without gaps, beginning with number
i = 2.
For every solution in stack" radius of spatial sphere (in DXS-units) is to be
set. If the trajectory enters such a sphere with the center in the corresponding
stable solution, the simulation is stopped and error message with code nn00 is
displayed, nn is the number of the stable solution. Radius of the sphere is set by
the command:
n radSETRAD
where
n - number of solution in stack"
rad - radius of the spatial sphere
Tell to the package how many stable solutions you want to handle:
ATR = n
where n - is the number of stable solutions in stack".
Command forming XS vector
This command is not of great value, but it exists and may be used. The command forms
2-dimensional XS vector using full-size state vector and two numbers of components.
The syntax of the command is as follows:
i1 i2 XSORG id]
54. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 53
where
i1 i2 - de ne vectors parallel to the secant plane
id - name of the full-size state vector, default name is X.
For example, if we use a command 1,3XSORG/X/, we'll get a vector XS = (x1 x3).
Sections in the parameter plane. Mixed sections.
If you are interested in stability towards parameters' variations, then this algorithm can
also be e ectively used. All that is very simple. The only thing you are to change in the
above mentioned commands is that you are to mention with minus sign the number(s)
of parameter(s) instead of i1 (or i1 and i2).
Some advices.
Incrementsfor cross-section plane coordinates xsi1 and xsi2 should be 3:::10 times
less then those used for corresponding components of state vector when ST com-
mand is applied.
Sometimes it is possible to speed up the algorithm by rising the simulation step.
Default step is 0.01. The step can be changed by DT command:
DT = step
It is also possible to use Adams integration method of the order n n < 5 instead
of default Runge{Kutta 4-th order method. Use the command:
ADMS = n
It is extremely important to set proper radius of the cylinder. Too small radius
will bring in convergence problems and slow data output. Too large radius leads
to the loss of accuracy.
3.12.3 Scanning method for calculating cross-section
This is strict, reliable but in many cases time-consuming method. First, a 2-dimensional
secant plane in the state space is de ned. Then one gets a (large) number of control
points on that plane. Each point is marked depending on stable solution in the vicinity of
which simulation was stopped. The regions of stability's boundaries (i.e. cross-sections
of separating surfaces) are clearly seen on such plot.
In order to start this algorithm it is necessary:
to de ne a secant plane and positions of control points.
to point out stable solutions to the package.
to set radii of control spheres around stable solutions, and some other settings.
55. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 54
The sequence for this algorithm is the following:
1. Perform preliminary actions as stated in BasicSec.
2. Load an arbitrary point belonging to the secant plane into XSF data array. The
plane passes through XSF and is parallel to two unit vectors of the coordinate
system. These vectors will be indicated later.
3. Load vector of maximum allowed increments of state variables into DXS data
array.
4. Use the command:
TE = value - maximum simulation time. If it is reached, error message
with code 99 will be displayed. Default is 30.
5. Report to the Krit package two numbers i1 and i2. The secant plane will be
parallel to unit vectors along corresponding axes of coordinate system. It may be
done by means of XSORG command:
i1 i2 XSORG
(in this case XS vector is lost).
Also, this may be done using a command:
19 20 1 i1 i2 U=LY=
6. Load stable equilibrium points or arbitrary points belonging to more complex
stable attractors (i.e. limit cycles, tori etc.) into C data array. First place the
point into one of state vectors, and then execute a command:
iB=C=F=id=
where
i - number of this solution in stack".
id - name of state vector
Stable solution must be loaded in stack" C without gaps, beginning with number
i = 1.
7. For every solution in stack" radius of spatial sphere (in DXS-units) is to be set.
If the trajectory enters such a sphere with the center in the corresponding stable
solution, the simulation is stopped and a control point is marked. Radius of the
sphere is set by the command:
n radSETRAD
where
n - number of solution in stack"
rad - radius of the spatial sphere
n = 1 corresponds to the rst stable solution.
56. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 55
8. Tell to the package how many stable solutions you want to handle:
ATR = n
where n - is the number of stable solutions in stack" minus one.
9. Run the plotting command:
nx 1 ny 1 iout xmin xmax ymin ymaxSEPLT
where
nx ny - de ne the size of the plot to be ny rows nx columns.
There will be nx ny control points.
iout - output switch. If iout 6= 2, the plot will be displayed
on the screen. If iout 6= 1 the plot will be written into
graphics information le.
xmin xmax - de ne upper and lower limits of the rst coordinate on
the secant plane for scanned region.
ymin ymax - de ne upper and lower limits of the second coordinate on
the secant plane for scanned region.
Plot is generated in alphanumerical mode. Every point on the plot is lled with a
symbol. Symbols from 1" to 9" indicate that simulation was stopped in the vicinity
of the stable solution with corresponding number. Symbol ." means that simulation
was stopped because simulation time limit was reached. Symbol ?" shows that corre-
sponding trajectory left the allowed region in state space (de ned by values in XOGR
array).
Scanning may be performed varying not only components of the state vector, but
also using parameters. Set with minus sign the number(s) of parameter(s) instead of i1
(or i1 and i2) in the step 5 of the sequence.
3.13 Assessmentof stability region using Lyapunov
method
It is impossible, we believe, to nd a researcher specializing in stability and control
problems who never tried to investigate stability of solution using appropriate Lyapunov
function. Krit authors couldn't escape it also.
We included in the package a number of commands supporting Lyapunov method.
They automatically generate Lyapunov function for a given stable solution to the system
of equations, and check the value of derivative of that function in automatically selected
checkpoints. They are seeking for a point where the derivative changes its sign. If such
a point is found, the critical value of Lyapunov function will be computed. Knowing
that value, the sections of stability region can be calculated.
But no guarantees! We can proudly say that our automatically-built Lyapunov func-
tion is not the worst one. Surely, it's not the best one. And always there is a possibility
that a net" of control points is not good enough... But why not to try?
57. CHAPTER 3. QUEST FOR EQUILIBRIUM SOLUTIONS 56
Let's look at the formulas. We are studying the system of the form:
_x = f (x) (3.8)
Let x0 be a stable solution to the system (3.8). Linearizing equations (3.8) in the vicinity
of x0 we'll get:
_x = J x
where J is the Jacoby matrix.
Now, we are solving eigenvalue/eigenvector problem for jacobian:
J X = X
where:
X - matrix with jacobian eigenvectors in its columns,
- block{diagonal matrix. The eigenvalues of jacobian stand
on the diagonal of this matrix.
Substituting x = X + x0 we'll get the linearized equations in the form
_ =
Now let's de ne Lyapunov function using quadratic form with N matrix:
v = T N
Derivative of this Lyapunov function is computed using formula:
_v = 2 T N
There are ve variants of the diagonal matrix N:
basic variant:
Nii = ;
1
2Re i
variant 1:
Nii = 1
variant 2:
Nii = 1
(Re i)2
Variants 3:::5 di er from those mentioned above with auxiliary dx;2
i multiplier,
where dxi is the i-th element of the DX array of maximum allowed increments.
It is easy to check that function v is a Lyapunov function for studied system of
equations (3.8) in the vicinity of stable solution x0. If we return to original variables
we'll get Lyapunov function in the form:
v = (x; x0)T P (x ; x0)