M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

138

description

М.Г.Гоман, А.В.Храмцовский «Пакет программ КРИТ. Руководство пользователя. Версия 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.

Transcript of M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Page 1: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Mikhail Goman

Andrew Khramtsovsky

KRITScienti�c Package

User GuideVersion ����

����

Page 2: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Contents

Introduction �

Version ���� release notes �

� Package Installation �

� Getting started ����� That�s what you are to do �rst � � � � � � � � � � � � � � � � � � � � � � � ����� Starting a program � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Basic Krit data arrays� Data input and output� � � � � � � � � � � � � � � ���� Output of data from Krit data arrays � � � � � � � � � � � � � � � � � � � ���� Input of data into arrays � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Keeping and restoring of arrays � � � � � � � � � � � � � � � � � � � � � � � ���� Moving state vectors � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Calculation of right hand sides� System de�nition� � � � � � � � � � � � � � ���� First Krit session with new task � � � � � � � � � � � � � � � � � � � � � � ������ When you are in trouble��� � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Interrupts � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

� Quest for equilibrium solutions ����� Basic concepts � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Search for equilibrium solution � � � � � � � � � � � � � � � � � � � � � � � � ���� Continuation of a solution while parameter is changed � � � � � � � � � � � ��� Calculation of right�hand sides � RTN command � � � � � � � � � � � � � ����� Homotopy method for searching equilibrium solution � � � � � � � � � � � ����� Searching for a set of solutions � � � � � � � � � � � � � � � � � � � � � � � � � �� Bifurcation values of parameters� Bifurcation curves� � � � � � � � � � � � ���� Bifurcations of codimension � � � � � � � � � � � � � � � � � � � � � � � � � ��� Branching points � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Solution sensitivity towards parameter variations � � � � � � � � � � � � � ����� Functional minimization � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Cross�section of separating surface � � � � � � � � � � � � � � � � � � � � � �

������ Three possible ways � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Goman�Khramtsovsky algorithm � � � � � � � � � � � � � � � � � � ������ Scanning method for calculating cross�section � � � � � � � � � � � ��

Page 3: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CONTENTS �

���� Assessment of stability region using Lyapunov method � � � � � � � � � � ��

� Mathematical simulation �

� Hunting for loops ����� How to �nd and study periodic solutions � � � � � � � � � � � � � � � � � � ��

����� Full syntax of RTNP command � � � � � � � � � � � � � � � � � � � ����� Bifurcations of loops � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

� Strange strange nonlinear world��� ���� Mapping as a tool for studying nonlinear system � � � � � � � � � � � � � � ���� Mapping as a mean of bifurcational analysis � � � � � � � � � � � � � � � � ���� �Box� algorithm for searching attractors � � � � � � � � � � � � � � � � � � �

����� Continuation of a solution � � � � � � � � � � � � � � � � � � � � � �

� More about the package �� �� Macroprocessing of the input commands � � � � � � � � � � � � � � � � � � � �� Execution of the DOS command � � � � � � � � � � � � � � � � � � � � � � � � �� Syntax of the Krit command language � � � � � � � � � � � � � � � � � � � �

���� Syntax of the option � � � � � � � � � � � � � � � � � � � � � � � � � ���� How a command is executed � � � � � � � � � � � � � � � � � � � � � �

� Options for the local stability analysis � � � � � � � � � � � � � � � � � � � ��� Eigenvalues � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��� Message about stability type � � � � � � � � � � � � � � � � � � � � � ��� Eigenvectors � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� �� Jacoby matrix � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� ��� Working with submatrix � � � � � � � � � � � � � � � � � � � � � � � �� ��� Special e�ects � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

� Advanced topics ����� Run�time graphics � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

����� Keeping pictures in memory� Composed pictures� � � � � � � � � � ������� Color selection � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Drawing loops and other attractors � � � � � � � � � � � � � � � � � � ���� Viewing stored screen image � � � � � � � � � � � � � � � � � � � � � � ����� Clear the screen � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Selecting colors for SCS command � � � � � � � � � � � � � � � � � ������ Post�graphics using SAVE��les � � � � � � � � � � � � � � � � � � � ��

��� How to keep the results in �les � � � � � � � � � � � � � � � � � � � � � � � � ������� Keeping parameters � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Keeping roots � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ How to work with �le � � � � � � � � � � � � � � � � � � � � � � � � � �

��� Built�in calculator � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Using Fortran�like expressions � � � � � � � � � � � � � � � � � � � � ������ Simple command that makes loops � � � � � � � � � � � � � � � � � �

Page 4: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CONTENTS �

����� Arithmetic commands � � � � � � � � � � � � � � � � � � � � � � � � ��� Solving ��nd order system graphically � � � � � � � � � � � � � � � � � � � � ��� One more graphical command for ��nd order systems � � � � � � � � � � � ���� Graphical processing of the stored results � � � � � � � � � � � � � � � � � � �� Selecting a point in the vicinity of the solution � � � � � � � � � � � � � � � ������ Customizing input and output � � � � � � � � � � � � � � � � � � � � � � � � ���

����� Switching on and o� output of certain types of data � � � � � � � � ������� Handling input and output streams � � � � � � � � � � � � � � � � � �������� Handling �les � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� ���� Miscellaneous � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

�� Low�resolution run�time graphics � � � � � � � � � � � � � � � � � � � � � � ������� Saving a parameter vector as a procedure � � � � � � � � � � � � � � � � � � ������� User�de�ned scanning command � � � � � � � � � � � � � � � � � � � � � � � ������� �Empty� command � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Task transfer from CAD Dynamics �� � � � � � � � � � � � � � � � � � � � ���

Programming batch procedures ����� Calling a procedure � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Procedure layout � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Procedures with arguments � � � � � � � � � � � � � � � � � � � � � � � � � ���

���� Prede�ned arguments � � � � � � � � � � � � � � � � � � � � � � � � � ���� Loops and jumps � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

��� Ask�the�user commands � � � � � � � � � � � � � � � � � � � � � � � ���� Miscellaneous � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

���� Displaying messages � ECHO command � � � � � � � � � � � � � � ������� Waiting for a keystroke � � � � � � � � � � � � � � � � � � � � � � � � ������� Displaying the procedures� commands � � � � � � � � � � � � � � � � ���

�� Accuracy test � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� How to use a parameter value as a data �eld value � � � � � � � � � � � � � ���

� �� Parameter as integer value in the data �eld � � � � � � � � � � � � � ���� �� Parameter as real value in the data �eld � � � � � � � � � � � � � � ���

�� �Stacks� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Stack initialization � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Getting vector from stack � � � � � � � � � � � � � � � � � � � � � � ������� Loading vector into stack � � � � � � � � � � � � � � � � � � � � � � � ������ Loading SSNE solutions into stack � � � � � � � � � � � � � � � � � ���

� Composed output string � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Entering text into the string � � � � � � � � � � � � � � � � � � � � � ����� Entering integer value into the string � � � � � � � � � � � � � � � � ����� Entering real value into the string � � � � � � � � � � � � � � � � � � ���� Output of the string formed � � � � � � � � � � � � � � � � � � � � � ���

Supplement� List of Krit commands and options ���

Page 5: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Introduction

We present in this book a brief description of the possibilities and command language ofthe Krit scienti�c package� The package was designed for studying nonlinear systemsof the ordinary di�erential equations�

Krit package employs the methodology based on the achievements of the moderntheory 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��� andto 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 whilechanging a parameter �in this case the original continuation algorithm is applied��

� to �nd periodic solutions �closed orbits�� to study their local stability� and toinvestigate their dependence on a parameter�

� to �nd bifurcation points �i�e� limit and branching points�� and to examine theirdependence on a parameter�

� to �nd a set of isolated real solutions of a system of nonlinear equations �knowing inadvance one of these solutions� the original systematic search method is applied��

� to simulate the dynamics of the system of nonlinear di�erential equations usingdi�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 laterprocessing and drawing�

Krit is rather young� It was born in ���� and now it just begins to do real job�The package remains experimental� so the algorithms and programs undergo permanent

Page 6: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Introduction �

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 nonlinearproblems�

Designing the package� one of the goals was to minimize the programming needed tostudy a new task �note� that the programming cannot be eliminated� especially if thee�ciency of the code is of importance�� We also attempted to implement a compact andpowerful command language� We suppose that to a certain extent we succeeded to doso�

Of course� Krit looks somewhat old�fashioned� You can�t �nd here neither colorfulwindows nor on�line help nor mouse support��� In general� that�s due to historical reasonssince it�s hard enough to change the technology of the sophisticated package�

Now we are re�writing the package using present�day �friendly interface� conceptsand C�� programming language� But� since Fortran language programs are much moreeasy to transfer to new types of computers�CPUs� we continue the development of thisversion of the package� Now the ���bit version based on NDP Fortran is operational�

At the same time old�fashioned systems has their own charm and beauty� We hopethat Krit as it is may be useful for scientists despite all the shortcomings� Love it andyou will be rewarded�

Moscow� August ����� Mikhail GomanAndrew Khramtsovsky

Page 7: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Version ���� release notes �

Version ���� release notesVersion ��� of the Krit package is an expansion and re�nement of the version ���The versions are upward compatible i�e� all the commands of the version �� will workproperly under new version�

There are the following di�erences between versions�

� The capabilities of the Krit built�in calculator are greatly increased� That�s whythis manual contains re�written full descriptions of the calculator�

� The macroprocessing of the input commands is added� Now the user can accesssome vital information about program environment�

� New conditional commands �IF CSS CSI� appeared� IF command is especiallyuseful 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 usedto 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 ofthe � 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 ���� p����� isremoved�

� The bug in SSNE command is detected� This command cannot be used properlywith 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�

Page 8: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter �

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 seconddisk contains Fortran compiler� linker� as well as Fortran and C libraries�

To install the package� please follow these instructions �

�� Place the �rst distribution disk into A� ���� Mb� � inch� �oppy disk drive� If your��inch �oppy drive is called B�� place the disk into that drive and then execute aDOS command �at that very moment your current directory must be somewhereon the hard disk��

SUBST A� B��

If you have no suitable drives at your PC� copy the �les from the distribution disksinto some directory on the hard disk � through some other PC�� Then execute DOScommand�

SUBST A� �full�name�of�the�directory�

�� Run the installation program INSTALL� If you have got the Microsoft Fortran ��compiler� Microsoft linker and the library for Microsoft C ��� compiler� then usethe installation program as follows�

INSTALL d �

where d� is the name of the drive on which you want to install the package� Beready 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 workwith 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

Page 9: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PACKAGE INSTALLATION �

You need ��� Mb of disk space for �full mode� installation� and about ��� Mb for�small mode� installation�

�� The installation program begins a dialog in order to set proper paths to the Fortrancompiler and library� C� library� linker and �optionally� to the CAD �Dynamics�library� You�ll get the following menu on the screen�

The settings are �

�� Path to Fortran compiler � �default path�

� Path to Fortran library � �default path�

�� Path to C� library � �default path�

� Path to CAD libraries� �default path�

� Path to linker � �default path�

Press number �� to change� � to install� ESC to quit

If you press keys ����� 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 ofsearching 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 ��� key to perform the installation� Asa 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 tocreate overlays while making user program�

� PRO � the directory for �shared� Krit procedures� When somebody makes agood procedure useful for a number of Krit users� place it into that directory�

Page 10: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PACKAGE INSTALLATION

� DEMO � the directory that contains the example problem �well�known vander Pol oscillator� and demonstrator� Use it to check quickly the success ofinstallation�

� If you started the installation program with FULL option� you will be promptedto set up the Microsoft Fortran ��� compiler �and after that Microsoft C ver� ���library�� You may accept the installation pressing �Y�� reject it pressing �N� or quitthe installation program pressing ESC key�

� if you accepted the installation of the Fortran compiler� all the necessary �leswill be placed into the directory d��FOR �

� if you accepted the installation of the C library� you will get the followingdirectory structure�

d�� root directory

� C� directory �no files�

�� LIB subdirectory �file LLIBC��LIB�

�� At the end of installation the program will remind you about actions necessary tomake the installation complete�

� First� include the path to the d��VK�BAT directory into the list of defaultpaths set by PATH command in AUTOEXEC�BAT �le �located in theroot 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 isnot 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

�� 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 F� then select Commands menu item and afterthat select ExtensionsF ileEdit item� Then edit the extensions �le �add the linementioned above� and press F� and ESC to save your edits and exit��

After that �after the installation is complete� you make work with the packageas 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 makingcommand will be executed with this �le�

Page 11: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PACKAGE INSTALLATION ��

� Reboot your computer�

�� Now you may work with the package� Prepare a Fortran�language �le with FUNCuser�de�ned subroutine �and other subroutines if necessary�� as described in UserGuide� 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 beginyour work� You also may use some options when starting the EXE��le�

S��skf�filename� � allows you to use the status�keeping �le with thename 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 thatdi�ers from the default one �i�e��EXE�filename�without�extension��LST�

G��grf�filename� � allows you to use the �graphical information� �lewith 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� theprocedure �filename� will be executed�

�filename� � allows you to to run the package in batch mode� theprocedure �filename� will be executed�

D��directory� � allows you to use the directory for �common� pro�cedures with the name� that di�ers from the defaultone � �VK�PRO on current drive �

P��directory� � allows you to use the directory for users�s procedureswith the name� that di�ers from the default one �current directory name �

U��directory� � allows you to use the directory for Krit utilities withthe name� that di�ers from the default one � �VK�BATon current drive �

Page 12: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PACKAGE INSTALLATION ��

Z�d � d is a drive letter� This drive will be used to storesome temporary �les� Use it if the environment variablesKRITTMP or TMP are not set properly�

I � allows you to get the information message about freememory in default data segment�

� The Krit user is to know� that his EXE�program starts as follows�

� the STARTUP�COM procedure from �VK�BAT directory is executed �if itexists�� The procedure must �nish its activities with END command� Theinstallation program creates �default� STARTUP�COM procedure whichwrites the information about every started Krit EXE��le into system journal�le SYSTEM�LOG in the �VK�BAT directory�

� the STARTUP�COM procedure from current directory is executed �if itexists�� Place your �standard� initialization commands into it� The proceduremust 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 theinteractive session is activated�

��� To test quickly the success of installation� go to d��VK�DEMO directory� Preparethe EXE��le using one of the following commands�

PREP VANPOL

orPREPKRT VANPOL

If the EXE��le is build successfully� try to run the demonstrator procedure�

VANPOL DEMO

Page 13: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter �

Getting started

��� That�s what you are to do �rst

So� now you know about the existence of the Krit package� and you are ready to tryit despite all the doubts and di�culties� Well� take a pen and a sheet of paper andwrite down the system of di�erential equations you want to study� It may look like thefollowing one�

x ! x � �x� � y� �R���"y y ! y � �x� � y� �R�� � "x z ! ��z

Variables x� y� z are state variables for the system since there are di�erential equationsfor 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 theversion of the software� Most likely it equals to � in this case ����th element of thearray is reserved for system ��

You can access the elements of the array Y using their numbers� We apologize forthat �and many more �� inconvenience�

Now you are to construct the array of parameters� You may do it by many di�erentways� Here is an example�

Table of Parametersparameter no� � � � � � � �� �� �� � � � �� � � �

parameter x y z R " � �

We added one output variable � !px� � y� to the parameter table�

Write down the parameter table� It is necessary when you�ll work with Krit package�

��

Page 14: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

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� valuesof 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 ! � � � � N

� number of formula to be used in calculation of the derivative of the n�th statevariable� n ! � � � � N

The most exciting feature of Krit is that you de�ne a system of di�erential equationswhen 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 toprogram 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 youcan see an example � a FORTRAN� subroutine calculating formulas for our exampleproblem�

SUBROUTINE FUNC �IN�OUT�Y�TIME�

REAL Y���

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��� THEN

C formula no�� is required

OUT�Y�����Y������Y�����Y��������Y�����Y��

ELSE IF �IN�EQ�� THEN

C formula no� is required

OUT�Y����Y������Y�����Y��������Y�����Y���

ELSE IF �IN�EQ��� THEN

C formula no�� is required

OUT��Y����Y���

ELSE

Page 15: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED �

C returns zero� if formula number is incorrect

OUT���

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 calculateit simultaneously with some formula since there are no guarantees that this formula willbe active� Of course we can evaluate � at every call to the FUNC subroutine� but it istoo expensive�

To solve the problem� the intrinsic Krit routine evaluating right hand sides of thesystem of equations initially calls FUNC subroutine with parameter IN!�� This allowsthe user to make preliminary calculations only once� Now we may rewrite our examplesubroutine as follows �

SUBROUTINE FUNC �IN�OUT�Y�TIME�

REAL Y���

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��� THEN

C preliminary calculations

C parameter Y��� is used as temporary variable

Y����Y������Y����

Y����SQRT�Y����

Y����Y����Y������

ELSE IF �IN�EQ��� THEN

C formula no�� is required

OUT�Y����Y����Y�����Y��

ELSE IF �IN�EQ�� THEN

C formula no� is required

OUT�Y���Y����Y�����Y���

Page 16: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

ELSE IF �IN�EQ��� THEN

C formula no�� is required

OUT��Y����Y���

ELSE

C returns zero� if formula number is incorrect

OUT���

END IF

RETURN

END

Below you can see one more example of programming FUNC subroutine where allformulas are evaluated during preliminary calculations�

SUBROUTINE FUNC �IN�OUT�Y�TIME�

REAL Y����F���

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��� THEN

C preliminary calculations

C parameter Y��� is used as temporary variable

Y����Y������Y����

Y����SQRT�Y����

Y����Y����Y������

C all formulas are calculated here

F��� �Y����Y����Y�����Y��

F�� �Y���Y����Y�����Y���

F��� ��Y����Y���

ELSE IF �IN�GT���AND�IN�LE��� THEN

C formula IN is required

OUT�F�IN�

ELSE

C returns zero� if formula number is incorrect

Page 17: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

OUT���

END IF

RETURN

END

Making an executable �le

Suppose that �le containing FUNC subroutine �and other routines called by FUNC� ifnecessary� is ready� Let the name of the �le be test�for � extension �for is obligatoryfor PC version of Krit package �� If Krit package has been correctly installed� executea command on the DOS prompt�

prep test

File test�for will be compiled and the object module will be linked with Krit packagelibrary� If everything goes well� you will �nd �le test�exe in your current directory� Thisis an executable �le we will work with�

��� 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�

testWhen you run the �le under version ���� it asks no questions �there are all the

necessary default settings�� If new status�keeping �le is created� then the correspondingmessage 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 toinclude the following statement into your AUTOEXEC�BAT �le�

SET KRITTMP�E��

where E� is a RAM disk driveThe 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 thatdiffers from the default one�i�e� �EXE�name�without�ext��LST�

Page 18: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED �

G��grf�filename� � allows you to use the �graphical information� �lewith 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� theprocedure �filename� will be executed�

�filename� � allows you to to run the package in batch mode� theprocedure �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 ��VK�PRO on current drive �

P��directory� � allows you to use the directory for users�s procedureswith the name� that di�ers from the default one � currentdirectory name �

U��directory� � allows you to use the directory for Krit utilities withthe name� that di�ers from the default one � �VK�BAT oncurrent drive �

Z�d � d is a drive letter� This drive will be used to storesome temporary �les� Use it if the environment variablesKRITTMP or TMP are not set properly�

I � allows you to get the information message about freememory in default data segment�

The program starts with the following actions�

� the STARTUP�COM procedure from �VK�BAT directory is executed �if it exists��The procedure must �nish its activities with END command� The installation pro�gram creates �default� STARTUP�COM procedure which writes the informationabout every started Krit EXE��le into system journal �le SYSTEM�LOG inthe �VK�BAT 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 packagebegins the execution of that procedure in batch mode� Otherwise the interactivesession is activated�

But now you dont�t need to think about all that� Run the test program by enteringonly the name of the program�

test

Page 19: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

After that you�ll get Krit welcome message and receive Krit prompt � a percentsign� Percent sign prompt means that program expects a command� If sometimes somedata 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 �

��� Basic Krit data arrays� Data input and output�

Krit package employs a number of prede�ned data arrays� The user can read and writedata 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

YMINYMIN �i� is the lower limit for the i�th element of the table ofparameters Y �i�

YMAXYMAX �i� is the upper limit for the i�th element of the tableof parameters Y �i�

DY

DY �i� is a maximum allowed increment for the i�th element ofthe table of parametersY �i� per one step of iterative algorithms�It is recommended that

DY �i� � YMAX �i��YMIN �i�

���

Other data arrays are located in the temporary RAM memory� The most importantis 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� Statevector contains values of state variables� and its size equals the order of the system ofequations� Usage of these vectors will be discussed later� The list of most frequentlyused state vectors and some auxiliary arrays associated with them is given below�

Name Contents

Xstate vector used for the search of stationary solutions of thesystem of equations

DXDX �i� is a maximum allowed increment for the i�th element ofthe state vector X �i� per one step of iterative search for thesolution of the system of equations�

�to be continued�

Page 20: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED �

� continued �

Name Contents

Fafter commands RTN RTNP RTNSP etc� contains righthand sides of the corresponding system of equations

XPstate vector used for the search of periodic solutions of the sys�tem of equations

DXPDXP �i� is a maximum allowed increment for the i�th elementof the state vector XP �i� per one step of iterative search for theperiodic solution of the system of equations�

XBstate vector containing coordinates of a point belonging to secanthyperplane �in a mapping algorithm��

XB� vector normal to a secant hyperplane �in a mapping algorithm��

