This readme gives small comments on the r-files and on the sequence in
which to run them. For details please check the handouts, the manual,
the lecture notes on http://indy.cs.concordia.ca/auto
If there are problems drop us an email. We will correct bugs.

Input that has to come from the user starts with a $ (which mimicks
the commmand line and has NOT to be typed).
This directory contains the Bazykin predator-prey model that can be
found in Kuznetsov's text book.

FORTRAN source: baz.f
primary continuation parameters: 1 and 2 (corresponding to alpha and
delta in the book)

This directory contains all 
r-files, 
p-files,
the f-file, 
most q-files (except the very long ones), 
this readme.txt and 
the script run-all that runs through all runs at once. 
Please be aware that labels may depend
on the accuracy of your machine, which would require adjustment of
subsequent r-files.

Jan Sieber

first run: equilibria for delta=0
name of r-file: r.baz.delta-eq-0
constants to care about (apart from the usual suspects) 
DS, DSMIN: small in order not to miss the first Hopf point
NMX: large, because DS is small
RL0, RL1

$ @R baz delta-eq-0
Starting baz ...

  BR    PT  TY LAB    PAR(1)        L2-NORM         U(1)          U(2)
   1     1  EP   1  0.000000E+00  1.407160E+00  1.000000E+00  9.900000E-01
   1     6  HB   2  1.020625E-02  1.421598E+00  1.010312E+00  1.000105E+00
   1   579  HB   3  9.797938E-01  5.544456E+01  4.948969E+01  2.499740E+01
   1  1159  BP   4  9.900000E-01  9.999999E+01  9.999999E+01  7.536678E-06
   1  1500  EP   5  9.917783E-01  1.244411E+02  1.216287E+02 -2.630678E+01

$ @sv delta-eq-0
Saving fort.7 as p.delta-eq-0 ... done
Saving fort.8 as q.delta-eq-0 ... done
Saving fort.9 as d.delta-eq-0 ... done

second run: periodic solutions, starting from point 3
name of r-file: r.baz.delta-eq-0-per
this run takes a while and
fails at some point because periodic solutions make large excursions
constants to care about
IRS 3
NTST as large as possible (maximum set in $AUTO_DIR/include/auto.h)

$ @R baz delta-eq-0-per delta-eq-0
Starting baz ...

  BR    PT  TY LAB    PAR(1)        L2-NORM       MAX U(1)      MAX U(2)       PERIOD
   3    63  LP   6  9.795577E-01  8.529348E+01  9.941103E+01  2.553385E+01  4.986859E+02
   3   300       7  9.761620E-01  9.727692E+01  1.000000E+02  2.642763E+01  1.636885E+03
   3   600       8  9.713101E-01  9.722287E+01  1.000000E+02  2.749253E+01  1.303609E+03
   3   900       9  9.661596E-01  9.703340E+01  1.000000E+02  2.847712E+01  1.079330E+03
   3  1200      10  9.607405E-01  9.678687E+01  1.000000E+02  2.941299E+01  9.205931E+02
   3  1500      11  9.523431E-01  9.637900E+01  1.000000E+02  3.072899E+01  7.604801E+02
   3  1800      12  9.409207E-01  9.577195E+01  1.000001E+02  3.234375E+01  6.212055E+02
   3  2053  MX  13  9.319756E-01  9.529417E+01  1.000000E+02  3.350969E+01  5.489864E+02

$ @sv delta-eq-0-per
Saving fort.7 as p.delta-eq-0-per ... done
Saving fort.8 as q.delta-eq-0-per ... done
Saving fort.9 as d.delta-eq-0-per ... done

