
------------------------------------------------------------------------------
READ-ME file on the TURBO-Pascal diskette for the book

"Numerical Solution of Stochastic Differential Equations through Computer 
Experiments" 
by P. Kloeden, E. Platen and H. Schurz (Springer Verlag, 1993).


Contents : (1)  General structure of the `*.pas'-files on the diskette;
           (2)  Basic routines, units, defaults and a brief functional
                description;
           (3)  Some internal variable conventions;
           (4)  How to print out graphics plots;
           (5)  References;
           (6)  Contact addresses.


Since Borland International Inc. provides the user with many books on TURBO-
Pascal, the basic instructions in them will not be repeated here. It is 
assumed that the reader is familiar with them and has a DOS or IBM-compatible 
PC with a CGA, EGA, VGA or SVGA graphic driver. The programs here have been 
tested for the TURBO-Pascal versions 4.0, 5.0, 5.5, 6.0 and 7.0. In writing the
`*.pas'-files no advantage has taken of the special features of the higher 
versions.   


1 GENERAL STRUCTURE OF THE `*.pas'-FILES ON THE DISKETTE

The programs for the problems have file names of the form `PRX*X*X*.PAS',
while those for the exercises are of the form `EXX*X*X*.PAS'. The characters 
`*' here represent numbers between 1 and 9 corresponding to the chapter and to
the problem or exercise numbers in the book. Only some of the exercises have 
been coded here, with the remaining programs easily assembled from those for 
related problems. 
After some preliminary comments describing the simulation task of the given
problem all programs begin with `PROGRAM PRX*X*X*;'. The number of the
corresponding PC-Exercise in Kloeden & Platen's book `Numerical Solution
of Stochastic Differential Equations' (Springer Verlag, 1992) is also given
there. 
The `USES'-label then indicates which units (external programs in TURBO-
Pascal) are needed by the program. These are either system units of TURBO-
Pascal itself (e.g. DOS, CRT, SYSTEM, GRAPH) or our own units (e.g. INIT, 
SETSCR, SERVICE, RANDNUMB, AAGRAPHS, EXTGRAPH). After them follow the global 
declarations of the form `CONST', `TYPE' and `VARIABLE' and declarations of
`PROCEDURE' and `FUNCTION' subroutines to be used in the program. The main 
body of the program is then opened, being enclosed by `BEGIN' and `END.'
statements. 
As far as possible the notation coincides with that in the manual book or is 
self-explanatory. The mathematical algorithm itself usually takes only a few 
lines, with the bulk of the program consisting of graphic commands, procedures
and output routines or explanations for the user. In general the programs have
been written for ease of use rather than for computational efficiency.


2  BASIC ROUTINES, UNITS, DEFAULTS AND A BRIEF FUNCTIONAL DESCRIPTION