XRK state vector used for mathematical simulation

SX�state vector containing coordinates of a point belonging to secanthyperplane �in a mapping algorithm� TRP command��

SANvector normal to a secant hyperplane �in a mapping algorithm�TRP command��

XSvector containing coordinates of a point on a secant hyperplane� SEP command ��

DXSDXS �i� is a maximum allowed increment for the i�th elementof the vector XS per one step of iterative search for the solution� SEP command ��

XSFvector belonging to a secant hyperplane � algorithm for studyingseparating surfaces ��

XANvector normal to the separating surface at the saddle�type point�algorithm for studying separating surfaces��

Lately� there is array XOGR of the dimension ��� N� where N is the order of thesystem of equations� The values XOGR��i� and XOGR��i� are the minimum andmaximum allowed values for the i�th component of state vectors correspondingly�

��� Output of data from Krit data arrays

Data from arrays can be viewed using the L command�

�i�� �� i�� �� i�� L �name�

Page 21: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

wherename � name of the arrayi� � number of the �rst array element to be viewed�

default i� ! �i� � number of the last array element to be viewed�

if i� is set� default is i� ! i��if i� isn�t set� default is i� ! nsys� where nsys � dimension of studiedsystem

i� � element number increment� default i� ! ��

There is a special command LI� which is able to display values of parameters �fromY array� in random order�

i� �� i� � � � ik� LI

where i� �� i� � � � ik� � numbers of elements to be displayed�

��� 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�

i� �� i�� �� i�� � r� �� r�� S �name�

wherename � name of the data arrayi� � number of the �rst element to be �lledi� � number of the last of the input elements of array�

default is i� ! i�i� � element number increment� default i� ! �r� � input value�

�for XOGR two�dimensional array a pair of values �r�� r�� is needed�

� Command U allows to entry di�erent values into subsequent elements of dataarray�

i� �� i�� �� i�� � r� �� � � � rk� U �name�

wherename � name of the data arrayi� � number of the �rst element to be �lledi� � number of the last of the input elements of array�

default is i� ! i�i� � element number increment� default i� ! �r� � � � rk � list of values�

�for XOGR array pairs of values �rk� � rk�� are needed as input�

Page 22: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

� Command I allows to entry di�erent values into random elements of the data array�

i�� r� �� i�� r�� �� � � � ik� rk� I �name�

wherename � name of the data arrayik� rk � number and value of input element�

�for XOGR array pairs of values �rk� � rk�� are needed as input�

Command I can also be entered without parameters�

I �name�

In this case the user must enter pairs �ik� rk� interactively� on the �#� prompt� Eachpair is to be entered on separate input line� Empty or blank input line terminatesthe dialog�

�� Keeping and restoring of arrays

As stated above� YMIN�YMAX�DY arrays are stored in the status�keeping �le� so itis not necessary to worry about them�

The parameter array and state vectors can be saved and restored using commandsV and R� correspondingly�

�n� V �name� � save the data array�n� R �name� � restore the data array

wherename � the name of data arrayn � variant number of array� in the range�

for parameter array Y � � n � ����for state�vector arrays �X�XP etc�� � � n � ��

ATTENTION� In case n is set� the commands nV�name�� and nV�name��� wherename� and name� are state vector names� write into the same memory location� In casen 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 �lledautomatically during task de�nition �with command JOB � using data from YMINand YMAX arrays�

�� Moving state vectors

Data from one state vector can be copied into another one using the following command�

B �nameto�F �namefrom�

Page 23: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

wherenameto � name of destination arraynamefrom � name of source array

��� Calculation of right hand sides� System de�ni�

tion�

This section is devoted to some very important aspects of Krit layout� You are tounderstand �

� 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 theproblem 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 ourexample problem�

Number ofequation orstate variable

Number of aparameter to becorrespondingstate variable

Number of formula �preprogrammed inFUNC subroutine� to be used for calcula�tion of the derivative of the correspondingstate variable

� � �� � �� � �

We can report this table to Krit package using JOB command� JOB commandalso executes the following�

if n�th parameter corresponds to the k�th component of the state vector� and if mk�thformula 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 ��� k�� and value of YMAX �n� iswritten into XOGR ��� k��

So� as a result of the execution of the JOB command all the information necessaryfor the evaluation of the right hand sides of the system of equations is supplied to thepackage� Arrays X DX DXP and XOGR are �lled using data from arrays YYMIN YMAX DY�

Page 24: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

Only now Krit is able to compute right�hand sides of the system of equations� Onevery call to subroutine calculating right�hand sides package does the following�

�� value of the k�th component of the currently used state vector is written into Y �n��k ! � � � � N � where N is the order of studied system$

�� user�s subroutine FUNC is called with parameter IN!�� At that time all thepreliminary calculations may be performed$

�� The derivative for the k�th component of the state vector is computed� callingFUNC subroutine with IN!mk� for k ! � � � � N $

� the value of Y �n� is written into k�th component of the currently used state vector�for k ! � � � � 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 ! � � � � N � where N is the orderof the system� then the following simpli�ed form of the JOB command may be used tode�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 isterminated when empty or blank line is encountered� �Common� data line comprisesthree integer numbers separated with commas�

# k� n�m

wherek � number of the element of the state vector for which

relationships are de�ned�n � number of the corresponding parameter�m �! �� � 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��

Page 25: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED �

to calculate a derivative and if you don�t preprogrammed the formula in the FUNCsubroutine� then you may get it using the special form of the data card in the JOBcommand�

# k� n� ��� j� i �� l ������

wherek � number of the element of the state vector for which

relationships are de�ned�n � number of the corresponding parameter��� � indicates that special routine will be used to

calculate the derivative�i � if i ! � then �� will be used instead of coe�cient Y �i�j � if j ! � then �� will be used instead of coe�cient Y �j�l � if l is not set� then l ! n by default�� � a cleaning �ag�

Use it when and only when you enter the rst of thespecial 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 forlater usage� There are two ways to do so�

�� Best way is to create Krit batch procedure and place into it all the commandsnecessary to de�ne a job� Procedure is a text �le� and any text editor may beused� The name of the �le �i�e� the name of the procedure� may not coincide withthe names of Krit built�in commands� File name must have no extension� At runtime this �le must be in the current directory on the current drive�

Consider as an example the de�nition of the system of the ��rd order mentionedabove� Let�s prepare �le�procedure with name JOB�� You can see commandsentered during 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 JOB�

JOB���������� blank line �

�PROC JOB��JOB��������������PEND

Page 26: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

Procedures are called in the same way as built�in commands are called � by theirnames� To activate JOB� procedure� enter it�s name on Krit prompt�

�� Note� Not applicable to descriptions made by JOB command with special data

cards�

Up to �� job de�nitions can be stored in status�keeping �le at the special memoryarea� This area is to be initialized once before entering job de�nitions using acommand�

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�

�i�� r�� �� � � � ik� rk� MNEMO ! name �tcomment�

where�ij� rj j ! � � � � k � when job is restored� the value of Y �ij�

will be set equal to rjname � name to be assigned to stored job de�ni�

tioncomment � when job is restored� this text will be dis�

played� Comment is separated from therest 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 JOB command� A number of job descriptionscan be concatenated� It can be done this way�

JOB ��n�� ! name� �� name� �� � � � namek��

where

Page 27: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

namei i ! � � � � 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 inthe place of name� if used�

� � requires input of data cardsn � see description of the JOB�n� command given above

Examples�

a� JOB ! JOB � Job remains the same� Used for the sakeof side e�ects � data arrays are re��lled ��

b� JOB ! � � Equivalent of JOB without parametersc� JOB ! JOB � � � Current job will be appended with addi�

tional equations entered from data cards�

�� First Krit session with new task

Let�s return to our sample program� Remember� we�ve got executable �le test�exe andstatus�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 messageswill be written to the Listing le� Lateryou may print this �le�

�now initialization commands are executed�

%MNEMO�KILL%EX�KILL%EDPL�KILL

Page 28: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED �

�now DYYMINYMAX arrays are �lled � example� �

%������S DY %�����S YMIN %����S YMAX %�����������U YMIN %�����������U YMAX %������I DY %�������I YMIN %������U YMAX

�check the data�

%���L YMIN %���L YMAX %���L DY

��ll Y array�

%�����S Y %��������U Y %������������U Y

�check it�

%���L Y

�keep array of parameters�

%V Y

�de�ne a job�

%JOB � %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 valuesyou 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 vectorthen it contains ���� ��� ���� It is a good idea to check if right hand sides are calculatedcorrectly�so�

%RTN

Nice if you�ve got ���� ��������� as a result� You can make a more deep test byevaluating 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�

%STRF��JACOBY

Results matched� didn�t they# OK� Finish the session�

Page 29: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

%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�

%JOB�

�something useful is done� then session is �nished�

� � �%END

NOW ALL KRIT WAYS ARE OPEN FOR YOU �

���� When you are in trouble���

When one works with the package� he gets a number of error messages� Some of themare due to the evident errors �especially syntax errors�� In this section we discuss themost common error messages which will be received regularly�

Page 30: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED �

errormessage

explanation� possible reasons for themessage �in the order of decreasingprobability�

useractions

END OFREGIONnn� jnnj �order of thesystem

The jnnj�th component of the state vectoris outside allowed limits� If nn � � thenthe upper limit was exceeded� otherwisethe lower limit was violated�

�� The limits were not de�ned properlyfor the parameter that corresponds to thisstate variable�

Set correspondingelements of YMINand YMAX dataarrays� then re�setthe job �forexample� usingJOB�JOBcommand��

�� The limits were set correctly� but forthe current command it is desirable to�expand� them�

SetXOGR ��� jnnj�andXOGR ��� jnnj� tothe desired values�

Page 31: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

errormessage

explanation� possible reasons for themessage �in the order of decreasingprobability�

useractions

END OFREGIONnn� � jnnj �order of thesystem

Occurs during continuation or duringsearch for bifurcation or branching points�For jnnj ! order of system � i� meansthat i�th of the parameters used in thecommand exceeds the correspondinglimits� If nn � � then the upper limit wasexceeded� otherwise the lower limit wasviolated�

Set YMIN andYMAX toappropriate values�

END OFREGION

Occur when some mapping is used� Themessage indicates that the correspondingalgorithm was not able to calculate themapping during allowed integration time�set by TE or similar commands���� Insu�cient integration time Set proper

integration timeusing TEcommand

�� �Often � for mapping on controlsurface and for SEP command� Badcontrol surface or �if a continuation wasused� too big increment of the parameter�

Reset the controlsurface and�ordiminish theincrement of theparameter�s��

SINGULA�RITY

Severe error� The algorithm is unable tolook for solution because correspondingjacobian matrix is singular��� Very often the singularity really takesplace� It may be due to programmingerrors or erroneous JOB command�Sometimes it may re�ect the peculiaritiesof the problem in question�

To identify the rootof the trouble� runthe same commandwith the optionsRF��� JACOBYin order to get thejacobian matrix�Check it� especiallyfor zero rows andcolumns�

�� Too small allowed increments for somecomponents of the state vector�

Try to rise theallowed increments�

Page 32: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� GETTING STARTED ��

errormessage

explanation� possible reasons for themessage �in the order of decreasingprobability�

useractions

Fail inconvergenceafter nniterations

nn iterations was not enough to reach thesolution� In most cases it means not anerror� but a need to tune the algorithm�

�� Too small number of iterations� Set the appropriatenumber ofiterations usingITR ! mcommand�

�� The allowed increments for thecomponents of the state vector are toosmall�

Rise the increments�but don�t forgetabout the accuracyof the solution�

�� Too high accuracy is required� Set properaccuracy using AC�or EP� command�

� There is no solution� or else youmanaged to fall into local minimum���

Change the initialvalue of the statevector� Use someparameter to makeconvergence easier�

�� �Rare� Too high sensibility of theright�hand sides� Or� may be� Rafsoncoe�cient is set to some very small value�

Set proper value ofthe Rafsoncoe�cient usingRF command�

���� 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 pressingControl and C buttons simultaneously� Interrupts either the command or someprocess inside the command �SSNE command is an example�� It is possible tobreak 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�

Page 33: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter �

Quest for equilibrium solutions

��� Basic concepts

A system to be studied is a set of di�erential equations� It depends on state variablesand other parameters� We may write it in the form�

x ! f �x� u� x � RN � u � RM �����

wherex � state vector of the size Nu � vector of other parameters of the size Mf � vector�function of the size N

Equilibrium �or stationary� solution �x�� u�� to the system of di�erential equa�tions ����� is a state vector x� satisfying the equation ����� at given values of parametersu� �

f �x�� u�� ! � �����

Search for and investigation of equilibrium solutions always is a vital part in a researchprogram for a given nonlinear system� We o�er two basic algorithms for searchingequilibrium solutions�

� Newton method� with all parameters �except state variables� �xed�

� Original continuation algorithm� able to calculate the dependence of equilibriumsolution vs certain parameter� This algorithm has a larger region of convergence���

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 andde�ne a job using JOB command�

��

Page 34: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

b� Krit package always searches for a solution by means of iterative algorithms� Usermay tune these algorithms changing the values of some special control parameters�there are a number of Krit commands for that� and changing the values ofelements of some vectors�

� Values of maximum allowed increments per one step of iterative algorithm forthe components of the state vector are to be loaded into DX vector �

� Desired accuracy of the solution may be set� Accuracy is reached if thefollowing inequality is satis�ed �

maxi

����� fidxi �minkjdxkj

����� � � i� k ! � � � � N

where� � required accuracy�fi � absolute error in i�th equation�dxi � value of DX �i��

During initialization Krit sets the default accuracy � ! ������ Sometimesit�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 ���

� It is possible to change the value of so�called Rafson coe�cient k� WhenNewton�like algorithm is used� vector of correction is multiplied by k� Defaultvalue is k ! �� 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 ! � is set on the same command line with ST or COcommands� the corresponding command will not search for a solution� It willonly calculate the jacobian matrix d f

dxand then it will reset Rafson coe�cient

to it�s default value k ! ��

� Load in X state vector some initial approximation to the solution�

� To check that everything is OK� executeRTN command on the Krit promptand revise the values of the right�hand sides f �x� u��

Page 35: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

��� Search for equilibrium solution

After some preliminary actions �see section ���� everything is ready for a work� Now ouraim 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 casethe command looks like this�

npar �� dynpar� ST ��RC� ��RT�

� in this case DY �npar�� YMIN �npar�� YMAX �npar� must be set to somereasonable 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 instabilityof the equilibrium solution to be displayed�

npar � number of the parameter to be varieddynpar � 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 ofDY �npar� is not changed�

��� Continuation of a solution while parameter is

changed

Suppose that initial search for a equilibrium solution was successful� and solution is inthe X vector� We want to investigate the dependence of this solution and it�s stabilityon a parameter Y �npar�� DY �npar�� YMIN �npar�� YMAX �npar� must be set tosome reasonable values� Let�s enter a command�

npar �� nstep� �� nout� �� dynpar� ST ��NEWT� �� options�

where

npar � number of the parameter to be variednstep � signed number of continuation steps� When sign of nstep

changes� the direction of �motion� along a parameter al�so changes� Default is nstep ! �� If nstep ! �� onlyconvergence to a solution is performed�

nout � results will be displayed or plotted on each nout�th con�tinuation step� Default is nout ! ��

Page 36: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

dynpar � value of maximum allowed increment of the parameterY �npar�� Is set� this value is used instead of DY �npar�during execution of the current command� the value ofDY �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 �xedparameter increment on each step� In this case convergence is performed using Newtonmethod �when only state variables are allowed to vary�� This regime is activated bymeans of NEWT option�

��� Calculation of right�hand sides � RTN com�

mand

This section describes full syntax of RTN command� It is of interest for experiencedusers only�

The command may be called �in a cycle� � a number of calls with di�erent X or Ymay be done� Syntax of the command is as follows�

�nstep� �� nout� �� ivar� �� dvar� RTN

where

nstep � number of calls� default is nstep ! �nout � results will be displayed on each nout�th call� Default is

nout ! ��ivar � if ivar �! � is set then after each call eitherX �ivar� when

ivar � � or Y �jivarj� when ivar � � will be incrementedwith dvar� Default is ivar ! � i�e� no incrementing�

dvar � value of increment �see ivar description�� default isdvar ! ��

��� Homotopy method for searching equilibrium

solution

There is nothing mysterious in this method despite its �strange� name� Here we tryto �nd a solution to the system in question beginning from known solution to some�standard� system� Special auxiliary parameter is introduced� Varying this parameterone can smoothly proceed from �standard� to original system�

Suppose that we are looking for a solution to the system of equations�

f �x� ! � x� f � RN �����

Page 37: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

We�ll introduce �standard� system of equations�

g �x� ! � x� f � RN ����

and let x� be a known solution to the system �����Now consider an auxiliary system of equations�

F �x� �� ! � where F �x� �� ! �f �x� � ��� �� � g �x� �����

where � is an auxiliary parameter�It is obvious that F �x�� �� ! �� Applying a continuation algorithm �� to the system

����� with initial conditions x ! x� and � ! � and rising �� one can get a dependence ofthe solution on auxiliary parameter� If we are lucky to continue that solution to the valueof parameter � ! �� and to get x� � F �x�� �� ! �� then x� obviously will be a solutionto the original system ������ Note that if x� is the only solution to the �standard� systemand if jacobian of the original system

J �x�� !dfidxj

is nonsingular at x�� then the spatial curve representing the dependence of the solutionto the auxiliary system on a parameter will not be able to return to parameter value� ! �� 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 x� to thesystem in question is successful� then x� and x� will have the same stability �parity� i�e�either odd or even number of �unstable� eigenvalues� It means that� for example� onecan�t access the so�called saddle�type solution �with one �unstable� eigenvalue� to thesystem in question starting from stable solution to the �standard� system�

The sequence of starting the algorithm is as follows�

�� Do the preliminary actions as stated in ���� i�e� set required accuracy� number ofiterations etc�

�� Load X vector with x�� the corresponding �standard� system will be formed au�tomatically�

�� Activate the algorithm using a command�

�nstep� �� ireg� �� ipri� �� d�� �� �min� �max� ST�HOMO

where

Page 38: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

nstep � estimated number of continuation steps per unit incre�ment of �� Default is nstep ! ���

ireg � allows to choose one of the three possible variants of the�standard� system�

ireg system� g �x� ! f �x�� f �x��� g �x� ! x� x�

� g �x� !

� � �x�i � xi� if i ! ��x�i � xi� if i �! �

ipri � ipri �! � allows interim results �i�e� solutions to the aux�iliary system of equations� to be displayed� These resultsmay 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� ! ��nstep��min� �max � set the minimum and maximum allowed values of the pa�

rameter� �max should be greater than �� Default settingsare� �min ! �d�� �max ! �� � d��

Usually the parameter Y ����� is used as �� User subroutines should not rede�nethis parameter�

The command may be interrupted if necessary� Press Esc button � or the buttonsControl and C simultaneously once or twice�

Remember � This method sometimes works� sometimes doesn�t� Novice user maytry it if everything else fails�

�� 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 needa regular algorithm to do the job� SSNE method is a good choice for you� Very often itis 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 isstudied�

f �x� ! � where f� x � RN �����

and that a solution x� to the system ����� is known� f �x�� ! �� Let�s de�ne an auxiliarysystem of equations of the size N��� depending on a parameter xk�

fi��k �xi��k� xk� ! � ��� �

We�ll also consider the value of fk �xi��k� xk� as a functional�

Page 39: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

It is obvious that components of x� �t the auxiliary system ��� �� Now we�ll applya continuation method �� and calculate the dependence of the solution to ��� � on aparameter xk� So we�ll get a spatial curve� Check if there is a point on that curve wherefunctional fk changes sign or equals to zero� If such a point

�x�i��k

� x�k�

exists� then x�is a solution �and may be a new one�� to the given system ������ It is useful to repeatall that for k ! � � � � N �

The sequence of actions for SSNE algorithm is as follows�

�� Make all preliminary actions as mentioned in ���� Set required accuracy� maximumnumber of iterations� etc� Pay special attention to theXOGR andDX data 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�

�� Load known solution x� into X vector�

�� 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 specialform 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 tokeep solutions immediately after STSSNE 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 formedusing special data cards�

� This method is time consuming� The possibility of in�nite loop also cannot beexcluded� though we�ve put much e�ort to avoid it� User may cancel the commandby pressing Esc button� or Control and C keys simultaneously a number of times�no more than � �N where N is the order of system��

� If either the task is very simple or your computer is very powerful� it is highlyrecommended to restart the algorithm a number of times using every solutionfound as initial point� Doing so you greatly rise the probability to �nd all thesolutions�

Page 40: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

� The experienced user may enjoy full�syntax STSSNE command�

�ix�� �� ix�� �� iout� �� cXOGR� ST�SSNE ��REST� ��NOINIT�

where

ix�� ix� � k index �see algorithm description given above� will getvalues k ! ix� � � � ix�� If ix� is set� then by default ix� !ix�� Otherwise� ix� ! �� ix� ! N by default� N is theorder of given system of equations�

iout � iout �! � allow interim data �i�e� search trajectories� tobe displayed or plotted using Run�time graphics options�

REST � this options prevents �stack� of solutions formed by pre�vious STSSNE command from erasure� New solutionswill be appended�

NOINIT � if this �ag is set� then state vector loaded into X arrayis not checked for being a solution to the system� Theoption may be used in a situation when you haven�t gotany solution� but have found a state vector which satis�esall equations except k�th� Load this vector into X� thenexecute STSSNE command with ix� ! ix� ! k�

cXOGR � if set� extends the region �i�e� modi�es minimum andmaximum allowed values� for the temporary parameterxk cXOGR times� Default is cXOGR ! ��

Try and use SSNE algorithm � and you�ll be rewarded �

�� 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 solutionsmight 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 equilibriumsolutions�

� variant �� determinant of the jacobian matrix dfidxj

reaches zero�

� variant �� real eigenvalue of the jacobian matrix crosses imaginary axis�

� variant �� complex pair of eigenvalues crosses imaginary axis�

� variant �� any eigenvalue of the jacobian crosses imaginary axis�

The sequence of preliminary actions before searching bifurcations is the following�

Page 41: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

�� Actions mentioned in ��� are performed�

�� Load some equilibrium solution or approximation to it into X vector� Note� thatconvergence to bifurcation solution may be poor if initial solution �i�e� state vectorX and corresponding value�s� of varying parameter�s�� is too far away� A lot of timewill 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 STcommand�

�� Do not forget to set appropriate values for the parameters to be varied intoDYYMINYMAX arrays�

� It is possible to set accuracy to be reached for bifurcation criterion �see variants�&��� Default value is ������ One can set the desired accuracy using command�

EP ! value

The value will be kept until changed by another EP command�

�� You may choose the variant of bifurcation criterion� Default is variant �� Use thecommand�

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 toexecute the following command�

npar �� dy� ST�BIF �! nvar� �� options�

wherenpar � 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 ofDY �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� ACITRRCRT for example�

If bifurcational solution is searched using two varying parameters� then the commandwill look like that�

npar�� npar� �� dy�� �� dy�� ST�BIF �! nvar� �� options�

where

Page 42: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

npar� � number of �rst varying parameter�npar� � number of second varying parameter�dy� � value of maximum allowed increment of the parame�

ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �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� ACITRRCRT for example�

If you need to get a bifurcational curve �i�e� to continue bifurcational solution varyingtwo parameters�� you are to use full�scale syntax of STBIF command�

npar�� npar�� nstep �� nout� �� dy�� �� dy�� ST�BIF �! nvar� ��NEWT� �� options�

wherenpar� � number of �rst varying parameter�npar� � 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 ! �� If nstep ! �� onlyconvergence to a solution is performed�

nout � results will be displayed or plotted on each nout�th con�tinuation step� Default is nout ! ��

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �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�NEWT �

this option sets Newton method instead of default one�default is continuation algorithm��

options � some other options� ACITRRCRT 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

Page 43: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

values� etc� You need a good initial state vector too� The most common error is toolarge dy values�

Try it use it enjoy it �

��� Bifurcations of codimension �

There is an experimental algorithm that allows the user to �nd the bifurcation of codi�mension � when either two real eigenvalues are located on the imaginary axis or a complexpair reaches zero�

The package allows to trace the following bifurcational situations for equilibriumsolutions�

� variant �� two real eigenvalue of the jacobian matrix are located on the imaginaryaxis�

� variant �� complex pair of eigenvalues reaches the point ������

The sequence of preliminary actions before searching bifurcations is the following�

�� Actions mentioned in ��� are performed�

�� Load some equilibrium solution or approximation to it into X vector�

�� Do not forget to set appropriate values for the parameters to be varied intoDYYMINYMAX arrays�

� It is possible to set accuracy to be reached for bifurcation criterion �see variants �and ��� Default value is ������ One can set the desired accuracy using command�

EP ! value

The value will be kept until changed by another EP command�

�� You may choose the variant of bifurcation criterion� Default is not set� Use thecommand�

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 sameinternal variable to keep the number of criterion� thus undesirable interferencemight take place�

Now� if you wish to �nd bifurcational point using only two parameters� you are toexecute the following command�

npar�� npar� �� dy�� �� dy�� ST�CUSP �! nvar� �� options�

Page 44: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

If bifurcational solution is searched using three varying parameters� then the com�mand will look like that�

npar�� npar� npar�� �� dy�� �� dy�� �� dy�� ST�CUSP �! nvar� �� options�

If you need to get a bifurcational curve �i�e� to continue bifurcational solution varyingthree parameters�� you are to use full�scale syntax of STCUSP command�

npar�� npar�� npar�� nstep �� nout� �� dy�� �� dy�� �� dy�� ST�CUSP �! nvar� ��NEWT�

wherenpar� � number of �rst varying parameter�npar� � number of second varying parameter�npar� � 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 ! �� If nstep ! �� onlyconvergence to a solution is performed�

nout � results will be displayed or plotted on each nout�th con�tinuation step� Default is nout ! ��

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

CUSP � this obligatory option indicates that search for bifurca�tional �codimension �� solution is required�

nvar � the variant number of bifurcation criterion�NEWT �

this option sets Newton method instead of default one�default is continuation algorithm��

�� 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 acorrespondent parameter�� The point is called the branching point�

Krit package is able to �nd branching point and to calculate the dependence of iton the second parameter�

Page 45: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS

The point is assumed to be branching when the extended jacobian matrix used tocalculate the continuation step �see ��� becomes singular�

Krit package allows to trace the following critical situations for extended jacobianmatrix�

� variant �� determinant of the matrix reaches zero�

� variant �� real eigenvalue of the matrix crosses imaginary axis�

The sequence of preliminary actions before searching branching points is the follow�ing�

�� Actions mentioned in ��� are performed�

�� Load some equilibrium solution or approximation to it into X vector� Note� thatconvergence to the branching point may be poor if initial solution �i�e� state vectorX and corresponding value�s� of varying parameter�s�� is too far away� A lot oftime 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 STcommand�

�� Do not forget to set appropriate values for the parameters to be varied intoDYYMINYMAX arrays�

� It is possible to set accuracy to be reached for branching criterion �see variants �and ��� Default value is ������ One can set the desired accuracy using command�

EP ! value

The value will be kept until changed by another EP command�

�� You may choose the variant of branching criterion� Default is variant �� Use thecommand�

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 tokeep 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 executethe following command�

npar �� dy� ST�BRP �! nvar� �� options�

where

Page 46: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

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 ofDY �npar� is not changed�

BRP � this obligatory option indicates that search for branchingpoint is required�

nvar � the variant number of branching criterion�options � some other options� ACITRRCRT for example�

If branching point is searched using two varying parameters� then the command willlook like that�

npar�� npar� �� dy�� �� dy�� ST�BRP �! nvar� �� options�

wherenpar� � number of �rst varying parameter�npar� � number of second varying parameter�dy� � value of maximum allowed increment of the parame�

ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

BRP � this obligatory option indicates that search for branchingpoint is required�

nvar � the variant number of branching criterion�options � some other options� ACITRRCRT 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 ofSTBRP command�

npar�� npar�� nstep �� nout� �� dy�� �� dy�� ST�BRP �! nvar� ��NEWT� �� options�

where

Page 47: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

npar� � number of �rst varying parameter�npar� � 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 ! �� If nstep ! �� onlyconvergence to a solution is performed�

nout � results will be displayed or plotted on each nout�th con�tinuation step� Default is nout ! ��

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parame�ter Y �npar��� Is set� this value is used instead ofDY �npar�� during execution of the current command�the value of DY �npar�� is not changed�

BRP � this obligatory option indicates that search for branchingpoint 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� ACITRRCRT for example�

The method remains experimental and requires �ne tuning�

���� Solution sensitivity towards parameter varia�

tions

To evaluate the sensitivity of the equilibrium solution and its stability towards parametervariations� 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 ofDY �npar� is not changed�

nvar � the variant number of bifurcation criterion �see the de�scription of STBIF command��

If command terminates normally� then the value of dxdynpar

and d�dynpar

will be dis�

played� where � is the value of bifurcation criterion�

Page 48: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS

���� 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 necessaryto get a solution at some other values of parameters when functional reaches it�s minimum�or maximum�� Krit can do something for you in this situation� Of course� globalextremum is not guaranteed�

The sequence of actions is the following�

�� The calculation of the functional is to be preprogrammed in user�supplied FUNCsubroutine� The value of the functional may be either stored in some parameteror accessible as a formula�

�� Preliminary actions mentioned in BasicSec are to be performed� Required accuracy�number of iterations etc� may be set�

�� Load known solution into X state vector� �Corresponding set of parameters is tobe loaded into Y parameter array�� Execute a command� RTN

� 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�#�����n# �empty data card�

� if the value of functional is stored as Y �i��

#������������i���# �empty data card�

In this case the sign of functional is inverted� and you should maximize thefunctional 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�

�� 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

Page 49: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

�� Now we can start the algorithm�

npar� iy�� � � � � iynpar � nstep �� nout� �� dy� �� � � � dynpar�� MO �� options�

where

npar � how many parameters are varied�iy�� � � � � iynpar � numbers of varying parameters�nstep � signed number of minimization steps� If nstep � � 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 ! ��dy�� � � � � dynpar � values of maximum allowed increments of the parameters

during minimization�options � some other options� ACITRRCRT for example�

���� 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 thegiven system of dynamic equations� Separating surfaces de�ne regions of stability of thestable 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 thendimension of separating surface is N � �� If N � � then it would be di�cult to calculateand visualize the entire surface� Krit o�ers you a tool for calculating two�dimensionalcross sections of separating surface� A set of such sections may provide vital informationabout system�s behaviour�

������ 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 thesystem 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������� It�s rst way�

� be curious and attempt to �nd other possible solutions to the system� stable andsaddle�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 itis a surface of interest� Make a little step from saddle point along unstable eigenvector

Page 50: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS

and simulate the dynamics of the system� Then repeat it with a little step against thateigenvector� If one of the two calculated curves approaches initial stable solution� you�vegot 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 pointsin the vicinity of saddle point and simulate system dynamics in reverse time startingfrom each one of these points� A set of obtained trajectories might give you some ideaof system behaviour� That�s second way�

We do not advice you to use this old method� it doesn�t work well even for loworder systems� Sometimes it may be useful for �nding �rst point belonging to a surfacecross�section�

The third way is described below� in �������

������ 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 momentsimulation is �nished and an error �a measure of miss� is calculated� the saddle pointbeing 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 ���� In brief� it is easy tocalculate a vector normal to separating surface at saddle point� The spatial cylinder withgiven radius is de�ned� the axis of the cylinder passes through saddle point and goesalong with normal vector� Simulation of system�s dynamics is stopped at the momentwhen trajectory passes through the surface of the cylinder from outside� A measure ofmiss is a signed value of projection of vector connecting saddle point and �nal point ofsimulation 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�

�� Perform preliminary actions as stated in BasicSec�

Page 51: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

�� Load an arbitrary point belonging to the secant plane into XSF data array� Theplane passes through XSF and is parallel to two unit vectors of the coordinatesystem� These vectors will be indicated later�

�� Load vector of maximum allowed increments of state variables into DXS dataarray�

� Use the options for settings�

TE ! value � maximum simulation time� If it is reached� error messagewith code and minimum distance from saddle point�in DXS�units� to trajectory will be displayed� Defaultis ���

RAD ! value � cylinder radius in DXS�units� Usually it is in the range� � � � � depending on distance from current point on thesecant plane and saddle point� Default value is ��

ACS ! value � sets the desired accuracy� The algorithm tries to reducethe miss to zero with this accuracy� Default value is �����

�� Load normal vector to separating surface into XAN data array�

�� Load saddle solution into the top of the �stack� of solutions on control i�e� intodata array C �

The simplest way to perform actions �&� is to load saddle solution into X vectorand execute a command�

SINIT

� Report to the Krit package two numbers i� and i�� The secant plane will beparallel to unit vectors along corresponding axes of coordinate system�

�� Load an initial point on secant plane in coordinates �xi��xi�� into XS vector of thesize ��

To execute actions in &� one may use a command calculating the value of missfor initial point�

i�� i�� v�� v�� RTNSEP

where�

i�� i� � de�ne vectors parallel to the secant plane�v�� v�� � initial point on secant plane

Now we are to �nd an initial point suitable for starting iterative algorithm� We needa trajectory starting at the initial point to cross the cylinder �for a miss value can becomputed�� Search for such a point requires some e�ort� and the following extendedform of RTNSEP command may be useful�

i�� i�� v�� v�� nstep� dv�� dv�RTNSEP

Page 52: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

where�i�� i� � de�ne vectors parallel to the secant plane�v�� v�� � initial point on secant planenstep � number of calls to �simple form� RTNSEP command�dv�� dv�� � increments to �v�� v�� 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 thatdistance varying �v�� v��� 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 maintool � SEP command� To �nd initial point with required accuracy� execute a command�

�i�� i�� � v�� v� �� dv�� dv�� SEP� INIT

where�i�� i� � de�ne vectors parallel to the secant plane�v�� v�� � initial point on secant plane�dv�� dv�� � maximum allowed increments to �v�� v��

As usual� square brackets indicate that a term is optional� You must use them onlyif you want to change previous settings�

If everything is OK� keep the point� Now we can proceed with cross section�

i�� i�� nstep �� nout� �� v�� v�� dv�� dv�� SEP

��

�RESTINIT

���� options�

where�i�� i� � de�ne vectors parallel to the secant planenstep � 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 continuationstep� Default is nout ! ��

REST and INIT � SEP command always memorizes starting point and lastsuccessfully calculated cross�section point� keeping themin status�keeping �le� By default� SEP commands triesto continue the calculation of the cross�section beginningfrom last successfully calculated point from previous run�Sometimes it may bring about troubles� Two options areused to modify the performance of the command�

INIT � if the values v�� v� are set� they will be used asinitial point� Otherwise XS vector will be used�Without this option v�� v� are ignored�

REST � calculations will start from the point used asinitial on the previous run of SEP command�

�v�� v�� � initial point on secant plane

Page 53: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

�dv�� dv�� � maximum allowed increments to �v�� v��options � other options �i�e� subcommands� modifying the algo�

rithm�

These are main features of the command� Below some additional information can befound�

Protection against other stable solutions

If there are other stable solutions to the studied system� then there is a possibility ofbeing 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 stableattractors �i�e� limit cycles� tori etc�� into C data array� First place the point intoone of state vectors� and then execute a command�

iB�C�F�id�

where

i � number of this solution in �stack�� Note� that i � � sincesaddle solution is the �rst in �stack��

id � name of state vector

Stable solution must be loaded in �stack� C without gaps� beginning with numberi ! ��

� For every solution in �stack� radius of spatial sphere �in DXS�units� is to beset� If the trajectory enters such a sphere with the center in the correspondingstable solution� the simulation is stopped and error message with code nn�� isdisplayed� nn is the number of the stable solution� Radius of the sphere is set bythe 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��dimensional XS vector using full�size state vector and two numbers of components�The syntax of the command is as follows�

i�� i�XSORG �id�

Page 54: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

wherei�� i� � de�ne vectors parallel to the secant planeid � name of the full�size state vector� default name is X�

For example� if we use a command ��XSORG X � we�ll get a vectorXS ! �x�� x���

Sections in the parameter plane� Mixed sections�

If you are interested in stability towards parameters� variations� then this algorithm canalso be e�ectively used� All that is very simple� The only thing you are to change in theabove mentioned commands is that you are to mention with minus sign the number�s�of parameter�s� instead of i� �or i� and i���

Some advices�

� Increments for cross�section plane coordinates xsi� and xsi� should be � � � � �� timesless 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 ����� The step can be changed by DT command�

DT ! step

It is also possible to use Adams integration method of the order n � n � � insteadof default Runge�Kutta �th order method� Use the command�

ADMS ! n

� It is extremely important to set proper radius of the cylinder� Too small radiuswill bring in convergence problems and slow data output� Too large radius leadsto the loss of accuracy�

������ Scanning method for calculating cross�section

This is strict� reliable but in many cases time�consuming method� First� a ��dimensionalsecant plane in the state space is de�ned� Then one gets a �large� number of controlpoints on that plane� Each point is marked depending on stable solution in the vicinity ofwhich simulation was stopped� The regions of stability�s boundaries �i�e� cross�sectionsof 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�

Page 55: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

The sequence for this algorithm is the following�

�� Perform preliminary actions as stated in BasicSec�

�� Load an arbitrary point belonging to the secant plane into XSF data array� Theplane passes through XSF and is parallel to two unit vectors of the coordinatesystem� These vectors will be indicated later�

�� Load vector of maximum allowed increments of state variables into DXS dataarray�

� Use the command�

TE ! value � maximum simulation time� If it is reached� error messagewith code will be displayed� Default is ���

�� Report to the Krit package two numbers i� and i�� The secant plane will beparallel to unit vectors along corresponding axes of coordinate system� It may bedone by means of XSORG command�

i�� i�XSORG

�in this case XS vector is lost��

Also� this may be done using a command�

�� ��� �� i�� i�U�LY�

�� Load stable equilibrium points or arbitrary points belonging to more complexstable attractors �i�e� limit cycles� tori etc�� into C data array� First place thepoint 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 numberi ! ��

� 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 stablesolution� the simulation is stopped and a control point is marked� Radius of thesphere is set by the command�

n� radSETRAD

where

n � number of solution in �stack�rad � radius of the spatial sphere

n ! � corresponds to the �rst stable solution�

Page 56: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

�� 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�

� Run the plotting command�

nx� �� ny� �� 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 �! �� the plot will be displayedon the screen� If iout �! � the plot will be written intographics information le�

xmin� xmax � de�ne upper and lower limits of the �rst coordinate onthe secant plane for scanned region�

ymin� ymax � de�ne upper and lower limits of the second coordinate onthe secant plane for scanned region�

Plot is generated in alphanumerical mode� Every point on the plot is �lled with asymbol� Symbols from ��� to �� indicate that simulation was stopped in the vicinityof the stable solution with corresponding number� Symbol ��� means that simulationwas 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 XOGRarray��

Scanning may be performed varying not only components of the state vector� butalso using parameters� Set with minus sign the number�s� of parameter�s� instead of i��or i� and i�� in the step � of the sequence�

���� Assessment of stability region using Lyapunov

method

It is impossible� we believe� to �nd a researcher specializing in stability and controlproblems who never tried to investigate stability of solution using appropriate Lyapunovfunction� 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 systemof equations� and check the value of derivative of that function in automatically selectedcheckpoints� They are seeking for a point where the derivative changes its sign� If sucha point is found� the critical value of Lyapunov function will be computed� Knowingthat 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 possibilitythat a �net� of control points is not good enough��� But why not to try#

Page 57: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

Let�s look at the formulas� We are studying the system of the form�

x ! f �x� �����

Let x� be a stable solution to the system ������ Linearizing equations ����� in the vicinityof x� we�ll get�

x ! J � xwhere 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 � � x� we�ll get the linearized equations in the form

! ' � Now let�s de�ne Lyapunov function using quadratic form with N matrix�

v ! TN

Derivative of this Lyapunov function is computed using formula�

v ! �TN'

There are �ve variants of the diagonal matrix N�

basic variant�

Nii ! � �

�Re�i

variant ��Nii ! �

variant ��

Nii !�

�Re�i��

Variants � � � � � di�er from those mentioned above with auxiliary dx��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 ofequations ����� in the vicinity of stable solution x�� If we return to original variableswe�ll get Lyapunov function in the form�

v ! �x� x��T P �x� x��

Page 58: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS �

where P is symmetrical positively�de�ned matrix� Derivative of this Lyapunov functionequals to �precisely��

v ! �x� x��T P � f �x�

What will Krit package do# Some level v� of Lyapunov function is taken� A setof control points is de�ned� all these points belong to the surface de�ned by equationv �x� ! v�� The values of the derivative v is checked in these points� If everything is allright� then value v� is incremented� Otherwise the critical value of Lyapunov functioncan be determined�

Sequence of actions is as follows�

�� Prepare a job as for studying equilibrium solutions�

�� Load stable solution into X vector�

�� Load maximum allowed increments into DX data array�

� Execute a command��dv� �� v�� �� ipri� LJ �! nvar�

where

dv � increment of the level of Lyapunov function after each step� De�fault value is dv ! �����

v� � initial level of the Lyapunov function� Default value is v� ! dv�ipri � if ipri �! � intermediate results will be displayed� By default

ipri ! ��nvar � number of variant of the Lyapunov function� Initial default value

is nvar ! � �i�e� basic variant�� Is set� the new value becomesnew default value�

It is possible �and highly desirable�� to re�ne �i�e� minimize� the value of criticallevel of the Lyapunov function� Usually it becomes an order of magnitude lessafter minimization� The command for minimization is

nstep �� ipri� LJM

where

nstep � number of minimization stepsipri � results will be displayed once for each ipri steps� By default

ipri ! nstep�

Minimization should be continued as long as critical level decreases�

Before running LJM command it is possible to set the level for derivative of theLyapunov function� If the derivative is below this level� the point is considered tobe local extremum� Use for this a command

ACM ! value

Page 59: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� QUEST FOR EQUILIBRIUM SOLUTIONS ��

�� Now the sweetest part of the method� If a critical value of Lyapunov function isde�ned then a spatial ellipsoid belonging to the region of stability is determined��We want to believe it�� Now we may get a cross�section of the ellipsoid by a planegoing through stable solution and parallel to two axes of the coordinate system�Of course� it�ll be an ellipse� This is the command�

i�� i� �� npt� LJE

where

i�� i� � numbers of coordinate axesnpt � if set� npt points on ellipse will be displayed� Otherwise only

information about ellipse half�axes will appear�

Are you satis�ed# We are happy if yes� Good luck for you�

Page 60: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter �

Mathematical simulation

Simulation is a simple operation� But a number of auxiliary actions are to be done�

�� Prepare a job �rst� Load the desired values of parameters into Y array and de�nesystem of equations using JOB command�

�� There are some settings a�ecting simulation� You may change them if necessary�

� Default simulation starting time t�� Initially Krit sets the default startingtime t� ! �� User can change it using T� command�

T� ! value

where value is a signed value of starting time�

Default value of starting time is used if starting time is not set explicitly inTR command�

� Default simulation ending time tend� It is used if the corresponding value isnot set explicitly in TR command� Initially Krit sets tend ! ��� This settingmay be changed by TE command�

TE ! value

where value is a signed value of ending time�

Krit allows tend � t� so reverse time simulation is possible�

� Default simulation step dt� For �xed�step simulation methods used by defaultin Krit routines dt is a simulation step unless set explicitly in TR command�Gir variable�step method uses dt as starting simulation step� Initially dt !����� This value may be changed using DT command�

DT ! value

where value � ��

Page 61: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� MATHEMATICAL SIMULATION ��

� Default simulation method� Initially Runge�Kutta �th order method is set�Method may be set using following commands�

ADMS ! n � sets Adams method of the order n� n ! � � � � RK� � sets Runge�Kutta �th order methodGIR � sets Gir variable�step method for �rigid� systems

Note � Gir method is currently under testing� It may be used only in TRsimulation command� but not in the commands like TRP CO etc� Whenusing Gir method� it is necessary that tend � t��

� Load initial point for simulation into XRK state vector�

� There are some settings speci�c to Gir method�

HMI ! value �sets minimum allowed simulation step� De�fault value is ������

HMA ! value �sets maximum allowed simulation step�Default value is ��

GEPS ! value �Sets accuracy of simulation to be achieved�Default value is ����� �

Now a simulation command TR may be executed�

�nout� � �ipri� � �tend� � �t�� � �dt� TR �� options�

wherenout � Number of checkpoints during simulation in which data

are displayed or plotted� Final point of simulation is notincluded since data are always put out at �nal point�Default value is nout ! ��

ipri � If ipri �! � then maximum and minimum values of statevariables during simulation will be displayed after simu�lation is �nished�

tend � Simulation ending time� Does not change the defaultvalue�

t� � Simulation starting time� Does not change the defaultvalue�

dt � Simulation step� Does not change the default value�options � options �i�e� subcommands� modifying the algorithm or

data output mode� Options are executed before startingsimulation�

Final point of the simulation can be found in XRK vector� If tend � t� then therewill be simulation in reversed time�

Page 62: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter �

Hunting for loops

��� How to �nd and study periodic solutions

Nowadays periodic solutions �or loops or else cycles� to systems are very importantpersons in many areas of science� Thousands of researchers study them using computers�but there is a shortage of good software� That�s why usually only the simplest systemsare studied�

Krit is a rare exception� The package has a number of powerful algorithms able tostudy loops as well as one can investigate equilibrium solutions�

Loops are much more complex objects in comparison with equilibrium solutions�and their behaviour sometimes is rather strange� �Really� they are close relatives tosuch �persons� in nonlinear world as tori or strange attractors�� No wonder that user�spreliminary sequence is more complicated�

�� Prepare a job �rst� Load the desired values of parameters into Y array and de�nesystem of equations using JOB command�

�� To study loops means to simulate the dynamics of the system of equations� Sosettings a�ecting simulation must be performed in the same way as in �but Girmethod is not allowed��

�� If iterative algorithms should be used for searching loops �i�e� CO command� thensome settings controlling iterative algorithms can be modi�ed�

� Values of maximum allowed increments per one step of iterative algorithm forthe components of the state vector are to be loaded into DXP vector � Inmost cases they are less than corresponding values in DX array�

� Desired accuracy of the solution may be set� Accuracy is reached if thefollowing inequality is satis�ed �

maxi

����� fidxi �minkjdxkj

����� � � i� k ! � � � � N

where

��

Page 63: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� HUNTING FOR LOOPS ��

� � required accuracy�fi � absolute mapping error for i�th component

of state vector�dxi � value of DXP �i��

During initialization Krit sets the default accuracy � ! ������ Sometimesit�s good enough� sometimes not� User may reset accuracy using a command�

AC ! value

Note � Of course� it�s not good that the same accuracy is used simultaneouslyfor equilibrium solutions and loops� This shortcoming will be eliminated inlater versions of the package� as well as similar ones with ITR command etc�We beg your pardon for all that�

� Maximum allowed number of iterations can be set by ITR command �

ITR !number

Default number of iterations is ��� usually it is too many�

� It is possible to change the value of so�called Rafson coe�cient k� WhenNewton�like algorithm is used� vector of correction is multiplied by k� Defaultvalue is k ! �� 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 ! � is set on the same command line with CO or STcommands� the corresponding command will not search for a solution� It willonly calculate the jacobian matrix d f

dxand then it will reset Rafson coe�cient

to it�s default value k ! ��

� De�ne a method for searching loops� All the methods are based on Poincar(emapping technique ���� Theory of these methods can be found in ��� ��� In everymethod the goal is to �nd �xed point of the mapping� The goal is achieved bysolving a system of equations�

x� T �x� ! � �����

where

x � initial point of mapping�T �x� � a result of mapping�

Krit package provides three methods�

� Mapping on hyperplane of codimension � is used ���� That is a default method�Explicitly it may be set using a command�

CSF

Page 64: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� HUNTING FOR LOOPS ��

� T�advance mapping �i�e� mapping with a �xed time period�� It can be setusing a command�

TMX �! value�

where value is a simulation ending time� If value is set� then this commandis equivalent to a pair of commands�

TMX�TE ! value

� T�advance mapping with free time period� Di�erence between this methodand one mentioned above is in the possibility to change time period of map�ping during an iterative convergence process to the �xed point� The methodis set by a command�

TFX �! ipar�

where ipar is a number of parameter in Y array used to store time period ofmapping� There is no default value for ipar� so it is obligatory to set it inthe TFX command when this method is used for the �rst time �in the Kritsession��

If this method is selected� it is necessary to load initial time period intoY �ipar� and to place appropriate values into DY �ipar�� YMIN �ipar� andYMAX �ipar��

�� Load in XP state vector some initial approximation to the solution� i�e� the ap�proximation to the �xed point of the selected mapping� In other words� load inXP coordinates of some point belonging to a loop �of course� if you know them��

�� If mapping on hyperplane is chosen� then it is necessary to de�ne hyperplane�Note� that vector XP must belong to that hyperplane� Do the following�

� Load the coordinates of some vector belonging to hyperplane into XB vector�Of course� XP vector may be used� in this case execute a command�

B�XB�F�XP�

� Load vector normal to hyperplane into XB� vector� Then the hyperplanewill contain all the vectors z obeying the condition�

�z �XB�T XB� ! �

Sometimes good normal vector may be generated by the following sequenceof commands�%B X F XB %RTN%B XB� F F

Page 65: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� HUNTING FOR LOOPS �

� The mapping may be K�fold iterated� Initially default is one�fold iteratedmapping �

Number of mapping iterations for this method may be set either in full roundsor in half rounds� A loop crosses hyperplane twice per full round� Initialdefault is one full round ! two half�rounds� This can be changed using KPcommand�

KP ! n

where number of mapping iterations is given by jnj� and the units used arefull rounds if n � � and half rounds if n � ��

� To check that everything is all right� executeRTNP command on the Krit promptand revise the values of the right�hand sides for the system of equations ������ You�llget either error message or information message containing mapping period value�

Now all preparations are over� Search for a periodic solution when only components ofXP vector �and� may be� time period of mapping� are varied is a duty of CO command�

� for mapping on hyperplane and for mapping with �xed time period�

CO ��RC� ��RT�

� for mapping with free time period�

ipar �� dt� CO ��RC� ��RT�

where�RC � this option requires message about stability of the solution to

be displayed�RT � this option requires the calculation of so�called mapping multi�

pliers �analogous to the eigenvalues for equilibrium solutions��The multipliers will be displayed�

ipar � number of a parameter used to keep the value of the time period�dt � maximum allowed increment of the time period during itera�

tions� If this value is not set� then DY �ipar� will be used in�stead� When set� it doesn�t a�ect the value of DY �ipar��

If mapping on hyperplane or mapping with �xed time period is selected� it is possibleto calculate dependence of the solution on a parameter using CO command in the form�

npar �� nstep� �� nout� �� dynpar� CO ��NEWT� �� options�

where�

Page 66: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� HUNTING FOR LOOPS ��

npar � number of the parameter to be variednstep � signed number of continuation steps� When sign of nstep

changes� the direction of �motion� along a parameter alsochanges� Default is nstep ! �� If nstep ! �� only convergenceto a solution is performed�

nout � results will be displayed or plotted on each nout�th continuationstep� Default is nout ! ��

dynpar � value of maximum allowed increment of the parameterY �npar��Is set� this value is used instead of DY �npar� during executionof the current command� the value of DY �npar� is not changed�

NEWT � this option sets Newton method instead of default one �defaultis continuation algorithm�

options � other options �i�e� subcommands� modifying the algorithm�

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 �xedparameter increment on each step� In this case convergence is performed using Newtonmethod �when only state variables are allowed to vary�� This regime is activated bymeans of NEWT option�

For the mapping with free time period the following form of CO command is usedto calculate the dependence of solution on a parameter�

ipar� npar �� nstep� �� nout� �� dt� �� dynpar� CO ��NEWT� �� options�

where�ipar � number of a parameter used to keep the value of the time period�npar � number of the parameter to be variednstep � signed number of continuation steps� When sign of nstep

changes� the direction of �motion� along a parameter alsochanges� Default is nstep ! �� If nstep ! �� only convergenceto a solution is performed�

nout � results will be displayed or plotted on each nout�th continuationstep� Default is nout ! ��

dt � maximum allowed increment of the time period during itera�tions� If this value is not set� then DY �ipar� will be used in�stead� When set� it doesn�t a�ect the value of DY �ipar��

dynpar � value of maximum allowed increment of the parameterY �npar��Is set� this value is used instead of DY �npar� during executionof the current command� the value of DY �npar� is not changed�

NEWT � this option sets Newton method instead of default one �defaultis continuation algorithm�

options � other options �i�e� subcommands� modifying the algorithm�

Note � CO and RTNP commands change XRK vector� After these commands itusually contains the result of the mapping applied to XP vector�

Page 67: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� HUNTING FOR LOOPS ��

���� Full syntax of RTNP command

RTNP command is intended for calculation of mapping error vector�

fmap ! T �x�� x

The command may be called �in a cycle� � a number of calls with di�erent XP orY may be done� The command is useful for �nding suitable initial conditions beforestarting CO command� Note� that cycle of calls continues even if previous call endedwith error message� Syntax of the command is as follows�

�nstep� �� nout� �� ivar� �� dvar� RTNP

where

nstep � number of calls� default is nstep ! �nout � results will be displayed on each nout�th call� Default is nout !

��ivar � if ivar �! � is set then after each call either XP �ivar� when

ivar � � or Y �jivarj� when ivar � � will be incremented withdvar� Default is ivar ! � i�e� no incrementing�

dvar � value of increment �see ivar description�� default is dvar ! ��

��� Bifurcations of loops

Bifurcations of periodic solutions are may be the most exciting phenomena in the countryof nonlinear equations� It is impossible even brie�y mention all possible situations� Youmay �nd a lot of information in ����

Krit can handle the following bifurcational situations for periodic solutions�

� variant �� determinant of the monodromy matrix �analogous to jacobian matrix�dfmapi

dxjreaches zero�

� variant �� real multiplier �i�e� eigenvalue� of the monodromy matrix crosses �unit�circle jzj ! � on complex plane�

� variant �� complex pair of multipliers crosses �unit� circle�

� variant �� any multiplier of the monodromy matrix crosses �unit� circle�

� variant �� real multiplier �i�e� eigenvalue� of the monodromy matrix crosses �unit�circle on complex plane at the point ������ & that is a situation of birth of foldedperiodic solution�

� variant �� real multiplier �i�e� eigenvalue� of the monodromy matrix crosses �unit�circle on complex plane at the point ������

Page 68: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� HUNTING FOR LOOPS �

In the present version of the package search for bifurcational situations is possibleonly if either mapping on hyperplane or mapping with �xed time period method isselected�

Sequence of preliminary actions is as follows�

�� Execute preliminary actions mentioned in ����

�� Load known �xed point of mapping �i�e� known periodic solution� into XP vector�Note� that convergence to bifurcation solution may be poor if initial solution �i�e�state vector XP and corresponding value�s� of varying parameter�s�� is too faraway� A lot of time will be saved if one gives initial solution as close to bifurca�tional one as possible� User can �nd such a solutions using �continuation�along�parameter� form of CO command�

�� Do not forget to set appropriate values for the parameters to be varied intoDYYMINYMAX arrays�

� It is possible to set accuracy to be reached for bifurcation criterion �see variants�&��� Default value is ������ One can set the desired accuracy using command�

EP ! value

The value will be kept until changed by another EP command�

�� You may choose the variant of bifurcation criterion� Default is variant �� Use thecommand�

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 toexecute the following command�

npar �� dy� CO�BIF �! nvar� �� options�

wherenpar � 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 ofthe current command� the value of DY �npar� is not changed�

BIF � this obligatory option indicates that search for bifurcational solu�tion is required�

nvar � the variant number of bifurcation criterion�options � some other options� ACITRRCRT for example�

If bifurcational solution is searched using two varying parameters� then the commandwill look like that�

npar�� npar� �� dy�� �� dy�� CO�BIF �! nvar� �� options�

Page 69: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� HUNTING FOR LOOPS ��

wherenpar� � number of �rst varying parameter�npar� � number of second 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 thecurrent command� the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parameter Y �npar��� Isset� this value is used instead of DY �npar�� during execution of thecurrent command� the value of DY �npar�� is not changed�

BIF � this obligatory option indicates that search for bifurcational solution isrequired�

nvar � the variant number of bifurcation criterion�options � some other options� ACITRRCRT for example�

If you need to get a bifurcational curve �i�e� to continue bifurcational solution varyingtwo parameters�� you are to use full�scale syntax of COBIF command�

npar�� npar�� nstep �� nout� �� dy�� �� dy�� CO�BIF �! nvar� ��NEWT� �� options�

wherenpar� � number of �rst varying parameter�npar� � number of second varying parameter�nstep � signed number of continuation steps� When sign of nstep changes�

the direction of �motion� along a parameter also changes� Default isnstep ! �� If nstep ! �� only convergence to a solution is performed�

nout � results will be displayed or plotted on each nout�th continuation step�Default is nout ! ��

dy� � value of maximum allowed increment of the parameter Y �npar��� Isset� this value is used instead of DY �npar�� during execution of thecurrent command� the value of DY �npar�� is not changed�

dy� � value of maximum allowed increment of the parameter Y �npar��� Isset� this value is used instead of DY �npar�� during execution of thecurrent command� the value of DY �npar�� is not changed�

BIF � this obligatory option indicates that search for bifurcational solutionis 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� ACITRRCRT for example�

Novice user� be careful � Searching for bifurcations is a hard job� the method requires�ne tuning� That�s especially true when you deal with loops� It is necessary to chooseappropriate bifurcation criterion� DXP and DY values� etc� You need a good initialstate vector too� The most common error is too large dy values�

Page 70: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter �

Strange� strange nonlinear world���

�� Mapping as a tool for studying nonlinear sys�

tem

Mapping technique is a very powerful tool for investigating nonlinear systems and nowa�days is practically the only well established mean to �nd out complex phenomena likestable tori etc� ��� ���

Iterative mapping resembles simulation� Each time mapping is applied to a resultof previous mapping� Note� that in Krit package simulation �embedded in mappingprocedure� always start at the same time t��

Below a command for iterative mapping is described� As usual� preliminary actionsare to be performed�

�� First it is necessary to make preliminary actions �� � and from sequence in ����

�� Load initial point into XRK vector�

�� If a method of mapping on a hyperplane is set� then it is necessary to de�ne thathyperplane� XRK vector is not required to belong to hyperplane �compare pt� �in ����� Do the following�

� Load the coordinates of some vector belonging to hyperplane into SX� vector�Of course� XRK vector can be used� in this case execute a command�

B�SX��F�XRK�

� Load vector normal to hyperplane into SAN vector� Then the hyperplanewill contain all the vectors z obeying the condition�

�z � SX��T SAN ! �

It is also possible to set a number of mapping iterations �inside� a �big� mappingiteration done by command in question� Use KP command as described in pt� �in ����

Page 71: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� STRANGE� STRANGE NONLINEAR WORLD��� �

Now the command may be executed�

�nstep� � �ipri� � �iextr� � �tend� � �t�� � �dt� TRP �� options�

wherenstep � number of successive mappings� nstep ! � by default�ipri � if ipri �! � then initial point will also be saved and plotted

if corresponding options request to do so� ipri ! � bydefault�

iextr � if iextr �! � then information about minimum and max�imum values of the state variables during mapping will

not be displayed� iextr ! � by default�tend � Simulation ending time for each mapping step� Does not

change the default value�t� � Simulation starting time for each mapping step� Does

not change the default value�dt � Simulation step� Does not change the default value�options � options �i�e� subcommands� modifying the algorithm or

data output mode� Options are executed before startingTRP command�

�� Mapping as a mean of bifurcational analysis

The point mapping technique may be used for qualitative analysis of the changes in thestate space structure of the dynamical system depending on a parameter� The result isobtained in the form of a picture�

The method is as follows�

�� Initialization�

�� The integration of the system is performed in order to get steady state� the timeof integration is to be large enough�

�� The point mapping is performed starting from the steady�state point got on thestep �� The successive results of the mapping are plotted�

If there are a few isolated points on the plot� then there exits an equilibrium pointor closed orbit or quasi�periodic solution on the torus� Otherwise a chaotic regimemight take place�

� The value of the parameter is incremented� the increment must be small enoughfor the plot to be smooth�

�� Go to ��

The method shows the evolution only of the current attractor� If there are someother attractors� then the algorithm is to be executed using di�erent initial conditions�

The Krit sequence for the algorithm is as follows

Page 72: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� STRANGE� STRANGE NONLINEAR WORLD��� �

�� First it is necessary to make preliminary actions as for TRP mapping command�

�� Now the command may be executed�

ipar� nstep� �nout� � �ipri� � �iextr� � dy� twait �� tend� �� t�� �� dt� TRPP �� options�

where

ipar � number of parameter to be varied�nstep � number of steps of the algorithm i�e� number of di�erent

parameter values�nout � Number of mappings at each step of the algorithm in

which data are displayed or plotted� Final point is notcounted since data are always put out at �nal point� De�fault value is nout ! ��

ipri � if ipri �! � then initial point at every algorithm step willalso be saved and plotted if corresponding options requestto do so� ipri ! � by default�

iextr � if iextr �! � then information about minimum and max�imum values of the state variables during mapping will

not be displayed� iextr ! � by default�dy � value of increment of the parameter Y �npar�� Is set�

this value is used instead of DY �npar� during executionof the current command� the value of DY �npar� is notchanged�

twait � Time of preliminary simulation in order to get steadystate�

tend � Simulation ending time for every given parameter value�Does not change the default value�

t� � Simulation starting time for every given parameter value�Does not change the default value�

dt � Simulation step� Does not change the default value�options � options �i�e� subcommands� modifying the algorithm or

data output mode� Options are executed before startingTRPP command�

Below there is an example of a procedure that plots the bifurcational diagram usingmapping technique�

�PROC BIFDIAG

�REM

�REM reading the parameters and defining the job

�R�Y�

�JOB���

�NOOUT � unnecessary output is switched off

�REM

�REM the values to be plotted

Page 73: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� STRANGE� STRANGE NONLINEAR WORLD��� �

�REM X axis� �th parameter� range is �� � ��

�REM Y axis� ��st parameter� range is � � ��

�REM

���������������EDPLTY � plot layout is determined

�REM

�REM setting the control surface

�REM

�������S�SX�� � the point on the surface

�������������U�SAN� � the vector normal to the surface

�REM

�������S�XRK� � initial conditions

�REM

�REM

���TR�DT���� � getting steady state at initial point

�REM

�REM parameters for TRPP � parameter number

�REM �� � parameter increment

�REM � � number of algorithm steps

�REM � � number of mappings in one step

�REM ���� time to get steady state

�REM ����� maximum time per one mapping

�REM KP��� � all the intersections with the

�REM control surface are accepted

�REM PLTY � run�time graphics is requested

�REM

�����������������TRPP�KP����PLTY

�REM

�PEND BIFDIAG

�� �Box� algorithm for searching attractors

There are well developed algorithms for �nding equilibrium points� There are somemethods that deal with closed orbits� But what to do with other singular trajectoriessuch as tori and strange attractors# Krit package o�ers the experimental algorithm that�in theory� can be used for �nding all types of steady�state solutions� the algorithm willbe referred to as �box� algorithm�

The idea of the method results from the de�nition of the steady�state solution i�e�singular trajectory� Such a trajectory occupies some volume in state space� This volumeremains the same despite how long one watches the trajectory�

At �rst� the system is integrated� the time interval T must be greater than charac�teristic time of the attractor� We get minimum and maximum values of the componentsof the state vector� Then the integration is performed once more� taking as initial thelast point from the previous integration� Again maximum and minimum values are com�puted� From the de�nition of the steady�state solution it follows that if an initial point

Page 74: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� STRANGE� STRANGE NONLINEAR WORLD��� �

belongs to the solution and the value of T is set properly� then maximum and minimumvalues of the state variables for two successive simulations will be the same� The gen�eralized Newton method is used to solve the corresponding system of equations� Thestability of the solution is assessed using some matrix algebra�

Numerical experiments showed that algorithm works well with closed orbits and tori�Unstable tori were successfully calculated� Experiments with strange attractors are inprogress�

The algorithm is started as follows�

�� make the same preliminary actions as for the CO command �see ���� excludingsteps and ��

�� Load in XP state vector some initial approximation to the point belonging to thesteady�state solution�

�� Set the integration time using TE command

TE ! value

� To check that everything is all right� execute RTNVOL command on the Krit

prompt and revise the values of the right�hand sides�

Now all preparations are over� Search for a solution is made by MV command�

� Only components of the state vector are allowed to change� Use the command�

MV ��RC� ��RT�

� Components of the state vector and one extra parameter may vary� In this casethe command looks like this�

npar �� dynpar� MV ��RC� ��RT�

� in this case DY �npar�� YMIN �npar�� YMAX �npar� must be set to somereasonable values �� where�

RT � option �i�e� subcommand� that requires eigenvalues to becomputed and displayed�

RC � option that requires message about stability or instabilityof the solution to be displayed�

npar � number of the parameter to be varieddynpar � 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 ofDY �npar� is not changed�

Page 75: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� STRANGE� STRANGE NONLINEAR WORLD���

���� Continuation of a solution

Suppose that initial search for a solution was successful� and the point belonging to thesolution is in the XP vector� We want to investigate the dependence of this solutionand 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� MV �� options�

where

npar � number of the parameter to be variednstep � signed number of continuation steps� When sign of nstep

changes� the direction of �motion� along a parameter al�so changes� Default is nstep ! �� If nstep ! �� onlyconvergence to a solution is performed�

nout � results will be displayed or plotted on each nout�th con�tinuation step� Default is nout ! ��

dynpar � value of maximum allowed increment of the parameterY �npar�� Is set� this value is used instead of DY �npar�during execution of the current command� the value ofDY �npar� is not changed�

options � other options �i�e� subcommands� modifying the algo�rithm�

Page 76: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter

More about the package

�� Macroprocessing of the input commands

How does the Krit package execute the command� At �rst� the command is read� Thenspecial macroprocessor looks for the special tokens� If it �nds them� they are replacedby the corresponding values� After that the resulting string is given to the commandinterpreter�

There are some macroparameters with prede�ned names� the names are of the form�name� � pay attention to the di�erence between � sign and �common� apostrophe � ��

name value�NSYS� � current order of the system

�TIME� � current time in seconds

�DOSTIME� � current time in the form �example� �

� h � m ���� s

�DOSDATE� � current date in the form �example� �

April ��� ���

�ICTR� � current value of system�s command counter�shows the number of command within givenprocedure�

�PROCDIR� � name of the directory with user�s procedures

�SYSTDIR� � name of the directory with Krit utilities

�DEFADIR� � name of the directory with Krit �common�procedures

�WORKDIR� � name of the current work directory

�EXENAME� � �le name �without path or extension� of therunning EXE��le

Page 77: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE �

The macroprocessor also allows to calculate some expression valid for Krit calculator�and to place the result �as a real or as an integer value� into command line�

macroparameter value�expression� � the expression is evaluated� the result is con�

verted into integer value and substituted intocommand line instead of this macroparame�ter�

�expression� � the expression is evaluated� the result �realvalue� is substituted into command line in�stead of this macroparameter�

Examples�

�� The system procedure STARTUP�COM �see Installation Guide for details� isan example of usage of the macroparameters�

��ECHO �DOSDATE�� �WORKDIR��EXENAME� activated at �

��DOSTIME��� �SYSTDIR�SYSTEM�LOG

�END

�� The following command allows the user to display the name and the value of theparameter�

�ECHO Angle of attack Y�� ����Y�� ���

�� Execution of the DOS command

The user can execute DOS commands while working with the package provided there isenough amount of memory� The syntax of the command is�

�DOS command

There may be spaces between � sign and the DOS command� but we recommend toavoid them�

�� Syntax of the Krit command language

A command may occupy more than one input line� If the semicolon symbol �$� is thelast non�blank symbol of the input line in batch mode or the last symbol of th line indialog mode then it is interpreted as a control symbol meaning that current input lineis to be appended with the next one� In that case semicolon is not included into thecommand� A command can occupy up to �ve input lines�

If the �rst character of the command line is �� then it is assumed that the rest ofthe command line is DOS command to be executed by operating system� If the �rst

Page 78: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE

character of the command line is �� then the rest of the command line is the arithmeticexpression to be evaluated by Krit build�in calculator� In all other cases the commandline comprises the �ordinary� command�

A command may comprise four �elds� in the following order

�� numerical data �eld �optional�

�� options� �eld �obligatory�

�� auxiliary �eld �optional�

� commentary �eld �optional�

Numerical data �eld

The �eld is optional� If present� it is the �rst �eld in the command� It comprises a list ofinteger and real values separated by commas� Real values may be entered using either�xed point or scienti�c notation� The end of �eld is determined by the �rst symbol thatcannot be treated as an element of the list� No blank symbols are allowed inside the�eld�

Options� �eld

This is the only obligatory �eld of the Krit language command� The �eld begins fromthe �rst symbol which does not belong to data �eld �if it present�� end ends either withthe end of command or when semicolon or blank symbol is encountered outside matchingparentheses� The �eld comprises a list of options separated by commas �outside matchingparentheses��

Auxiliary �eld

The �eld is optional� It is separated from the options� �eld by the �rst blank symboloutside matching parentheses� It ends either with the end of command or when semicolonis encountered�

Commentary �eld

The �eld is optional� If present� it is always non�empty� It is separated from other �eldsby the �rst semicolon �outside matching parentheses in the options� �eld� and ends withthe end of command�

����� Syntax of the option

The commands and subcommands of the Krit command language are called options�The di�erence is that commands may be used �standalone� while subcommands areuseful only in�line with some other commands� Throughout this manual the term �com�mand� is often used to underline that corresponding Krit language token may be usedstandalone�

Page 79: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE �

Each option may comprise two �elds� keyword �eld �obligatory� and value �eld�optional�� Each of these �eld may comprise expressions inside matching parentheses�

Expressions inside matching parentheses

The expression is formed by an opening bracket� a matching closing bracket and a numberof symbols between them �these symbols di�er from the brackets used��

The following pairs of brackets are allowed�

�� �� �� �� �� ��

The user may use any allowed brackets�

Keyword �eld

This �eld is obligatory� It is separated from the value �eld �if it exists� by the �rst equalsign �!� outside matching parentheses� Keyword �eld is to include the name of the Kritcommand or subcommand� If there are no expressions within matched brackets thenoption name coincides with the whole �eld� Otherwise the option name ends when the�rst bracket of the �rst expression is encountered�

Value �eld

Value �eld is separated from keyword �eld by the �rst equal sign �!� outside matchingparentheses�

����� How a command is executed

At �rst a command is read from input device� The processing of the command is doneas follows

� the command is searched for a numerical data �eld� If the �eld is found then thedata are decoded� Integer values are placed in the special data array in the orderof their appearance in the data �eld� At the same time real values are placed in theother data array in the order of their appearance� Such mechanism allows the userto mix integer and real values at his will� Only the order among integer values andseparately among real ones is vital� The type of the value is of great importance�and real values are to have either decimal point or exponential term�

� All the options are executed in the order of their appearance in the command�

Such commands as ST CO TR TRP SEP RTN RTNP and some othersonly set special �ag and their �genuine� execution is delayed until all other optionsare processed� This allows the user to mention the Krit command to be executedand options modifying it in any order�

If an error is detected during processing of some option� the processing of the wholecommand will be stopped�

Page 80: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE

� After processing of the options� the package checks whether there is a delayedaction �due to ST CO etc��� and performs it if necessary�

� The package remembers whether the execution of the previous command was suc�cessful or not� This may be used for jumps in the procedures�

�� Options for the local stability analysis

When a solution of the nonlinear system is found� one can get vital information aboutits stability and local structure� The following data are available�

� Jacoby matrix

� eigenvalues of the Jacoby matrix

� eigenvectors of the Jacoby matrix

� message about the type of stability

� stability index may be written into one of the parameters

����� Eigenvalues

To get eigenvalues� the optionRT

is to be mentioned in the same command line with a command that computes thesolution� The eigenvalues are computed using QR�algorithm� The root number and itsvalue are displayed� For closed orbits the absolute value of the eigenvalue is also shown�

The internal stability code is memorized by the package as a side e�ect of this option�It may be used by ON and some other commands for conditional execution and jumps�

����� Message about stability type

To get the message� the following option is used in the same command line with acommand that computes the solution�

RC

The message includes stability type and brief description of the roots �the latter iswritten twice using two di�erent systems of notation�� The message takes into accountthe class of the solution �equilibrium point or closed orbit��

There are four stability types

� �STABLE� � the solution is stable�

� �SADDLE� � the solution is saddle�type unstable i�e� it has one and only oneunstable eigenvalue�

Page 81: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE ��

� �OSCILLATORY� � the solution is oscillatory unstable i�e� it has one unstablecomplex pair of eigenvalues �and no more unstable eigenvalues��

� �UNSTABLE� � the solution is unstable� but it cannot be classi�ed as �saddle�or �oscillatory��

The �rst stability code comprises four integer values separated by slashes�

n��n���n��n�

wheren� � the number of stable real eigenvalues�n� � the number of stable complex eigenvalues�n� � the number of unstable real eigenvalues�n� � the number of unstable complex eigenvalues�

Note� that each complex pair is counted as two eigenvalues here� The sum n� �n� �n� � n� equals to the order of the system�

The second stability code is a sequence of letters� the meaning of letters is as follows�S� � one stable real eigenvalue��F� � one stable complex pair of eigenvalues��U� � one unstable real eigenvalue��L� � one unstable complex pair of eigenvalues�

The internal stability code is memorized by the package as a side e�ect of this option�It may be used by ON and some other commands for conditional execution and jumps�

����� Eigenvectors

To get eigenvectors� the optionVC

is to be mentioned in the same command line with a command that computes thesolution� The eigenvectors are computed using QR�algorithm� They are displayed in thesame order as the eigenvalues �if both options VC and RT are used simultaneously��

����� Jacoby matrix

The Jacoby matrix for the equilibrium point and corresponding matrix for closed orbitare displayed when the option

JACOBY

is mentioned in the same command line with the main command� The matrix is displayedas a matrix if possible� otherwise is is printed line by line�

Page 82: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE ��

���� Working with submatrix

When any option concerning Jacoby matrix or corresponding matrix for closed orbits�or their eigenvalues and eigenvectors� is used� the package by default analyzes the full

matrix�Sometimes it is necessary to study the properties of some submatrix of jacobian� Krit

allows to do so� The user can describe a submatrix� store the description and later re�useit�

Initializing catalog

It is desirable to store the descriptions� The catalog of the descriptions must be initializedonce using a command

EX ! KILL

The same command is used to delete all the entries from the catalog�

Entering new description to the catalog

To enter the description and to store it into the catalog� use one of the commands

EX �entryname�

andEXS �entryname�

where entryname is the name �up to � characters� of the new entry in catalog�The package will prompt for data cards� the prompt is a �#� sign� Input of the data

cards is terminated when an empty or blank card is found� Each card comprises theinteger number ni with the following meaning

for EX command for EXS command

the resulting matrix is formed bythe jacobian elements standing onthe intersection of �marked� �ni�th�rows and columns�

the resulting matrix is formed bythe jacobian elements except forthose of �marked� �ni�th� rows andcolumns�

Using the description

To use the submatrix instead of full matrix� user must place the following option on thesame command line with the main command

EX ! entryname

where entryname is the name of the previously stored description�

Viewing the catalog

To get information about catalog entries� execute a command

EX !#

Page 83: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE ��

General syntax of the EX and EXS options

The full syntax of these options is as follows

EX

������ ������

!

�� ��

KILL#

entryname�

�����

�entryname��

�������������

�������

and

EXS

������ ������

!

�� ��

KILL#

entryname�

�����

�entryname��

�������������

�������

whereentryname� � the name of new entry to the catalogentryname� � the name of the stored description to be usedKILL � requests to initialize the catalog�# � requests information about catalog entries�

Note� The options in the form

EX or EXS

may be mentioned on one command line with a command that computes the solution�Then the description will be read from data cards and used for analysis during theexecution of the current command� After that it will be forgotten�

���� Special e�ects

The commands described here are especially useful for batch procedures�

How to get a stability code as a parameter value

The option with the syntaxRCD �! npar�

does the following�

� if npar is set� then the stability code will be written into the parameter Y �npar�if requested� Default value is npar ! ��

� when used as option in one line with the commands ST CO etc�� it requires thepackage to compute the stability code and write it into the parameter Y �npar��If npar ! �� there will be no writing�

Page 84: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � MORE ABOUT THE PACKAGE ��

� the values of the stability code are�

�� � the solution is stable� � the solution is saddle�type unstable� � the solution is oscillatory unstable�� � the solution is unstable but not oscillatory or saddle type�

number of unstable eigenvalues is even���� � the solution is unstable but not oscillatory or saddle type�

number of unstable eigenvalues is odd�

Break on stability

There is an option that allows to stop an execution of the command calculating thedependence of the solution on a parameter at the moment when stability type changes�The option

STB

stops the command when initially stable solution becomes unstable�The same option in the form

STB !NO

stops the command when initially unstable solution becomes stable�Note� that the command terminates successfully�

Page 85: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter

Advanced topics

��� Run�time graphics

What a bore to watch endless columns of digits running on the screen� It is much morepleasant when a colorful picture gradually appears in front of the user� No doubt thatpictures are more compact and easier to analyze than numbers�

Krit o�ers very limited graphical support� and we are sorry about it� But some�thing is better than nothing��� Future versions of the package will have better graphicalinterface� And we proceed now to the present�day graphical commands�

Now it is possible to plot on the screen the following types of �at pictures

� parameter vs parameter �remember that the values of the state variables are ac�cessible using values of corresponding parameters�

� parameter vs time

� loci of eigenvalues

� the dependence of Y �i�k��

on Y �i�k

where k indicates number of data point

Before any plotting it is necessary to execute a setup command

ix� iy� �line� nx� ny� � xmin� xmax� ymin� ymax �� cx� cy� EDPLTY

where

ix and iy � indicate what data will be plotted along X and Y axis cor�respondingly� If ix � � then the value of the element of thecorresponding data array �see �g����� will be used� If ix ! ��that current time is used for plotting along X axis� The rule foriy is analogous� If one wants to plot eigenvalues� it is necessaryto set ix ! iy ! ���

Page 86: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ��

The dependence ofY �i�k�� onY �i�k where k indicates numberof data point� can be drawn using the setting ix ! i and iy ! ��it is recommended to set line ! ���

line � indicate plotting mode� If line ! � then continuous lines aredrawn� otherwise �line �� only data points are marked� themarker is de�ned by line as follows� � � dot� � � circle� � ��lled box� � cross� Default is line ! ��

nx and ny � set a number of grid ticks for a corresponding axis� Default isnx ! ny ! � �no grid��

xmin and xmax � set maximum and minimum values for a variable plotted alongX axis� xmin corresponds to screen left margin� and xmax � tothe right margin�

yminandymax � set maximum and minimum values for a variable plotted alongY axis� ymin corresponds to screen bottom margin� and ymax �to the top margin�

cxandcy � before output the data to be plotted may be multiplied bycorresponding coe�cients� Default is cx ! cy ! ��

To activate run�time graphics� the user must mention the option PLTY in the samecommand line that activates the calculations� The option may be used in conjunctionwith the commands ST CO TR TRP and some others� Do not forget to mention

the RT option when drawing loci of the eigenvalues�

Then the command with PLTY option set �nishes� the picture remains on the screen�message �Ready� appears on the screen at that moment�� To continue the dialog withthe package� one is to press �Return� button on the keyboard� At the same time� thereis a possibility to remove the picture automatically �a feature important for writingprocedures�� The option SHUT causes the removal of the picture when the commandis �nished� This option is to be mentioned in the same line with PLTY option�

���� Keeping pictures in memory� Composed pictures�

The is a possibility to create composed pictures appending the initial picture� In thecurrent version� the directory for temporary �les is used to store the current image� �lename is nKRITPIQT�����

The regime of appending the picture is toggled by a command

VTY

As a result� when some command �ST�etc�� is executed in line with PLTY option�then

� the picture stored in �le nKRITPIQT���� is read and shown �if the �le alreadyexists��

� the picture is appended with new data �message �Work� is seen on the screen��

� new picture is stored in the �le nKRITPIQT����� The message �Stored� replaces�Ready� message�

Page 87: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ��

�Appending� regime is switched o� by a command

NOVTY

but the �le nKRITPIQT���� remains in memory untouched� If it is necessary to deletethis �le� use the command

CLTY

If one wants to keep the accumulated picture in his own �le then the commandWRTY is applicable

WRTY �filename�

��le nKRITPIQT���� remains in memory��It is also possible to start the regime of appending the picture stored previously in

the �le filename� The following form of the VTY command is used�

VTY �filename�

The user can save the picture in the �le nKRITPIQT���� even when �appending�regime is switched o�� To do so� it is necessary to press any other button instead�Return� or �Enter� at the moment when completed picture is on the screen with�Ready� message written� The message �Stored� must appear� To append this picture�use VTY command�

The picture stored in the �le can be viewed outside the package using theVISU�EXEutility from the directory nVKnBAT� Enter on the DOS prompt

VISU

The utility will ask for the full name of the �le with picture� Press � Esc � button toreturn to DOS�

���� Color selection

Default color

Default color for drawing is light�yellow �number ��� User may set the desired colorusing the command

INK ! n

where n is the number of desired color �� � � � ���� Note that INK command may be usedas option i�e� it may be placed on the same command line with other commands�Possible colors are�

n color n color� black � gray� blue lightblue� green �� lightgreen� cyan �� lightcyan red �� lightred� magenta �� lightmagenta� brown � yellow white �� brightwhite

Page 88: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

Color according to stability type

There is also a possibility �versions ���� and later� to select a color according withstability of the solutions� It is compatible with ST and CO commands with PLTYoption set� This mode is set by the option

SCS

The colors will be chosen as follows�

stability type colorstable �� �lightgreen�

saddle�type �red�oscillatory unstable � �brown�

other � �cyan�

���� Drawing loops and other attractors

The commands listed above do not allow the user to display loops �periodic solutions�or more complex attractors found by CO and some other commands� The option

LPR

requires the attractor to be visualized when used with these commands� It is not neces�sary to use PLTY option in this case�

User may also change the number of points per unit of time to be used for drawingthe attractor� Initial value is �� points per unit of time� The value may be changed bymeans of the command

LPTS ! number

���� Viewing stored screen image

Now the user can view the stored screen image �in the VTY regime of the Run�timegraphics� by means of VISU command �

VISU ��filespec��

where filespec is a name of the �le with stored screen image� If filespec is omitted�then the current temporary �le �used for storing images� will be displayed�

��� Clear the screen

This command clears the screen of the display�

CLS

Page 89: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ��

��� Selecting colors for SCS command

The EDSCS allows the user to select his own colors for highlighting the stability typeof the solution by means of SCS command �see User Guide� p����� The command is asfollows�

ist �� isa� �� idv� �� iun� EDSCS

where

ist � color for stable solutions�isa � color for saddle�type unstable solutions�idv � color for oscillatory�type unstable solutions�ist � color for unstable �other types� solutions�

The list of colors see on p��� of the User Guide�

���� Post�graphics using SAVE��les

Now a very important feature �as we think� is added to the package� Now you can drawplots using the data accumulated in the SAVE��les �see User Guide� section ���� Usethe command �

ifrm� ix� iy �� icolor� �� iline� �� imark� DRAW �filename�

where

filename � name of the SAVE��le �without extension�

ifrm � frame size of the �le �i�e� the number of items inthe corresponding EDAR command issued beforethe creation of the �le��

ix and iy � positions in the frame of the values to be plotted�ix � ifrm and iy � ifrm

icolor � color to be used for drawing instead of currentdefault color�

iline � line type� iline ! � �the default setting� meanssolid lines� iline ! � requires that only data pointwill be marked� with no connecting lines�

imark � if � � imark � � is set� then the data points willbe marked by the following markers� � � circle� �� box� � � �x� sign�

Note� that the command automatically closes the �le after processing�

��� How to keep the results in �les

Krit is a good package� isn�t it # But there are many other good programs �especiallygraphical ones�� and it is necessary to have a tool for data transfer� Krit packageallows the user to store a set of �vectors� containing the values of selected parametersor eigenvalues of the jacobian matrix� Each such �vector� will be called a frame�

Page 90: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

���� Keeping parameters

First of all� a list of parameters must be set� The command is

EDAR

After that Krit will prompt for data lines� prompt �#� will be used� Dialog isterminated when empty or blank line is encountered� Each data line comprises integernumber of a parameter � or code� see �g����� to access various data arrays�� and optionalcoe�cient separated with comma�

# k �� coeff �

wherek � if k � � then the value of the corresponding element of

the data array will be stored �see �g������ If k ! �� thencurrent value of independent variable �time� will be stored�

coeff � if set� then the product of it with the parameter indicatedby k will be stored� Default is coeff ! ��

Frame size �i�e� number of real values in one record� equals to the number of param�eters to be stored �i�e� to the number of data cards��

The �le must be opened before usage� The command

SAVE �filename�

opens new �le with the name filename� If it is desirable to append existing �le withnew data� the following command must be used

SAVEA �filename�

The commands SAVE and SAVEA close previous storage �le �if it exists� if filenameis set�

Now the user may store the data� It is simple� very simple� The user must mentionthe option

SAVE

on the same command line with main computing commands such as ST CO TRTRP etc�

Sometimes there may be a need to close the �le explicitly� Use the command SAVEin the form

SAVE ! CLOSE

���� Keeping roots

The manipulations necessary to store eigenvalues of the Jacoby matrix are quite similarto those mentioned above� But there is no need to de�ne a list of data to be stored� The

Page 91: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

package will write all the roots� each root will occupy a frame �i�e� frame size is � sincereal and imaginary part of the root are stored��

It is also necessary to open a �le using a command

VRT �filename�

This command opens new �le with the name filename� If it is desirable to appendexisting �le with new data� the following command must be used

VRTA �filename�

The commands VRT and VRTA close previous storage �le �if it exists� if filename isset�

To store the roots � the user must mention the option

VRT

on the same command line with main computing commands such as ST CO TRTRP etc�

Sometimes there may be a need to close the �le explicitly� Use the command VRTin the form

VRT ! CLOSE

���� How to work with �le

The following Fortran text illustrates how the �le is opened and written

���

REAL DATA���

���

OPEN �UNIT���FILE��filename��STATUS��NEW��FORM��UNFORMATTED��

���

���

C NFRAME is a frame size

WRITE ��� �DATA�I��I���NFRAME�

���

CLOSE �UNIT���

���

Files of this type are fully compatible with ��G and FastGraph graphical packagesmade in Russia�

It is easy to convert the data stored into format suitable for other packages� Oneutility called cvt�exe can be found in nVKnBAT directory� It converts data into theformat of the Grapher package �Grapher accepts text �les with data written in columns�

Page 92: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

up to � columns are allowed�� The same format is also acceptable for some other graphicalpackages�

To run the utility� enter CVT on the DOS prompt� The user then will be promptedfor necessary information�

prompt replyReport data file name � � the full name of the input data �le

Report GRAPHER name � � the full name of the output �le� Notethat Grapher accepts only �les withthe extension �dat �

Report up to frame positions � � here user enters the list of the values tobe converted using their relative posi�

tions in the frame� The numbers mustbe separated with commas� The utili�ty will display the numbers�

Report frame size � � indicates frame size of records in theinput �le�

��� Built�in calculator

Sometimes you need to make some simple calculations �for example� convert degrees intoradians� while working with the package� Sometimes certain calculations are necessary inprocedures� There is no need to leave the package since it has simple built�in calculator�

The calculator may operate with constants� with values of the parameters �from Ydata array�� It has access to the data from all vital Krit data arrays �some of them areaccessible only by means of calculator�� The calculator also has a small internal arrayW of the size ��� The results of the calculations may be written into all these dataarrays�

The result of the calculation is memorized� It may be used byON command intendedto organize conditional execution and jumps�

The calculations may be performed either using Fortran�like expressions or by meansof a set of special commands� Floating�point arithmetics is always applied�

The calculator is also used for macroprocessing of the input commands �see section ����

���� Using Fortran�like expressions

The command has four forms�

�� the �rst form of the command allows to store the result into some element of thedata array

��array id��i� � expression

where

Page 93: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

�array id� � is a name of some Krit data array� The fol�lowing names are valid� X DX XP DXPXRK DXRK WR WI XS DXS SX�SAN XSF XAN XPL� XPL� XBXB� XB� XGOM XMI XMA KEYBUF F A B C D XUPP XLOWLY SY W � The array XOGR can alsobe �lled using the following form of the com�mand�

#XOGR �i� j� !expression

i � is the number of the element of the data array�

expression � an expression written according to �somewhatupdated� Fortran rules�

�� the second form of the command �now obsolete� allows to store the result intosome parameter

Y �i� ! expression

where i is the number of parameter and expression is an expression written ac�cording to �somewhat updated� Fortran rules�

�� the third form allows the user to do some calculations without writing a result intodata array �

#expression

� the fourth form �now obsolete� allows the user to do some calculations withoutwriting a result into some parameter

Y ! expression

In all cases� the result is memorized and may be checked later using ON command�The expression should be written using Fortran rules� The user must type it in upper

case� No blank symbols are allowed inside the expression� The following operators canbe used as usual

� � � �There are additional operators

Page 94: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

operator example result! Y �i� ! r� � the result of the whole expression is r�� As

a side e�ect� the value r� is stored intoY �i��

�GE� r� �GE� r� � if r� r�� the result is �� Otherwise theresult is ��

�GT� r� �GT� r� � if r� � r�� the result is �� Otherwise theresult is ��

�LE� r� �LE� r� � if r� � r�� the result is �� Otherwise theresult is ��

�LT� r� �LT� r� � if r� � r�� the result is �� Otherwise theresult is ��

�EQ� r� �EQ� r� � if r� ! r�� the result is �� Otherwise theresult is ��

�NE� r� �NE� r� � if r� �! r�� the result is �� Otherwise theresult is ��

�NOT� �NOT� r� � if r� ! � then the result is ��� otherwise theresult is ��

�AND� r� �AND� r� � if simultaneously r� ! �� and r� ! �� thenthe result is �� Otherwise the result is ��

�OR� r� �OR� r� � if either r� ! �� or r� ! �� or both then theresult is �� Otherwise the result is ��

You may use a constant PI� PI!������ The value of the constant is substitutedusing macroprocessing technique�

Also� there is a number of built�in functions� The functions SIN COS TANSQRT ABS ALOG EXP ATAN SIGN ATAN� are used in the same way asin Fortran language� The functions AMIN and AMAX are used as Fortran functionswith the names AMIN� and AMAX� �i�e� they may have � arguments��

Additional functions are listed in table ����

���� Simple command that makes loops

The command REPEAT is intended for simple �loop� calculations� The syntax of thecommand is as follows�

�i� j� k� REPEAT expression

where expression is a valid calculator expression �with or without assignment of thevalue to some element of the data array�� The expression may contain � signs� each suchsign will be replaced with the current loop index value �using macrosubstitution�� beforecalculation is performed� The rules for index are as follows�

� none of the values i� j is set� or only i is set� By default� i ! �� The calculation isrepeated for the values of the loop index � �� � � � i��

Page 95: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS

name example resultY Y �i� � returns the value of a parameter Y �i�

�name� �name� �i� � returns the value of the i�th element ofthe corresponding Krit data array�name��i�� The name of the array maybe one of the following� X DX F XPDXP XB XB� XRK SX� SANXS DXS XSF XAN �A number of �hidden� Krit arrays arealso accessible� DXRK XPL� XPL�XB� XGOM BUF� The user can alsoaccess Krit internal matrices using thismechanism� Their names are A B CD� Please don�t use them if you are anordinary user�

WR WR �i� � returns the value of a real part of the i�theigenvalue

WI WI �i� � returns the value of an imaginary part ofthe i�th eigenvalue

XMI XMI �i� � returns the minimum value of the i�th com�ponent of the state vector during integra�tion or mapping

XMA XMA �i� � returns the maximum value of the i�thcomponent of the state vector during in�tegration or mapping

AMPL AMPL �i� � returns the value equal to ��)�XMA�i��XMI�i�� i�e� the amplitude of the oscil�lations of the i�th component of the statevector during integration or mapping