third run: continue hopf bifurcation from point 2 in two parameters
name of r-file: r.baz.hopf
constants to care about
NICP 2 
ICP(1) 1
ICP(2) 2
ISW 2
NUZR 1 (telling AUTO in the next line that it should give a "UZ" point
whenever delta=0.2
Note that in this file NICP is 3 with an artificial parameter 5
(defined in the function pvls in baz.f) appended as ICP(3). AUTO
permits this to give the user the opportunity to see extra output
columns. par(5) is the imaginary part of the eigenvalues

$ @R baz hopf delta-eq-0
Starting baz ...

  BR    PT  TY LAB    PAR(1)        L2-NORM         U(1)          U(2)        PAR(2)        PAR(5)
   2    29  UZ   6  2.398343E-01  2.334495E+00  1.854507E+00  1.417981E+00  2.000000E-01  8.896840E-01
   2    67  UZ   7  4.269853E-01  5.847413E+00  5.026322E+00  2.988030E+00  1.999988E-01  3.537534E-01
   2  1000  EP   8  4.536233E-01  7.227038E+00  6.265707E+00  3.601525E+00  1.751287E-01  2.187822E-03

$ @sv hopf
Saving fort.7 as p.hopf ... done
Saving fort.8 as q.hopf ... done
Saving fort.9 as d.hopf ... done

It is instructive to plot the result with ax 1 5 (this shows the
parameter curve along which the Hopf bifurcation occurs in the
alpha-delta plane) and with ax 1 6 (this shows that the imaginary part
of the eigenvalues goes to zero as AUTO "gets stuck" in the point 8).
In point 8 the equilibrium has the linearization 
[0 1]
[0 0].
This is a codimension 2 bifurcation called Bogdanov-Takens
bifurcation. (Look up in Kuznetsov.)

fourth run: continue equilibria in alpha for delta=0.2 starting from
point 6
name of r-file: r.baz.delta-eq-0-2
constants to care about: IRS=6

$ @R baz delta-eq-0-2 hopf
Starting baz ...

  BR    PT  TY LAB    PAR(1)        L2-NORM         U(1)          U(2)
   2    42  HB   9  4.269839E-01  5.847349E+00  5.026265E+00  2.988001E+00
   2    56  LP  10  4.308685E-01  7.139652E+00  6.245069E+00  3.460310E+00
   2   457  LP  11  3.374160E-01  4.663940E+01  4.577894E+01  8.917492E+00
   2   600  EP  12  3.474478E-01  6.070677E+01  6.007538E+01  8.732735E+00

$ @sv delta-eq-0-2
Saving fort.7 as p.delta-eq-0-2 ... done
Saving fort.8 as q.delta-eq-0-2 ... done
Saving fort.9 as d.delta-eq-0-2 ... done

Plotting shows that the fold (saddle-node) 10 and the Hopf point 8 are
already really close together. 

5th run: continue folds in two parameters
name of r-file: r.baz.fold
constants to care about: 
IRS=10
NICP=2
ICP(1)=1
ICP(2)=2
ISW=2

$ @R baz fold delta-eq-0-2
Starting baz ...

  BR    PT  TY LAB    PAR(1)        L2-NORM         U(1)          U(2)        PAR(2)
  10   102  LP  13  9.012327E-01  3.849070E+01  3.259353E+01  2.047428E+01  3.568419E-03
  10   197  LP  14  8.876731E-02  2.593838E+01  2.582316E+01  2.442089E+00  2.802361E+00
  10   300  EP  15  8.968173E-01  3.331120E+01  2.760367E+01  1.864600E+01  3.848566E-03

$ @sv fold
Saving fort.7 as p.fold ... done
Saving fort.8 as q.fold ... done
Saving fort.9 as d.fold ... done

Assemble 2D bifurcation diagram:
$ @cp hopf 2d
cp: cannot stat `r.hopf': No such file or directory
Copying p.hopf to p.2d ... done
Copying q.hopf to q.2d ... done
Copying d.hopf to d.2d ... done
Copying r.hopf to r.2d ... done
$ @ap fold 2d
Appending p.fold to p.2d ... done
Appending q.fold to q.2d ... done
Appending d.fold to d.2d ... done

Plotting (@p 2d, ax, 1 5, d0bd0) shows that the curve of folds makes a
loop with two cusps (13 and 14) and that the Hopf curve is tangent to
the fold curve at 8

6th run: continue periodic orbits starting from 9 in delta (!)  
name of r-file: r.baz.alpha-eq-0-4-per
constants to care about: 
IRS=9, NUZR=1 (AUTO says "UZ" if period=1e3), DS=-1e-2 (negative)

$ @R baz alpha-eq-0-4-per delta-eq-0-2
Starting baz ...

  BR    PT  TY LAB    PAR(2)        L2-NORM       MAX U(1)      MAX U(2)       PERIOD
   9    71  UZ  13  1.951477E-01  9.896958E+00  8.931690E+00  4.383744E+00  9.999996E+02
   9   100  MX  14  1.951477E-01  9.949484E+00  8.931690E+00  4.383744E+00  1.955976E+07

$ @sv alpha-eq-0-4-per
Saving fort.7 as p.alpha-eq-0-4-per ... done
Saving fort.8 as q.alpha-eq-0-4-per ... done
Saving fort.9 as d.alpha-eq-0-4-per ... done

Period goes to infinity (label 13 and 14 have the same parameter) ->
homoclinic. Plot (@p alpha-eq-0-4-per, d0bd0, 2d, 13, d, 2 3, d) to
convince yourself.

7th run: continue "homoclinic" in two parameters, see homcont demo for
more elaborate way
name of r-file: r.baz.hom
constants to care about: 
IRS=13, NICP=2, ICP(1)=1, NICP(2)=2, DS=1e-3 (small)

$ @R baz hom1 alpha-eq-0-4-per
Starting baz ...

  BR    PT  TY LAB    PAR(1)        L2-NORM       MAX U(1)      MAX U(2)      PAR(2)
   9    36  LP  15  4.536155E-01  7.226568E+00  6.265288E+00  3.601317E+00  1.751367E-01
   9   264  LP  16  3.748207E-01  3.367779E+01  3.270951E+01  8.922855E+00  1.643805E-01
   9   986  LP  17  8.936917E-01  4.392884E+01  9.999099E+01  2.336234E+01  4.067092E-03
   9  1234  MX  18  8.608052E-01  4.787416E+01  4.270661E+01  2.163517E+01  6.052146E-03

$ @sv hom
Saving fort.7 as p.hom1 ... done
Saving fort.8 as q.hom1 ... done
Saving fort.9 as d.hom1 ... done

$ @ap hom 2d
Appending p.hom to p.2d ... done
Appending q.hom to q.2d ... done
Appending d.hom to d.2d ... done

Note that AUTO ran into the Bogdanov-Takens point (LAB=15) and then
turned back along the same curve in the parameter space. Correctly ,15
should have been a branch point (BP). When encountering branch points
but not detecting them properly AUTO "typically" runs through. One may
switch on branch point detection for periodic orbits by setting ISP to
2 or 3. Then d.hom show the function BP which changes sign. 

Plot the 2d bifurcation diagram: (@p 2d, ax, 1 5, d0bd, 0 1 0 0.5) the
zoomed version shows how the parameter curve of hopf, fold and
homoclinics are all tangent at the Bogdanov-Takens point.

This diagram is not yet complete (see Kuznetsov and homcont demo).