To understand program structure and the functional meaning of variables and 
routines it is recommended that the file `bgidemo.pas' be read and run. 
Various routines of this package have been adopted here or changed slightly.
They are :

  - procedures for opening, activating graphics, initializing screen-depen-
    ding parameters and the random number generator, adapting to graphics card

  (i)    PROCEDURE INITIALIZE;             located in the unit `INIT'

  (ii)   PROCEDURE MYEXITPROC;             located in the unit `INIT'

  - procedure for waiting and terminating in graphics mode

  (iii)  PROCEDURE WAITTOGO;               located in the unit `SERVICE'

  - procedures for displaying of a main screen window and of a bottom line

  (iv)   PROCEDURE MAINWINDOW;             located in the unit `SETSCR'

  (v)    PROCEDURE STATUSLINE;             located in the unit `SETSCR'

   Note: These two procedures require the implementation of the routines
         FUNCTION INTSTR2;, PROCEDURE DEFAULTCOLORS;, PROCEDURE DRAWBORDER;
         and PROCEDURE FULLPORT; from the unit `SETSCR'.

Each program uses the units listed in its `USES'-declaration section. Since 
`DOS', `CRT' and `GRAPH' are standard units of Borland's TURBO Pascal package,
attention here is focused on our self-written units `INIT', `SETSCR', 
`SERVICE', `RANDNUMB', `AAGRAPHS' and `EXTGRAPH' and their functional meaning.
The triplet `INIT', `SETSCR', `SERVICE'  initializes the graphics, some
variable and screen control routines. 
`INIT' determines a new seed for the random number generator (uniformly 
distributed random numbers on [0,1]) on the PC. It checks the graphics card 
and searches for the correct graphics driver in the working directory (if not 
available a question will appear on the screen at the start of the executable 
file). In addition `INIT' sets the maximum number of time subintervals and 
steps to be used by the value assigned to the variable `NUMINV'. It is required
to be a power of 2 for the base 2 logarithmic coordinate plots used here. The 
default value is 512. Finally `INIT' includes the routine `MYEXITPROC' to close
the program with the appropriate program address.
The unit `SETSCR' contains the routines to make a main window and box around
the information table on the user screen, to set a view port and to display
the bottom line by `MAINWINDOW' and `STATUSLINE', respectively. 
The unit `SERVICE' is the host for the procedures `WAITE', `WAITTOGO' and the 
function `CHCR'. The `WAITE' procedure causes the program to wait until the 
user presses any key in the CRT-mode, whereas `WAITTOGO' waits for any key 
to be pressed except for terminating a program in the GRAPHICS-mode by the 
`ESC'-key. The function `CHCR' converts real values into string form while the
truncation parameter `ACCUR' controls the length of the following string. 
Default values are 6 or 8 as desired for the accuracy of the output, but 
should not be larger than 8.
For the random number generation, either the unit `RANDNUMB' must be 
implemented or one of the following routines:

  - generator for two-point distributed random numbers

  (i)   PROCEDURE GENER01(P,X1,X2:REAL; VAR XU:REAL);

        to obtain as output XU a two-point distributed random number
        with   Probability ( XU = X1 ) = P

  - generator for exponentially distributed random numbers

  (ii)  PROCEDURE GENER02(LAMBDA:REAL; VAR XU:REAL);

        to obtain as output XU an exponentially distributed random number
        with   Probability ( XU < = x ) = 1 - exp(-LAMBDA*x)

  - generator for independent, standard Gaussian distributed random numbers

  (iii) PROCEDURE GENER03(VAR G1,G2:REAL);

        to obtain a pair (G1,G2) of independently N(0,1)-distributed random 
        numbers via the Box-Muller method

  - generator for independent, standard Gaussian distributed random numbers

  (iv)  PROCEDURE GENERATE(VAR G1,G2:REAL);

        to obtain a pair (G1,G2) of independently N(0,1)-distributed random 
        numbers via the Polar Marsaglia method

Uniformly distributed random numbers in these random number generators are 
provided by the computer itself through the TURBO-Pascal system. 
The graphic routines, if needed, have to be implemented by the units `AAGRAPHS'
and `EXTGRAPH'. `AAGRAPHS' contains the procedures necessary for an Automati-
cally data-Adapted GRAPHicS plot:

          (i)   PROCEDURE GRAPH111;     plots one trajectory
          (ii)  PROCEDURE GRAPH321;     plots two trajectories together
          (iii) PROCEDURE GRAPH312;     one logarithmic plot (base 2)
          (iv)  PROCEDURE GRAPH313;     two logarithmic plots (base 2) together
          (v)   PROCEDURE CONFINV;      plots confidence intervals