MEAN MEAN �i� � returns the value equal to��)�XMA�i��XMI�i�� i�e� the meanvalue of the i�th component of the statevector during integration or mapping

FUNC FUNC �i� � returns the value calculated byuser�de�ned FUNC subroutine� thenumber of formula equals i� Before thecall with input parameter equal to i� thepackage performs a call with inputparameter equal to zero�

Table ���� Additional functions

Page 96: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

name example resultXOGR XOGR �i� j� � returns the value of the lower �i ! �� or

upper �i ! �� limit for j�th state variable

XUPP XUPP �i� � returns the upper limit for i�th state vari�able

XLOW XLOW �i� � returns the lower limit for i�th state vari�able

W W �i� � returns the value of the i�th element ofthe calculator work array �you may use itfreely�� � � i � ��

LY LY �i� � returns the value of a system parameterLY �i�

SY SY �i� � returns the value of a system parameterSY �i�

KEY KEY �i� � returns �� if the corresponding row andcolumn are to be retained in the jacobianmatrix for the evaluation of eigenvalues�Otherwise it returns �� �See also the de�scription of the EX and EXS commands��

COTAN COTAN ��� � returns the value of cotan�

DEG DEG �x� � returns the value x � � �� i�e� converts ra�dians to degrees

RAD RAD �x� � returns the value x�� �� i�e� converts de�grees to radians�

INV INV �x� � returns the value ��x�

Table ���� Additional functions �continued�

Page 97: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

� i and j are set� The default value for k is �� The calculation is performed as inthe case of the Fortran�language loop statement

DO M ! i� j� kexpression

ENDDO

i�e� the index starts with i value� and the execution is continued while i � j� eachstep i being incremented with k�

Example�

The command shown below moves the elements ��� from Y array into correspondingelements of the X array�

���REPEAT X�*� ! Y�*�

���� Arithmetic commands

The package has �� arithmetic commands� The general syntax of the command is asfollows

i� �� i�� �� i�� �� r� command

where command is a keyword of the command�

The result of the operation is always stored into parameter Y �i��� The �rst operandof the command is the value of Y �i��� by default i� ! i�� The second operand of thecommand �if necessary� is de�ned as follows

� if r is set� the r is the second operand�

� if r is not set� then the second operand of the command is the value Y �i��� Bydefault� i� ! i��

Be careful� The command i� jY� means Y �i� ! Y �j� �Y �i� for example�The result of the command is memorized for later usage in ON command�Below is the list of Krit arithmetic commands� Here r� means the �rst operand� r�

� the second one�

command result command result command resultY� r� � r� Y� r� � r� Y� r��r�Y� r� � r� Y�� rr�� Y� r��Y� r� Y� r� SQR

pr�

SIN sin r� COS cos r� ABS jr�jINV ��r� TAN tan r� COTAN cotan r�ASIN arcsin r� ATAN arctan r�

There is also a command for exchanging values of two parameters� The syntax of thecommand is

i� jY !

As a result� the parameters Y �i� and Y �j� will exchange their values� The new valueof Y �i� is memorized as a result of arithmetic operation�

Page 98: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS

��� Solving ��nd order nonlinear system using

low�resolution graphics

This command is only applicable to the nonlinear systems of the second order� Thespeci�ed region on the state plane is scanned� and the points are marked where one ofthe right hand sides changes its sign� The marks are

� �)� � here both components of the right hand side vector change sign �probably itis an equilibrium point of the system considered��

� ��� � here only the �rst component of the right hand side vector changes sign�

� ��� � here only the second component of the right hand side vector changes sign�

As a result� one may get an alphanumerical low�resolution plot that shows the regionswhere solutions may exist�

It is also possible to send into the X�stack the coordinates of the points where bothcomponents of the right hand side vector change sign�

The syntax of the command is as follows

�lenx� �� ngridx� �� leny� �� ngridy� �� iout� �� istack� � xmin� xmax� ymin� ymaxAPRSL

where

lenx� leny � size of the plot in positions� Default is lenx ! � andleny ! ���

ngridx� ngridy � vertical grid lines will be plotted each ngridx positions �and horizontal grid lines will be plotted after every ngridypositions� Default is ngridx ! ngridy ! ��

iout � if iout �! � then the plot will be written into the graphical�le� If iout �! � the plot will be displayed on the screen�Default value is iout ! ��

istack � if istack �! � then the solutions found will be written intoX�stack� If istack ! � then theX�stack will be initializedbefore execution of the command�

xmin and xmax � minimum and maximum values of the �rst component ofthe state vector �corresponding to the �rst and the lastpositions on the plot��

ymin and ymax � minimum and maximum values of the second componentof the state vector �corresponding to the �rst and the lastpositions on the plot��

Example

Consider the system of equations

f� ! x� � x��f� ! x� � x��

After execution of the command

Page 99: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS �

� �������������������APRSL

one can get the plot shown in �g�����

XMIN����� XMAX� ��� DX� ����

��� �����������������������������������������

���� I ��� I I I ��� I

���� I ��� I I I ��� I

�� � I ���I I I���

��� I ��� I ���

���� �������������������������������������

���� I ��� I ��� I

���� I I��� I ���I I

� �� I I ��� I ��� I I

��� I I ���� ���� I I

���� E� � �����������������������������������������

���� I I I I

�� �� I I I I

����� I I I I I

����� I I I I I

����� �����������������������������������

���� I I I I

��� � I I I I

����� I I I I

����� I I I I I

���� �����������������������������������������

Figure ���� Plot made by APRSL command

��� One more graphical command for ��nd order

systems

This command is only applicable to the nonlinear systems of the second order� Thespeci�ed region on the state plane is scanned� and the points are marked according tothe signs of the right hand sides� The marks are

� �)� � here both components of the right hand side vector are less or equal to zero�

� ��� � here only the �rst component of the right hand side vector is less or equal tozero�

� ��� � here only the second component of the right hand side vector is less or equalto zero�

Page 100: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS

As a result� one may get an alphanumerical low�resolution plot�The special feature of this command is that the limits for the plot are set in �degrees�

while corresponding state variables are in �radians�� That means that the values selectedby the scanning algorithm are divided with � �� before call to the subroutine calculatingright hand sides� The behaviour of the command is very similar to that of APRSLcommand�

The syntax of the command is as follows

lenx� ngridx� leny� ngridy �� iout� � xmin� xmax� ymin� ymaxROLL

where

lenx� leny � size of the plot in positions�ngridx� ngridy � vertical grid lines will be plotted each ngridx positions �

and horizontal grid lines will be plotted after every ngridypositions�

iout � if iout �! � then the plot will be written into the graphical�le� If iout �! � the plot will be displayed on the screen�Default value is iout ! ��

xmin and xmax � minimum and maximum values of the �rst component ofthe state vector multiplied by � �� �they correspond tothe �rst and the last positions on the plot��

ymin and ymax � minimum and maximum values of the second componentof the state vector multiplied by � �� �they correspondto the �rst and the last positions on the plot��

�� Graphical processing of the stored results

Krit package has a special command that allows to process the data stored in the �leusing SAVE command� The results are displayed using low�resolution graphics thatmay be stored in the graphical le�

The user selects two values to be used for plotting from two positions in the frame�There is also a possibility to mark the point according to the value written in some thirdposition in the frame�

The syntax of the command is

lenx� ngridx� leny� ngridy �� iout� �� iframe� �� ix� �� iy� �� iz� �xmin� xmax� ymin� ymax �� z� � � � � zk� SHOW ��filespec��

where

Page 101: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

lenx� leny � size of the plot in positions�ngridx� ngridy � vertical grid lines will be plotted each ngridx positions �

and horizontal grid lines will be plotted after every ngridypositions�

iout � if iout �! � then the plot will be written into the graphical�le� If iout �! � the plot will be displayed on the screen�Default value is iout ! ��

iframe � frame size �see the description of the EDAR command��The value entered in the previous SHOW command isused by default�

ix and iy � values from ix�th and iy�th positions in the frame will beused as x and y�coordinates� The values entered in theprevious SHOW command are used by default�

iz � if set� the value from the iz�th position in the frame willbe used for selection of the marker�

xmin and xmax � plot limits for X�axis�ymin and ymax � plot limits for Y�axis�z�� � � � � zk � the ordered sequence of values� these values de�ne the

ranges for the auxiliary value �iz�th value in the frame��The marker shows to what range �zi� zi��� current auxil�iary value belong�

filespec � if set� the �le with corresponding name is opened �andattached to ��st logical unit�� Otherwise the result de�pends on the user�s ability to handle �les himself since the�previous� SHOW command neither rewinds nor closesthe �le after execution�

Example

Consider the system of the �rst order

f ! y� ��y�� � y��

where y� is a state variable and y� and y� are the parameters� Suppose that we areinterested in equilibrium solutions and their dependence on the parameters�

After execution of the commands

�EDAR

��

��

�DOIT� the call to the procedure

where the procedure DOIT collects the data and stores them into the �le save�le�dat�

Page 102: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

�PROC DOIT

�L�

��������S�Y�

�����������S�YMIN�

����������S�YMAX�

�������S�DY�

������������U�Y�

�JOB���

�AC������

�ITR���

�ST

�V�X�

�SAVE�SAVEFILE�

�����DO

�R�X�

�����U�Y�

�ST

�V�X�

������ST�NEWT�SAVE

�ENDDO

�SAVE�CLOSE

�L�

�END

Now we can plot the data using a command

����������������������������������������SHOW�SAVEFILE�

After that we�ll get the plot shown in �g����� �Note� that ambiguous points are markedwith star symbol��

�� Selecting a point in the vicinity of the solution

When it is necessary to select a point in the neighbourhood of the given solution z��especially if a point must belong to the stable or unstable submanifold�� the commandGEN may be of value� This command generates a point z belonging to the planespeci�ed by two eigenvectors � and � �

z ! z� � r � �� cos � � � sin �� �����

The result is written into speci�ed state vector� There are three forms of the com�mand

�� The �interactive� form of the command is

GEN �dest�F

��XXP

��

Page 103: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

XMIN� ���� XMAX� ��� DX� ���

��� ������� ��������

��� �� ��������� ��I

�� � ��������������������� ��I

���� � �������������������� �I

�� � � ������������ �I

���� � ������������������������� �

��� ����������������������������� I

�� ���������������������������������� I

���� ��������������������������������� I

�� � ����������������������������������� I

���� ��������������������������������������� �

���� ������������������������������������� I

��� � ������������������������������������� I

���� ������������������������������������� I

����� ��������������������������������������� I

����� ����������������������������������� �

��� � ������������������������������������� �I

����� � ��������������������������������� �I

��� � ������������������������������� �I

���� � ��������������������������� �I

����� ��������������������� �

��� � � �������������� �I

����� �� ����������������������� ��I

� �� �� ��������������� ��I

� ��� ��� ���I

���� ���������������������������������������������������

MEANING OF CODES�

� � Z �� ���

� Z �� ����

� � Z �� ���

� Z �� ���

� Z �� ��

Figure ���� Plot made by SHOW command

Page 104: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

At �rst the jacobian matrix and its eigenvalues and eigenvectors are calculated�Then the package will prompt for the data card� The data card must contain thevalues�

ieigv�� ieigv�� shift �� angle�

�� In this mode the command does not evaluate the jacobian matrix� the matrix calcu�lated by the previous �interactive� GEN command �or by ST or CO commands�is used� The necessary data are taken from data �eld of the command�

ieigv�� ieigv�� shift �� angle� GEN �dest�

�� This version of the command is executed in the same way as variant �� but thedata card is not requested� the value of shift is taken from the data �eld ofthe command� The eigenvector�s� corresponding to the �rst detected unstableeigenvalue�s� is selected�

If there are no unstable roots� the command terminates with error� If a realunstable root is selected� then ieigv� ! ieigv� ! ieigv and angle ! �� If anunstable complex pair is selected� then angle ! ��

The syntax is�

shiftGEN �dest�F

��XXP

��

where

ieigv��ieigv� � numbers of the selected eigenvectors �if a shift along someeigenvector is needed� mention its number twice��

shift � the value of r �see equation �������angle � the value of � in degrees �see equation �������dest � the name of the destination state vector�X or XP � if X is set then the point is generated in the neighbourhood

of the equilibrium solution� the solution must be in the Xbu�er� This variant is selected by default�

If XP is set then the point is generated in the neighbour�hood of the periodic solution� the �xed point of the pointmapping must be in the XP bu�er�

The package also has the GENS command� The GENS command is identical withGEN command� except for the �without data card� mode� In that mode� the GENScommand selects the direction of the �rst �stable� eigenvector�

��� Customizing input and output

Here a brief summary of the commands a�ecting input and output of data is presented�These commands are intended primarily for experienced users�

Page 105: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ��

� �� Switching on and o� output of certain types of data

When a solution is found or a step of simulation is done� then the package prints someinformation� The message nay include

� corresponding state vector�

� the values of the parameters from the prede�ned list�

� minimum and maximum values of the state variables during simulation�

The user may lock and unlock the output of these data�

Minimum and maximum values during simulation

Initially this kind of output is unlocked� The user may lock it by a command

NOMX

and unlock by a commandMX

State vector

Initially this kind of output is unlocked� The user may lock it by a command

NOPX

and unlock by a commandPX

Output of the values of the parameters

Initially this kind of output is unlocked� To activate it� the user must de�ne the list ofthe parameters to be displayed� The list is de�ne d by the command

EDIT

The command prompts the user for data cards� Each data card includes the code neededto access the data� and optionally the coe�cient �then the product of the parameter valueand the value of the coe�cient will be displayed�� Empty or blank data cards terminatesthe command�

This type of output may be locked by the command

NOED

and unlocked by the commandED

Fig���� shows� how data from various data arrays may be accessed using correspond�ing codes�

Page 106: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

code meaning

� � i � ���� Y �i�i !��nn minimum of the n�th state variable during integration or

mapping�Example� i ! ����

i !��nn maximum of the n�th state variable during integration ormapping�Example� i ! ����

i !��nn amplitude of oscillation of the n�th state variable duringintegration or mapping �i�e� ���)�maximum � minimum��Example� i ! ����

i !�nn mean value of the n�th state variable during integrationor mapping �i�e� ���)�maximum � minimum��Example� i ! ���

i !��nn �for EDPLTY only� output minimum and maximumvalues of the n�th state variable during integration ormappingExample� i ! ����

i ! nnmmm m�th element of the Krit n�th data array� The data arraynumbers are�

N arr� N arr� N arr� N arr�� X � DX � XP DXP� XRK � DXRK WR � WI XS �� DXS �� SX� �� SAN

�� XSF � XAN �� XPL� �� XPL�� XB �� XB� � XB� �� XGOM� F � A � B C� D

Example� i ! ���� means X���

Figure ���� Table of codes for EDIT EDAR EDPLTY commands

Page 107: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

� �� Handling input and output streams

These commands allow the user to lock and unlock the output into some �les� and tore�assign input and output streams to some other logical units�

Input stream

This command switches the logical unit of the current command input �le�

�iunit� �� idefunit� IN

where

iunit �if set� the �le attached to iunit channel becomes current input�le� If this value is not set� then the �le attached to default input

logical unit becomes current input �le� the default unit numberis to be set by the previous IN command�

idefunit �if set� speci�es new default input logical unit�

Copy�of�the�dialog stream

Initially there is no output into listing �le �i�e� �le to copy the �general type� inputand output during the session with the package�� To activate this kind of output� use acommand

�iunit� COPY

If iunit is set� the �le attached to this channel is used to store the listing� The outputto the listing �le may be locked using a command

NOCOPY

Graphical information stream

The packages uses graphical le to store low�resolution alphanumerical plots� This kindof output is initially unlocked� The user may lock it by the command

NOPLOT

and unlock by the command�iunit� PLOT

�if iunit is set� the �le attached to this channel is used to store the output��

Main output �dialog� stream

Initially the package responses �in text mode� are directed to the screen� The user maylock this output using a command

NOOUT

Page 108: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ��

In this case only the prompts will be received� To unlock this output stream� use thecommand

�iunit� OUT

�if iunit is set� the �le attached to this channel is used to store the output��The commands L� and L� are similar to the commands OUT and NOOUT� but

there are two vital di�erences�

� these commands behave themselves as �brackets�� To unlock the output� as manyL� commands must be entered as there were L� commands entered�

� these command may be used as options in the command string� thus an output ofthe command may be locked or unlocked partially�

The commands are especially useful in the batch procedures�

The syntax of these commands isL�

andL�

� �� Handling �les

This group of commands allows the user to perform simple operations with �les�

Assigning a �le to the channel

The command opens the speci�ed �le and assigns it to the channel�

iunit �istat� �iacc� AS �filespec�

where

iunit � Fortran logical unit number�istat � File status �ag values are�

istat ! �� � �le status is SCRATCHistat ! � � �le status is NEWistat ! � � �le status is OLD

Default value is istat ! ��iacc � Access �ag values are�

iacc ! � � access type is SEQUENTIALiacc ! � � access type is DIRECT

Default value is iacc ! ��filespec � �le name�

Rewind

To rewind the �le� use the command

iunitRW

where iunit is the logical unit number� �le is attached to that logical unit�

Page 109: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

Closing the �le

The �le may be closed by a command

iunitCF

where iunit is the logical unit number� �le is attached to that logical unit�

� �� Miscellaneous

The following commands are useful in the batch procedures�

Commentary card

The command REM is an �empty� command� It may be used to enter commentariesinto the procedures�

�iskip� REM �text�

If the value iskip � � is set� there will be iskip empty lines after that command in thelisting le provided the output into listing �le is activated�

�Display me� command

When a procedure is executed� the command lines from it are not displayed� The option

MES

allows the command line to be displayed �if the main output stream is not locked byNOOUT or L� commands��

Header

This command forms a �header� in the listing le

HEAD text

where text is the text of the header�

�� Low�resolution run�time graphics

This mode of graphical output is out�of�date� It creates alphanumerical low�resolutionplots �row�by�row� and�or prints values of the parameters in columns�

The plot is to be de�ned �rst using EDPL command�

�i�� i�� i�� EDPL ��destname��

�!

�sourcename

���

where

Page 110: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ��

i� � width of the plot in positions� Default is i� ! �� If i� � ��then there will be no graphical output�

i� � vertical grid will be plotted each i� positions� Default is i� !���

i� � horizontal grid will be plotted each i� positions� Default isi� ! �� Height of the plot depends on the amount of the datato be displayed�

destname � the plot description is to be cataloged� destname is the nameof the description in the catalog��

sourcename � the plot description is to be read from the catalog recordnamed sourcename�

� current description is used�

The execution of the command goes as follows�

�� � If both �)� or sourcename are omitted� the package read the description fromthe data cards�

First the package prompts for data cards describing the values to be plotted�The user must report parameter number� symbol to be used for plotting thisparameter� minimum and maximum values of the parameter and optionallythe coe�cient �the value of the parameter may be multiplied by this coe�cientbefore output�� Empty or blank data card terminates this part of the dialog�

Then the package prompts for data cards describing the values of the parame�ters to be printed to the right of the graphical �eld� Each data card comprisesthe number of parameter and optionally the coe�cient� Empty or blank datacard terminates the dialog�

� If sourcename is set then the description is read from the correspondingcatalog entry �note� that i�� i�� i� are not stored in the catalog entries��

� If �)� is set� the current description is kept� except for the i�� i�� i� values�

�� If the values i�� i�� i� are set� the default graphical �eld settings are replaced bythose entered�

�� If destname is set� the description is cataloged�

To initialize the catalog of descriptions or to delete all the entries� use the followingform of EDPL command

EDPL ! KILL

To activate this kind of the output� add the option

PL �! iout�

to the command line with main computing command �ST TR etc��� If iout ! � � thepicture is displayed on the screen only� If iout ! � � the picture will be written intographical le� If iout ! � then the picture will be displayed on the screen and written inthe �le simultaneously� Default is iout ! ��

Page 111: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

���� Saving a parameter vector as a procedure

When the data are to be transferred from task to task or from one computer to another�ordinary text �le is much more convenient than a direct access �le� That�s why thecommand is implemented that stores the parameter vector as a special procedure� Thesyntax of the command is

DUMP ��filespec��

where filespec is the name of the procedure to be created� the default name of the

procedure is DUMPP�The command saves current vector of parameters Y �all ��� values�� Later the

created procedure may be used to restore the parameter vector

���� User�de�ned scanning command with

low�resolution graphics

The command is similar to some other Krit scanning commands �see� for example�APRSL or ROLL commands�� but this one is programmed by the user�

The speci�ed region on the two�dimensional plane is scanned� the user�de�ned sub�routine ULABEL is called for each point� This subroutine returns marking characterfor the point in question�

As a result� one may get an alphanumerical low�resolution plot that shows��� �oneknows what��

The syntax of the command is as follows

lenx� ngridx� leny� ngridy �� iout� xmin� xmax� ymin� ymaxUSCN

where

lenx� leny � size of the plot in positions�ngridx� ngridy � vertical grid lines will be plotted each ngridx positions �

and horizontal grid lines will be plotted after every ngridypositions�

iout � if iout �! � then the plot will be written into the graphical�le� If iout �! � the plot will be displayed on the screen�Default value is iout ! ��

xmin and xmax � minimum and maximum values of the �rst component ofthe state vector �corresponding to the �rst and the lastpositions on the plot��

ymin and ymax � minimum and maximum values of the second componentof the state vector �corresponding to the �rst and the lastpositions on the plot��

The user must de�ne the subroutine ULABEL with the following parameters�

SUBROUTINE ULABEL �X�DX�Y�DY�LABEL�KOD�

CHARACTER���� LABEL

Page 112: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

where

X and Y � the coordinates of the current point on the plane�input values��

DX and DY � the horizontal and vertical distance between ad�jacent points on the plane �input values��

LABEL � LABEL����� is a marking label �output value��

KOD � on input � the number of the point in the cur�rent row� The �rst point of the �rst row isindicated by the value KOD���

on output� KOD�� requires the point on the plotto be marked with LABEL� If KOD��� the pointis not marked � this enables to preserve gridlines��

���� �Empty� command

Sometimes one needs to print or plot or store into �le something without making anycalculations� This was a di�cult situation for the previous version of the package� sincethe output operations usually are performed while doing calculations� Now an �empty�command is added �

NOP

This command does nothing by itself� but it allows the output operations �set byvarious options� to be performed�

���� Task transfer from CAD Dynamics ���

Dynamics package for studying aircraft dynamics� control system design and �ight sim�ulation is rather popular in this country� The joint e�ort of the Dynamics and Krit

authors resulted in a simple task transfer procedure from Dynamics package to Krit �If a task has been prepared using Dynamics package tools �including bank subsystem

if necessary�� then the sequence of activities to make Krit executable �le is as follows�

�� First all the operations necessary to assemble the task according to Dynamics rulesare performed� In the L subsystem ordinary commands are used� At the �nal stageof assembly i�e� in the C subsystem the command MGM is to be used instead ofusual MRM command� syntax of the command is the same�

If bank subsystem is used� then it is necessary to rebuild Fortran language �le withbank data interpolation subroutines during assembly stage� This means that usermust reply �YES� to the prompt �Necessary �� when executingMGM command�

Page 113: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

�� The batch command �le preps�bat from directory nVKnBAT is called �on theDOS prompt�� It creates Krit executable �le using source modules made byDynamics package� The syntax is as follows

preps FUNCmodule RHSmodule �bankmodule�

where

FUNCmodule � name �without an extension� of the Fortran module con�taining FUNC subroutine� This name has been men�tioned as the �rst parameter in the MGM command�subsystem C of Dynamics package��

RHSmodule � name �without an extension� of the Fortran module con�taining the auxiliary subroutine needed for computationof the right�hand sides of the equations� This name hasbeen mentioned as the parameter in the CS command�subsystem L of Dynamics package��

bankmodule � name �without an extension� of the Fortran modulecontaining interpolation subroutines necessary to accessbank data� This name has been mentioned as the sec�ond parameter in the MGM command �subsystem C ofDynamics package��

As a result� executable �le FUNCname�exe will appear in the current directory�

�� If bank subsystem is used� then binary �le containing bank data is to be placedinto current directory� The name of the data �le is bankname�

� The placement of the parameters in the parameter array Y is prede�ned by thetask structure in the Dynamics package� The parameters are located in the Yarray in the following order�

� state variables as set in Dynamics package go �rst�

� constants �in the sense of Dynamics package��

� �exits��in the sense of Dynamics package��

Each subgroup comprise the same elements and in the same order as in Dynamics

package�

Example

Suppose that a task is de�ned in Dynamics package so that it has two state vari�ables F� and F�� three constants C�� C�� C� and two exits E� and E�� Aftertransfer to the Krit package� the following table of Krit parameters is to be used

parameter number � � � � � � parameter � F� F� C� C� C� E� E�

Page 114: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER � ADVANCED TOPICS ���

�� To prepare a job while working with Krit package� the command JOB�n� must beexecuted� where n is the order of the system of equations �same as in the Dynamicspackage� � For the example given above n ! ��

Note� To use the features of Dynamics package described above� the specially updatedversion of that package is to be installed� Contact the authors of Dynamics package forfurther information�

Page 115: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Chapter �

Programming batch procedures

Batch procedures are intended for experienced Krit users� They allow the user to�expand� the language with his own commands� Many routine operations may be elim�inated�

Of course� Krit command language is not a full�scale programming language� Butsince there are conditional operators� jumps and loops� the user can prepare complexinvestigation procedures�

Krit procedure is a �le with Krit commands� There are some rules and restrictionsconcerning procedures� The procedure is activated when a name of the �le �comprisingprocedure� is mentioned in the options� keyword �eld� the name of the �le must di�erfrom the names of Krit built�in commands� Procedures may be nested� Recursive callsare allowed� Procedure may have arguments�

�� Calling a procedure

When the package �nds an option with name that di�ers from the names of built�incommands� it tries to start a procedure �le with corresponding name� At �rst the packagesearches for the �le in the directory for user procedures �the current directory by default��If unsuccessful� it tries to �nd the �le in the directory for common procedures �defaultname of that directory is �VK�PRO on current drive�� The names of these directories canbe changed using the �ags �U and �P when staring the program�

Note that the package will always proceed to the next command line after returnfrom the procedure� So the procedure must be the last option in the command to beexecuted�

There are two ways of calling a procedure�

�� �common� by name� as described above�

����� � procname �����

where procname is the name of the �le with the procedure�

��

Page 116: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

�� �special� call to a procedure located in the �common procedures� directory maybe performed using a command

�data field� X �procname� �����

where procname is the name of the �le with the procedure� and in this case thisname may coincide with the names of built�in commands and procedures fromcurrent directory�

Note� that if the requested �le doesn�t exist then a fatal error occurs�

�� Procedure layout

First of all� remember that �rst symbol of each input line read from procedure is ignored�The user may place there any symbol� and to mark it with corresponding prompt sign is agood idea� So� in Krit procedures commands are entered from the ��nd position�

The procedure begins with a command that identi�es the �le as a procedure

%PROC �text�

where% � occupies the ��st position and is ignored on inputtext � optional arbitrary text� usually the name of the procedure

The most vital rule� To exit procedure properly� the command or option

PEND

is to be executed� The alternative is to �nish session with Krit package using ENDcommand� The last line of the procedure must be either PEND or END command�

�� Procedures with arguments

Krit procedures may have arguments� The name of the argument starts with percentsign and may include letters� digits and underscore sign� The examples of valid nameare

%I� %ARG� %Y�� VALUE

There are user�de�ned arguments and prede�ned ones� the latter may get their valueafter analysis of the calling command� When procedure is activated� the package makes acopy of it and substitutes the arguments with their values in all the lines of the procedure�If there are unde�ned parameters� when the package will do the following

� if the procedure is called by interactive user then the user will be prompted for themissing values� the prompt is in the form

%argument name #

Page 117: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

� if the procedure is called from some other procedure� then the package will try toread missing values from the successive lines of the calling procedure�

One can enter the arguments of the procedure in the same command line from whichprocedure is called� The following string is to be placed in the auxiliary �eld of thecommand �i�e� in the �eld separated from options� �eld with blank symbol�

!name� ! value� �� !name� ! value�� � � ��

where namei is a name of an argument without percent sign� and valuei is a value ofthat argument� The order of the arguments in the string is arbitrary�

����� Prede�ned arguments

When a procedure is started� the package de�nes a number of arguments with standardnames using the results of the syntax analysis of the calling command� The integer andreal values from the command data �eld are passed� Also� the auxiliary data �eld isconsidered as a list with tokens separated with blank symbols�

The arguments are listed in table ��

name meaning�ARG� � number of tokens in the auxiliary �eld of the command�

This argument is always de�ned�%ARGi � contains the i�th token from auxiliary �eld� The argument

%ARG� is always de�ned� default value is blank symbol�Other arguments of this type are de�ned only if they reallyexist�

�ARGE � contains the auxiliary data �eld except for the �rst token�i�e� the tail of the list�� This argument is always de�ned�default value is blank symbol�

�I� � number of integers in the data �eld of the calling command�The argument is always de�ned�

%Ii � contains the value of i�th integer from the data �eld� Theargument is de�ned only if the integer value really exists�

�R� � number of real values in the data �eld of the calling com�mand� The argument is always de�ned�

%Ri � contains the value of i�th real value from the data �eld� Theargument is de�ned only if the value really exists�

Table ��� Prede�ned arguments

As usual� the package will try to get the unde�ned arguments from current inputstream if there are any�

Page 118: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ��

�� Loops and jumps

Jumps

Krit command line may be labelled� To do so� there must be an option in the options��eld

LBL�label�

where label is an arbitrary string of symbols used as a label�The jump to the labelled command line in the procedure is done by means of option

GOTO�label�

where label is string of symbols used as a label somewhere in the procedure �in the LBLcommand�� Only jumps within current procedure are possible�

There is another jump command� It allows to skip a number of lines �not commands��in the current procedure� The syntax of the command is

SKIP�n�

where n is the number of lines to be skipped� If n � � then there is a forward jump�otherwise backward jump takes place�

Testing conditions

Jump commands are useful when used together with a command that tests a certaincondition� The command is

ON�condition�

The allowed condition codes see in table ���

Usually the ON command is used as follows

� � � �ON�condition��Other options

Other options will be executed if condition is valid� There may beGOTO option amongOther options�

How to make structured loop

DO�loop in Krit package is programmed as follows

������nstep �� i�� r�� � � � � �� ik� rk� DO������ENDDO������

where

Page 119: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

code meaningS � previous command terminated normallyF � previous command terminated with errorEOR � previous command terminated with �state variable or param�

eter is outside allowed region� errorFAIL � previous command terminated with error because the algo�

rithm failed to converge using allowed number of iterationsST � solution is stableSA � solution is saddle�type i�e� there is one real unstable eigenvalue�

DV � solution is oscillatory unstable i�e� there is one unstable com�plex pair of eigenvalues�

UN � solution is unstable� but not oscillatory or saddle�type�NO � the stability type of the solution was not de�ned�GE � the result of the last arithmetic command is greater or equal

to zero�GT � the result of the last arithmetic command is greater than zero�

LE � the result of the last arithmetic command is less or equal tozero�

LT � the result of the last arithmetic command is less than zero�EQ � the result of the last arithmetic command is equal to zero�NE � the result of the last arithmetic command is not equal to zero�

Table ��� Condition codes

Page 120: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ��

nstep � number of iterationsik� rk � if set� then after each iteration the value of Y �ik� will be

incremented by rk�

Structured DO�loops can be used only in procedures� DO�loops may be nested�Jumps across loop boundaries are not allowed� To break the execution of the �deepest�loop� one may use the option

EXIT

Attention� No data cards are allowed within procedures containing structured DO�loops �that�s due to some Krit internal peculiarities��

IF option

The power of Krit calculator is used to make programming of jumps more convenient�The syntax of the option is�

IF �expression�

where expression is a valid expression for calculator� Note� that here symbols " and #

are the elements of the command string�The options is processed successfully if the value of the expression is greater then

zero� Otherwise the processing of the whole command is terminated�

Comparing character strings

The CSS option allows the user to compare two character string �for example� the valueof argument and some pattern string�� The syntax of the command is�

CSS �string�WITH �pattern�

where string and pattern are two strings to be compared�The option is processed successfully if the strings are identical� Otherwise the pro�

cessing of the whole command is terminated�

����� Ask�the�user commands

A pair of commands INQ and CSI allows the procedure to ask the user and to workfurther depending on the reply�

The INQ command displays �optionally� a message and then waits until the userenters some character string followed with Enter key�

INQ �message�

The reply is stored somewhere inside the package� It may be compared with a patternstring using CSI command�

CSI �pattern�

The option is processed successfully if the strings are identical �if the user�s replyis longer that the pattern string� it is truncated to the length of the pattern string��Otherwise the processing of the whole command is terminated�

Page 121: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

�� Miscellaneous

���� Displaying messages � ECHO command

It is very useful command� that allows the used to output the results and messages� Thesyntax of the command is�

ECHO �message�

The output by means of ECHO command cannot be locked with L� commands�If ANSI driver is installed� the user may use escape sequences to make the output

more good�looking� Use the ECHO command to output the sequences�

���� Waiting for a keystroke

This feature is sometimes useful for demonstrations� The command

PRESSKEY

stops the execution of the procedure until some key on the keyboard is pressed�

���� Displaying the procedures� commands

By default� when the user runs the procedure� the commands of the procedure are�invisible� i�e� they are not displayed on the screen� You may change such a behaviourof the package using E� command �

E�

After that command all the commands �but not the data cards�� will be displayedon the screen� To restore the default� use the command �

E�

� Accuracy test

Some advanced batch procedures need a command that checks if a vector is an equilib�rium �or periodic� solution� The syntax of the command is as follows

�iout� �� acc� COMP

���XXP

���

where

Page 122: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

iout � if iout is set� then the message about the current error val�ue �actual accuracy of the solution� for the vector will bedisplayed�

acc � the actual accuracy is compared with acc� By default� accequals the default accuracy �

X or XP � the name of the data array� By default� the X vector isselected�

If name X is assumed� then the test for X vector for beingan equilibrium solution is performed� Otherwise the test forXP vector for being �xed point of mapping is performed�

If the given vector satis�es to the convergence condition �i�e� the speci�ed accuracyis reached�� then the command terminates successfully� Otherwise the commands endwith error�

� How to use a parameter value as a data �eld

value

If you need to use a value of some parameter as real or integer value in the certainposition in the data �eld of the command� you may use the options I and R�

Note� that these options are executed as ordinary options i�e� the options standingin front of them in the command line will not feel their presence�

����� Parameter as integer value in the data �eld

The syntax of the option is+I�npar �� npos� �

wherenpar � number of parameter to be converted�npos � the position of the value among other integer values in the

data �eld� By default� the value INT �Y �npar�� is addedto the list of integer values�If npos is set� the corresponding value is placed in this posi�tion� and the length of the list is adjusted if necessary� Note�that if there is some integer value in the npos�th positionalready� then this value will be replaced with a new one�

����� Parameter as real value in the data �eld

The syntax of the option is+R�npar �� npos� �

where

Page 123: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

npar � number of parameter to be converted�npos � the position of the value among other real values in the data

�eld� By default� the value Y �npar� is added to the list ofreal values�If npos is set� the corresponding value is placed in this po�sition� and the length of the list is adjusted if necessary�Note� that if there is some real value in the npos�th positionalready� then this value will be replaced with a new one�

�� �Stacks�

There is a special storage area in the status�keeping �le intended for keeping state vectorsusing stack technique� There are two stacks� X�stack and XP�stack� each can store upto �� vectors� The X�stack can interact with X vector and with the matrix of solutionsformed by STSSNE command� The XP�stack interact with XP vector� The statevectors are stored and restored in stacks with their stability code �by default the codeis calculated using full jacobian matrix when the solution is stored��

This feature may be useful in some complicated batch procedures� It is not recom�mended for novice users�

�� �� Stack initialization

Stack is initialized by the command

SORG

���XXP

���

where

X or XP � the name of the stack� By default� the X�stack is selected�

�� �� Getting vector from stack

To get the vector stored in the stack� use a command

�irec� �� ierr� SGET

���XXP

���

where

irec � Number of the record in the stack� It is used for directaccess to the vectors inside the stack� By default� the next

vector is read�ierr � if set� allows to display error messages�X or XP � the name of the stack� By default� the X�stack is selected�

The destination is X or XP vector correspondingly�

The command does not a�ect the stored vectors� The pointer after operation ismoved forward� If the vector requested is missing� the command terminates with error�

Page 124: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

The command

�SGET

���XXP

���

may be used to rewind the stack �i�e� reset the stack pointer��

�� �� Loading vector into stack

The vector is loaded into stack using the command

�istb� SPUT

���XXP

���

where

istb � if set� the stability code is not calculated �the current valueof the stability code is stored��

X or XP � the name of the stack� By default� the X�stack is selected�The source of the data is X or XP vector correspondingly�

The vectors are compared with existing ones before loading� If there exists a vectorthat di�ers less than one DX value �for every component of the state vector�� thecommand terminates with error�

The new vector is always appended to the existing ones despite the position of thestack pointer�

If there is no room for a new vector� the command terminates with error�

�� �� Loading SSNE solutions into stack

The vectors from the stack of solutions formed by STSSNE command� may be movedinto stack using a command

SMOV

���XXP

���

where

X or XP � the name of the stack� By default� the X�stack is selected�

The vectors are compared with existing ones before loading� If there exists a vectorthat di�ers less than one DX �DXP� value �for every component of the state vector��the command terminates with error�

� Composed output string

Usually the user applies standard Krit output commands and gets standard messages�But for experienced men there is a possibility to form their own output strings using aset of special commands�

The output string is formed in special internal memory� The user can display it as awhole or partially�

Page 125: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ��

����� Entering text into the string

To enter some text into the string� execute

�istart� �� irep� SL �text�

whereistart � initial position in the string� Default value is istart ! ��irep � number of copies of the input text to be placed into the

string� Default value is irep ! ��text � the text to be placed into the string� If omitted� the blank

character �of length �� will be used�

The command places irep copies of the text text �or irep blank characters� succes�sively into the string� starting from the istar�th position in the string� The command inthe form

�� ��SL

may be used to clear the string ��rst �� positions��

����� Entering integer value into the string

Integer value is formatted and written into the string using the command

ival �� istart� �� ilen� IL

whereival � integer value to be placed into the string �in the way similar

to Fortran output using format I��istart � initial position in the string� Default value is istart ! ��ilen � ilen is the length of the �eld allocated for the value� Default

is ilen ! ��

����� Entering real value into the string

Real value is formatted and written into the string using the command

rval �� istart� �� ilen� �� idig� RL

whererval � real value to be placed into the string �in the way similar to

Fortran output using format G��istart � initial position in the string� Default value is istart ! ��ilen � ilen is the length of the �eld allocated for the value� Default

is ilen ! ���idig � idig speci�es how many signi�cant digits are needed after

decimal point� Default is idig ! ��

Page 126: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

CHAPTER �� PROGRAMMING BATCH PROCEDURES ���

����� Output of the string formed

The string formed is displayed using a command

�istart� �� len� WL

whereistart � initial position in the string� Default value is istart ! ��len � Length of the �eld in the string to be displayed� Default

value is irep ! ���

The command displays the �eld from the string� Field begins in the istart�th position�the length of the �eld is len�

Page 127: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

List of Krit commands and options ���

Supplement� List of Krit commands and options

Now there are ��� Krit built�in commands and options �note� that all these commands�names use only upper�case letters�� Below is the full list of the commands and options�

� there are �� one�character commands�

L U S I B V R X

� Y

� there are two�characters commands�

ST CO TR AC RC RT RF KP

EP MX VC T� TE DT PX ED

RW EX PL LJ IN AS CF ON

LI DO MO Y� Y� Y� Y� Y

Y Y$ Y� %I %R L� L� E�

E� IF SL IL RL WL MV

� there are � three�characters commands�

REM RTN GEN EXS SEP CSF RAD RK

TRP TMX ITR BIF JOB END ACS OUT

LJE LJM LJ ACM MES LBL ATR TFX

Y�� SQR SIN COS ABS INV TAN CSI

RCD MML STB VRT CSS VTY BRP HMI

HMA GIR LPR INK SCS INQ CLS NOP

� there are four�characters commands�

EDIT EDPL SSNE ADMS TRMC NOMX NEWT HOMO

RTNP REST INIT NOPX NOED COPY PLTY USCN

HEAD SAVE EDAR PEND PROC SKIP GOTO COMP

SORG SGET SPUT SMOV EXIT PLOT ASIN ATAN

ROLL ECHO VRTA SHOW CUSP WRTY CLTY SHUT

DUMP GEPS TRPP LPTS VISU DRAW GENS

� and there are � commands with names longer than characters�

JACOBY MNEMO RTNSEP NOCOPY NOOUT EDPLTY APRSL SINIT

SENSE XSORG NOPLOT ENDDO COTAN EDMML NOINI SAVEA

SEPLT BIFSAW NOVTY SETRAD RTNVOL EDSCS REPEAT PRESSKEY

Page 128: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Bibliography

��� Poincar(e� Henri � Analysis Situs� J� d�Ecole Polytechnique Normale �������

��� V�I�Arnold �Additional chapters of the theory of Ordinary Di�erential Equations��Nauka publ�� Moscow� � � �in Russian��

��� Yu�I�Neymark �Method of point mapping in the theory of nonlinear oscillations��Nauka publ�� Moscow� � � �in Russian��

�� M�G�Goman �Di�erential method for continuation of solutions to systems of �nitenonlinear equations depending on a parameter�� Uchenye zapiski TsAGI� vol� XVII�no��� ��� �in Russian��

��� M�G�Goman� A�V�Khramtsovsky �Calculation of a boundary of asymptotic stabil�ity region of dynamic system�� Uchenye zapiski TsAGI� vol� XXI� no��� �� �inRussian��

��

Page 129: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

Index

A arithmetic function� �Abort signal� ��ABS

arithmetic function� �command�

AC command� ��� ��accuracy� ��� �ACM command� �� ��ACS command� �ADMS command� ��� � ALOG arithmetic function� �AMAX arithmetic function� �AMIN arithmetic function� �AMPL arithmetic function� ��AND� operator� �APRSL command� �arguments de�ned on command line� ��arguments of the procedures�ARGE� ��%ARGi� ���ARG�� ��%Ii� ���I�� ��%Ri� ���R�� ��

arithmetic commandsABS� ASIN� ATAN� COS� COTAN� INV� �SIN� SQR� TAN� Y�� Y��

Y�� Y�� Y��� Y�� Y�� Y�� Y��

arithmetic expression� �arithmetic functions� �A� �ABS� �ALOG� �AMAX� �AMIN� �AMPL� �ATAN� �ATAN�� �B� �BUF� �C� �COS� �COTAN� �D� �DEG� �DX� �DXP� �DXRK� �DXS� �EXP� �F� �FUNC� �INV� �KEY� �LY� �MEAN� �RAD� �SAN� �

���

Page 130: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ��

SIGN� �SIN� �SQRT� �SX�� �SY� �TAN� �W� �WI� �WR� �X� �XAN� �XB� �XB�� �XB�� �XGOM� �XLOW� �XMA� �XMI� �XOGR� �XP� �XPL�� �XPL�� �XRK� �XS� �XSF� �XUPP� �Y� �

arithmetic operator �special�! � ��AND�� ��EQ�� ��GE�� ��GT�� ��LE�� ��LT�� ��NE�� ��NOT�� ��OR�� �

array �see also data array�of parameters� ��

AS command� ���ASIN command� ATAN

command� arithmetic function� �

ATAN� arithmetic function� �ATR command� ��� ��AUTOEXEC�BAT �le� ��auxiliary �eld of the command� �

B arithmetic function� �B command� ��

special SSNE form� � B �ag� ��BIF command� �� ��

special notes� �� �bifurcations� ��

codimension two� �branching point� �BRP command� �

special notes� �BUF arithmetic function� �

C arithmetic function� �C data array� CF command� ���CLS command� ��CLTY command� �COCO command� ��

solution continuation� ��� ��COBIF command� ��

one�parameter search� ��two�parameter search� ��bifurcational curve� ��

commandAuxiliary �eld� �Commentary �eld� �Data �eld� �Options� �eld� �

commands of the package I option� �� R option� ��ABS� AC� ��� ��ACM� �� ��ACS� �ADMS� ��� � APRSL� �AS� ���

Page 131: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ���

ASIN� ATAN� ATR� ��� ��B� ��� � BIF� �� �� �� ��BRP� �CF� ���CLS� ��CLTY� �CO� ��COBIF� ��COMP� ���COPY� ��� ��COS� COTAN� CSI� �� CSF� ��CSS� �� CUSP� �DO� �� ���DRAW� ��DT� ��� � DUMP� ���E�� ���E�� ���ECHO� ���ED� ���EDAR� �� � EDIT� �� ���EDPL� ���EDPLTY� �� ��EDSCS� ��END� ���ENDDO� ���EP� �� �� �� ��EX� � ��EXIT� �� EXS� � ��GEN� GENS� ���GEPS� ��GIR� � GOTO� ���HEAD� ���HMA� ��

HMI� ��HOMO option� ��I� ��� ��IF� �� IL� ���IN� ��INIT option� � ��INK� �INV� INQ� �� ITR� ��� ��JACOBY option� �JOB� ��� ��� �JOB��� �KP� ��L� �LBL� ���LI� ��LJ� ��LJE� ��LJM� ��LPR option� ��LPTS� ��L�� ���L�� ���MES� ���MNEMO� ��MNEMO�KILL� ��MNEMO��� ��MO� �MV� �MX� ���NEWT option� �� �� �� �� ���

��NOCOPY� ��NOED� ���NOINIT option� ��NOMX� ���NOOUT� ��NOP� ��NOPLOT� ��NOPX� ���NOVTY� �ON� �� ���OUT� ���

Page 132: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ���

PEND� ���PL option� �� PLOT� ��PLTY option� ��PRESSKEY� ���PROC� ���PX� ���R� ��RAD� �RC option� ��� ��� �� RCD option� ��REM� ���REPEAT� �REST option� ��� ��RF� ��� ��RK�� � RL� ���ROLL� RT option� ��� ��� �� RTN� �RTNP� ��� �RTNSEP� RTNVOL� �RW� ���S� ��SAVE� � SAVEA� � SCS option� ��SEP� � ��SEPLT� ��SETRAD� ��� ��SGET� ���SHOW� SHUT option� ��SIN� SINIT� SKIP� ���SL� ���SMOV� ���SORG� ���SPUT� ���SQR� ST� ��� �STBIF� �� �STBRP� ��

STCUSP� �� �STHOMO� ��STSENSE� �STSSNE� � � ��STB option� ��TAN� TE� �� ��� � � �TFX� ��TMX� ��TR� ��TRP� ��TRPP� �T�� � U� ��USCN� ���V� ��VC option� �VISU� ��VRT� ��VRTA� ��VTY� ��� �WL� ���WRTY� �X� ���XSORG� ��� ��Y� �Y�� Y�� Y�� Y�� Y��� Y�� Y�� Y�� Y�� �� �� ��� �� � �

commentary �eld of the command� �COMP command� ���condition codes� ���DV� ���EOR� ���EQ� ���F� ���FAIL� ���

Page 133: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ���

GE� ���GT� ���LE� ���LT� ���NE� ���NO� ���S� ���SA� ���ST� ���UN� ���

Control�C signal� ��Control�X signal� ��COPY command� ��� ��COSCOS arithmetic function� �COS command�

COTANCOTAN arithmetic function� �COTAN command�

CSI command� �� CSF command� ��CSS option� �� CUSP command� �cvt utility� ��

D �ag� ��D arithmetic function� �data array

of parameters� ��C� DX� ��

usage� ��DXP� �� �DXS� �� �� ��DY� ��F� �� ��LY� ��SAN� �� � SX�� �� � X� ��XAN� �� �XB� �� ��XB�� �� ��XOGR� �XP� �� ���

XRK� �� ��� � XS� �� XSF� �� �� ��Y� ��YMAX� ��YMIN� ��

data �eld of the command� �DEFADIR macroparameter� �de�nition of the system� ��DEG arithmetic function� �DO command� �� ���DO�loop� ���DOSDATE macroparameter� �DOSTIME macroparameter� �DRAW command� ��DT command� ��� � DUMP command� ���DV condition code� ���DX arithmetic function� �DX vector� ��

usage� ��DXP arithmetic function� �DXP vector� �

usage� �DXRK arithmetic function� �DXS

vector� �� �� ��arithmetic function� �

DY data array� ��

E� command� ���E� command� ���ECHO command� ���ED command� ���EDAR command� �� � EDIT command� �� ���EDPLEDPL command� ���EDPL�KILL command� ��

EDPLTY command� �� ��EDSCS command� ��END command� ���ENDDO command� ���environment variablesKRITTMP� ��

Page 134: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ���

TMP� ��EOR condition code� ���EP command� �� �� �� ��EQ condition code� ����EQ� operator� �ESC

signal� �� ��� ��buttton� ��� �

EX command� EX�KILL command� EX�� command� add entry� full syntax� ��using submatrix�

executable �le� making� ��EXENAME macroparameter� �EXIT command� �� EXP arithmetic function� �expression�to�integer macroparam�� expression�to�real macroparameter� EXS command�

add entry� full syntax� ��

Farithmetic function� �vector� �� ��condition code� ���

FAIL condition code� ���FastGraph package� ���leAUTOEXEC�BAT� ��SYSTEM�LOG� � �le nKRITPIQT����� ��graphics information �le� �

�ags for EXE��le� S� �� L� �� G� �� B� �� D� �� P� �� U� �� Z� �� I� ��

FULL �ag� FUNC

arithmetic function� �subroutine� ��

G �ag� ��GE condition code� ����GE� arithmetic operator� �GEN command� GENS command� ���GEPS command� ��GIR command� � GOTO command� ���Grapher package� ��graphics information �le� �GT condition code� ����GT� arithmetic operator� �

HEAD command� ���HMA command� ��HMI command� ��HOMO option� ��

I command� ��interactive form� ��

I �ag� ��ICTR macroparameter� �IF option� �� IL command� ���IN command� ��INIT option� � ��INK command� �INSTALL� INQ command� �� INV

arithmetic function� �command�

ITR command� ��� ��

JACOBY option� �job

automatically created formulas� ��de�nition� ��JOB command� ��� ��� �JOB�� command� �simpli�ed form� ��

Page 135: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ��

syntax of the data card� ��keeping de�nitions� �

K�fold iterated mapping� ��KEY arithmetic function� �keyword �eld of the option� �KP command� ��nKRITPIQT���� �le� ��KRITTMP environment variable� ��

L command� � L �ag� ��LBL command� ���LE condition code� ����LE� arithmetic operator� �LI command� ��LJ command� ��LJE command� ��LJM command� ��LPR option� ��LPTS command� ��LT condition code� ����LT� arithmetic operator� �LY

data array� ��arithmetic function� �

L� command� ���L� command� ���

macroparameters�DEFADIR� �DOSDATE� �DOSTIME� �EXENAME� �expression�to�integer� expression�to�real� ICTR� �NSYS� �PROCDIR� �SYSTDIR� �TIME� �WORKDIR� �

macroprocessing� �making an executable �le� ��mapping� ��

T�advance mapping� ��

K�fold iterated mapping� ��MEAN arithmetic function� �MES command� ���MNEMO command� ��MNEMO�KILL command� ��MNEMO�� command� ��

MO command� �MV command� �MX command� ���

NE condition code� ����NE� operator� �NEWT option� �� �� �� �� ��� ��NO condition code� ���NOCOPY command� ��NOED command� ���NOINIT option� ��NOMX command� ���NOOUT command� ��NOP command� ��NOPLOT command� ��NOPX command� ����NOT� operator� �NOVTY command� �NSYS macroparameter� �

ON command� �� ���usage� ���

options� �eld of the command� �option�s� �see also commands�

keyword �eld� �value �eld� �CSS� �� I� ��IF� �� R� ��HOMO� ��INIT� � ��JACOBY� �LPR� ��NEWT� �� �� �� �� ��� ��NOINIT� ��PL� �� PLTY� ��RC� ��� ��� ��

Page 136: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ���

RCD� ��REST� ��� ��RT� ��� ��� �� SAVE� � SAVEA� � SCS� ��SHUT� ��STB� ��STB�NO� ��VC� �VRT� ��VRTA� ��

�OR� operator� �OUT command� ���

P �ag� ��packages

��G package� ��FastGraph package� ��Grapher package� ��

PEND command� ���PI arithmetic constant� �PL option� �� PLOT command� ��PLTY option� ��prep � ��preps batch �le� ���PRESSKEY command� ���PROC command� ���PROCDIR macroparameter� �PX command� ���

R command� ��RAD

command� �arithmetic function� �

Rafson coe�cient� ��� ��RC option� ��� ��� �� RCD option� ��REM command� ���REPEAT command� �REST option� ��� ��RF command� ��� ��RK� command� � RL command� ���

ROLL command� RT option� ��� ��� �� RTN command� �RTNP command� ��

full syntax� �RTNSEP command�

extended form� RTNVOL command� �RW command� ���

Scommand� ��condition code� ���

S �ag� ��SA condition code� ���SAN

vector� �� � arithmetic function �

SAVE command� � SAVE�generated �les� processing� SAVEA command� � SCS option� ��SEP command�

full form� ��SEPLT command� ��SETRAD command� ��� ��SGET command� ���SHOW command� SHUT option� ��SIGN arithmetic function� �signals�Abort� ��Control�C� ��Control�X� ��ESC� �� ��� ��

SINarithmetic function� �command�

SINIT command� SKIP command� ���SL command� ���SMOV command� ���SORG command� ���SPUT command� ���SQR command�

Page 137: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ���

SQRT arithmetic function� �SSNE command� �� � � ��� �ST

condition code� ���ST command� ��� �STBIF command� �

bifurcational curve� �one�parameter search� �two�parameter search� �STBRP command� �

dependence curve� one�parameter search� �two�parameter search� STCUSP command� �

two�parameter search� �three�parameter search� �bifurcational curve� �STHOMO command� ��STSENSE command� �STSSNE command� �

full syntax� ��usage of B command� � work with stack� ���

stability code� storage as parameter� ��stability message� stacksX�stack� �� ���XP�stack� ���

starting a program� ��STARTUP�COM procedures� � state vector�s�� ��DX� ��� ��DXP� �� �DXS� �� �� ��F� �� ��SAN� �� � SX�� �� � X� ��XAN� �� �XB� �� ��XB�� �� ��XP� �� ���XRK� �� ��� � XS� �� XSF� �� �� ��

STB option� ��STB�NO option� ��subroutine

user supplied� ��FUNC� ��ULABEL� ���

SX�vector� �� � arithmetic function� �

SY arithmetic function� �SYSTEM�LOG �le� � SYSTDIR macroparameter� �

T�advance mapping� ��TAN

arithmetic function� �command�

TE command� �� ��� � � �TFX command� ��TIME macroparameter� �TMP environment variable� ��TMX command� ��TR command� ��TRP command� ��TRPP command� �T� command� �

U command� �� U �ag� ��ULABEL user�de�ned subroutine� ���UN condition code� ���USCN command� ���user supplied subroutine� ��utilitiescvt� ��visu�exe� �

V command� ��value �eld of the option� �VC option� �vector�s�

state� ��VISU command� ��VISU�EXE utility� �� �VRT command� ��VRTA command� ��

Page 138: M.G.Goman, A.V.Khramtsovsky (1993) - KRIT User Guide

INDEX ��

VTY command� ��full syntax� �

Warithmetic function� �calculator data array� �

WI arithmetic function� �WL command� ���WORKDIR macroparameter� �WR arithmetic function� �WRTY command� �

Xcommand� ���state vector� ��

work with stack� ���X�stack� ���

with APRSL� �arithmetic function� �

XANvector� �� �arithmetic function� �

XBvector� �� ��arithmetic function� �

XB�vector� �� ��arithmetic function� �

XB� arithmetic function� �XGOM arithmetic function� �XLOW arithmetic function� �XMA arithmetic function� �XMI arithmetic function� �XOGR

data array� �arithmetic function� �

XPstate vector� �� ���

work with stack� ���XP�stack� ���arithmetic function� �

XPL� arithmetic function� �XPL� arithmetic function� �XRK

vector� �� ��� �

arithmetic function� �XS

vector� �� arithmetic function� �

XSFvector� �� �� ��arithmetic function� �

XSORG command� ��� ��XUPP arithmetic function� �

Yarithmetic function� �data array� ��� ��Y command� �

YMAX data array� ��YMIN data array� ��Y� command� Y� command� Y� command� Y� command� Y�� command� Y� command� Y� command� Y� command� Y� command�

Z �ag� ��

��G package� ��! arithmetic operator� �� command� �� � �� command� �� � I option� �� R option� ���ARGE argument� ��%ARGi argument� ���ARG� argument� ��%Ii argument� ���I� argument� ��%Ri argument� ���R� argument� ��