These procedures obtain vector inputs `ORDINATE' and `ABSCISSA' of the length 
NUMINV+1 (default 512+1), except for (v), which can plot up to 50 confidence 
intervals (as default declared by `TYPE VECTOR1=....') with half the length 
of the confidence intervals assigned by the vector `DIFFER' and the number of 
intervals by the input variable `NUM'. The numbers attached to `GRAPH' in these
procedures correspond to the problems in which they are first used, e.g. 
`GRAPH111' is first used in Problem 1.1.1 in the file `prx1x1x1.pas'.
In contrast the unit `EXTGRAPH' is only used for the simulation studies in 
Sections 4.4 and 5.4 of the book. To plot more trajectories in the same 
graphics table the following routines are included:

   PROCEDURE GRAPH441;     for a logarithmic coordinate plot of a set of 
                               trajectories

 and

   PROCEDURE CONFINV;      for plotting confidence intervals of several
                               numerical schemes and step sizes.

Consequently `EXTGRAPH' and `AAGRAPHS' cannot be declared in the same `*.pas'-
file. There are some other program building blocks which are not included in 
the above units. Their first occurrence is in the problems for Chapter 1 and 
in `prx3x1x1.pas'. However, if the data region is known in advance then the 
following procedures can also be used:

   PROCEDURE COORDSYS;    and    PROCEDURE PLOTGRAPH;

or     

   PROCEDURE COORDSYS;    and    PROCEDURE GRAPH311.

The first two procedures place the x-axis at the bottom of the screen, 
whereas for the second pair it appears in the center of the screen.
The `COORDSYS'-procedure has only to be called once and then the routines 
`PLOTGRAPH' and `GRAPH311' can be as often as desired. This interaction 
requires additional variable declarations in header of the `*.pas'-file, so 
`ABSCMIN', `ABSCMAX', `ORDMIN' and `ORDMAX' are added to the constant 
declaration. A significant point on the ordinate of a plot is labelled by 
declaring `ORDPOINT' at it. Line thickness and color are easily controllable 
and the number of data points (as well as a data segment) to be plotted can 
also be specified in the parameter list.
The procedure `COMPSAMPLEPARA' is used for statistical estimation, while 
`EXPLSOL' designates the exact solution (if it exists). Finally, `ABSERR', 
`MEANGXT' and `GXT' measure the strong and weak error distances.


3  SOME INTERNAL VARIABLE CONVENTIONS

The variables `G', `I', `J', `K' and `L' are usually integers. `G1',`G2', `U',
`U1' and `U2' are random numbers, while `WT' and `DWT' store the values of a 
Wiener process and its increments. Time step size is denoted by `DELTA' or
`DELTA_Y', with `X' an exact solution or process and `Y' its approximation. 
For a stochastic differential equation `A' represents the drift function and
`B' the diffusion function, with `DA' and `DB' their spatial derivatives. The
variables `EPS' or `MU', `AVERAGE' and `VARIANCE' denote statistical quanti-
ties while those beginning with the `C' char are either strings or have 
something to do with string operations.


4 HOW TO PRINT OUT A GRAPHICS PLOT

There are several incorporated facilities to print out a graphics plot.
Memory-resident programs have to be activated before running the `*.exe' file.
For example, for the EGA-graphics card it is possible to use the program 
`ega2eps.exe'; for the VGA and SVGA-graphics card working with `INSET' from 
WORDSTAR 5.0 provides a reasonable printout. The latter system allows the user
to make changes to the graph after the production of the source figure. It can
then be converted and adapted to almost all printer types, like postscript, 
paintjet, deskjet or ascii, etc., printers by WORDSTAR and INSET itself. In 
contrast DOS provides printouts via the `graphics.com' routine, but does not 
allow changes to graphic plots after they have been produced.


5  REFERENCES

TURBO-Pascal is a trademark of Borland International, INC. The German
editors are reachable via the following address :

                   Borland GmbH
                   Monzastrasse 4c
                   63225 Langen
                   Germany
                   phone : +49 6103 7680
                   fax   : +49 6103 768290

The following references may be useful for additional information.

[1] Borland Reference and User manual `Turbo Pascal 5.0', 1988

[2] Borland Reference and User manual `Turbo Pascal 6.0', 1989

[3] Borland Reference and User manual `Turbo Pascal 7.0', 1992

[4] Larry Miller & Alex Quilici : `The TURBO C Survival Guide', Wiley, 1989.


6  CONTACT ADRESSES 

Questions or comments concerning the use of this diskette should be directed to
 

                   Institute for Applied Analysis and Stochastics
                   Research group `Stochastic Algorithms'
                   Henri Schurz
                   Mohrenstr. 39
                   Berlin
                   10117
                   Germany

 fax   : +49 30 2004975
 phone : +49 30 20377572
 email : schurz@iaas-berlin.d400.de     ( Internet )


Information about the development of these programs in other computing 
languages can also be obtained from this address.



----------------------------------------------------------------------------
[End of file]