Category : Financial and Statistics
Archive   : MRCRY209.ZIP
Filename : MANUAL

 
Output of file : MANUAL contained in archive : MRCRY209.ZIP

Mercury 2.00 manual
===================

(C) Copyright 1990 Roger Schlafly.
All Rights Reserved.

Portions of the software (C) Copyright 1987-88 Borland International.
All Rights Reserved.

Author's Note: This is a draft of the Mercury 2.00 manual, and was the
latest ascii version. Once I typeset it, it no longer became practical
to update this version. Registered copies of Mercury come with a 90
page typeset manual which is more complete and has fewer errors.

Contents
--------

1. Introduction
Features
History
Shareware policy
Disclaimer
Files
Hardware Requirements
Installation

2. Problems
Editing
Numbers
Operators
Constants

3. Solving
Solutions
Graphs
Reports

4. Feature Reference
Functions
Statements
Commands



1. Introduction

Introduction
------------

Mercury is a program for solving equations on the IBM PC. It is
easy to use, interactive, and powerful. With it, you can

* evaluate mathematical expressions.

* solve for the roots of an equation.

* solve a system of equations.

* maximize or minimize a function, with or without constraints.

* evaluate derivatives and definite integrals.

* plot one or more functions.

* print a report or a graph.

Mercury has a built-in editor, pull-down menus, online help,
and all the conveniences necessary to make it accessible to
computer novices.

For a quick demonstration of Mercury's capabilities, run MERCURY
and then load and solve some of the sample problems (*.EKA). If
you get stuck, just press the F1 key for help.

Mercury is an outgrowth of Eureka, a product of Borland
International of Scotts Valley, California. When
Borland decided to concentrate on spreadsheet and database
products, Eureka was spun off. Mercury was
developed from that code base, and is being released in this
form to satisfy customer requests for new versions of Eureka. It
is labelled version 2.0 because it is similar to what version 2.0 of
Eureka would have been.

Eureka was also available on the Apple Macintosh. No version
of Mercury for the Macintosh is planned at this time.

Mercury is available as Shareware. Shareware is a name for
programs which are distributed freely or at nominal charge, but
which are copyrighted and have restrictions on their usage.

Mercury may be copied freely for examination purposes. Distributors
may charge a nominal fee, provided that they adhere to the conditions in
VENDOR.DOC. Commercial and institutional use is prohibited
without a registered license. Such a license may be obtained by
sending $49 to

Real Software
PO Box 1680
Soquel, CA 95073
USA

phone or fax: 408-476-3550
CompuServe: 76646,323
Genie: R.Schlafly
BBS: 408-476-1055

Payment may be by check, MasterCard, or Visa. See REGISTER.DOC
for an order form. Foreign orders should include $5 for shipping.

Those who register a license will get the latest version of the
software, an installation program, and a printed manual. They will
be eligible for technical support, and will be on the mailing list
for future information and updates.

Site licenses and other special arrangements are available.

Comments, bug reports, and suggestions are especially welcome.


Disclaimer
----------

The author has made his best effort in producing this software, but
hereby disclaims all warranties. He will not be liable for any damages
exceeding the price paid for the license to use the software. The
person using the software bears all risk as to the quality and
performance of the software.

Mercury is not a Borland product. Borland will not provide any
technical support. Eureka is a registered trademark of Borland
International. Borland copyrights and trademarks are used with
permission. Mercury is a trademark of the author.


Files
-----

Mercury consists of these files.

MERCURY.EXE main program
MERCURY.HLP help file
*.BGI graphics drivers
*.CHR fonts
*.EKA sample problems
MANUAL user manual (this file)
README quick instructions
REGISTER.DOC registration form
VENDOR.DOC vendor information

Auxilliary files:

*.EKA more sample problems
*.BGI more graphics drivers
*.BIN external functions
*.C source to external functions
MATHL.H tools for making external functions
*.OBJ tools for making external functions
*.LIB tools for making external functions

If you downloaded Mercury from an online service, you may find the
auxilliary files archived separately. The extra files are not needed
by most people, and are stored separately to save on connect time.
The extra drivers are for uncommon hardware only, and the tools for
making external functions require Borland's Turbo C++.

Registered customers also get INST.COM, an installation program
for configurable options.


Hardware Requirements
---------------------

Mercury requires an IBM PC or clone with at least 640K
of RAM. About 500K of free RAM is needed. In addition,
extended memory (EMS memory) is used if present. If a
math coprocessor is available, it will be used. A math
coprocessor is recommended for serious number crunchers.

Plots require a graphics monitor and a CGA, EGA, VGA, or
Hercules card.

You can print reports and graphs on any of the popular
printers. Select Printer and Model from the Options menu
for the list of supported printers.


Installation
------------

There are no special installation requirements. The simplest
procedure is to make a new directory on your hard disk, and to
copy all of the files there. You may wish to put the Mercury
directory on your path, or to copy some of the files to your
RAM disk.

The program INST may be used to change the edit key bindings,
and to make a few other installation choices. Various other
configuration options are available from within Mercury, and
these may be saved to disk. See Options, below.

Mercury tries to detect automatically what hardware is present,
but there some situations where you may want to override the
detection logic.

If you have a CGA monitor, it may or may not have the "snow"
problem. If so, you may notice random snow on the screen as
characters are written there. If so, you can eliminate it by
typing

set CGASNOWCHK=Y

at the DOS prompt before loading Mercury. There must not be any spaces
surrounding the equals sign.

Mercury automatically detects the math coprocessor, but
occasionally Mercury fails because the chip is defective. It can
be turned off with

set 87=N

at the DOS prompt.

Mercury also detects various graphics cards, but some cannot be
detected. See the SCREEN statement in Chapter 4.

If you have a graphics printer, you will want to select it at the
Printer menu. The graphics card and printer selection can be
saved to the MERCURY.CFG file, and then it will be automatic each
time Mercury is loaded.


Errors
------

Error messages are pretty much self-explanatory. If an error is
detected while parsing the problem file, Mercury puts you in the
Edit window with the cursor at the point of the error. The error
message at the top of the window, and disappears as soon as you
start editing. Other errors are displayed in a special box which
is placed on the screen. After you acknowledge the error by
pressing the Escape key, you are put back in the menu system.


2. Problems

A problem is entered into Mercury by either loading an existing
one from the disk, or by creating a new one in the Edit window. This
chapter explains how to use the editor, and how to create a problem
for solving.


Editing
-------

Mercury includes a complete text editor for creating and
modifying problem files. Usage of the editor is similar
to WordStar in nondocument mode, or to
Borland's SideKick. The problem files are
ordinary ascii files, and can be edited with any other
text editor.

You can move the cursor around in the editor with the arrow
keys, Page Up, Page Down, and some other keys listed below. The
editor has two typing modes, Insert and Overwrite. In Insert
mode, anything you type is inserted at the cursor position. In
Overwrite mode, pressing a key replaces the current character
at the cursor position with the new typed character. Initially,
the editor operates in Insert mode, a default you
can change with the INST program. To switch modes, press the
Insert key or Ctrl-V. (Ctrl-V means to hold down the Ctrl key
on your keyboard while you press V. The V need not be in upper
case.)

No Word-Wrap
Unlike a more standard word processing program, the editor does
not have word-wrap. You must press Enter at the end of each line.

AutoIndent
The editor has an autoindent feature that allows subsequent lines
to automatically indent. If you leave several spaces at the
start of a line, use Ctrl-OI to indent subsequent lines the same
amount. The command sequence is a toggle, so you need only
press Ctrl-OI again to stop indenting.

Zoom
Sometimes you may want to see more than the area covered by the
current window. You can "zoom" the window, expanding it to the
size of the entire screen, by pressing F5. To return the window
to its usual size, press F5 again. For other window commands,
such as moving and resizing a window, see the Window menu, below.

Here is a summary of the editing commands. Many of these
commands can be changed with the INST installation program.

Cursor Movement Commands:

Character left Ctrl-S or Left arrow
Character right Ctrl-D or Right arrow
Word left Ctrl-A
Word right Ctrl-F
Line up Ctrl-E or Up arrow
Line down Ctrl-X or Down arrow
Scroll up Ctrl-W
Scroll down Ctrl-Z
Page up Ctrl-R
Page down Ctrl-C
Left of line Ctrl-QS or Home
Right of line Ctrl-QD or End
Top of screen Ctrl-QE or Ctrl-Home
Bottom of screen Ctrl-QX or Ctrl-End
Top of file Ctrl-QR or Ctrl-PgUp
Bottom of file Ctrl-QC or Ctrl-PgDn
Move to block begin Ctrl-QB
Move to block end Ctrl-QK
Move to previous point Ctrl-QP
Move to marker 0 Ctrl-Q0
Move to marker 1 Ctrl-Q1
Move to marker 2 Ctrl-Q2
Move to marker 3 Ctrl-Q3
Set marker 0 Ctrl-K0
Set marker 1 Ctrl-K1
Set marker 2 Ctrl-K2
Set marker 3 Ctrl-K3

Insert & Delete Commands:

Insert mode on/off Ctrl-V or Ins
Insert line Ctrl-N
Delete line Ctrl-Y
Delete to end of line Ctrl-QY
Delete character left Ctrl-H or Backspace
Delete character Ctrl-G or Del
Delete word right Ctrl-T

Block commands:

Set block begin Ctrl-KB or F7
Set block end Ctrl-KK or F8
Mark word Ctrl-KT
Hide block Ctrl-KH
Copy block Ctrl-KC
Move block Ctrl-KV
Delete block Ctrl-KY
Read block Ctrl-KR
Write block Ctrl-KW
Print block Ctrl-KP

Miscellaneous Commands:

Quit edit, no save Ctrl-KD, Ctrl-KQ, or Esc
Save and edit Ctrl-KS or F2
New file F3
Tab Ctrl-I or Tab
Tab mode toggle Ctrl-OT
Auto indent on/off Ctrl-OI
Restore line Ctrl-QL
Find Ctrl-QF
Find & replace Ctrl-QA
Repeat last find Ctrl-L
Control key prefix Ctrl-P
Abort operation Ctrl-U
Restore error message Ctrl-QW

Search Options:

B Backwards search
G Global search
n n = any number. Search n times
N Replace without asking
U Ignore upper/lower case
W Search for whole words only
S Soundex


Problems
--------

A problem is a text (ascii) file consisting of comments,
definitions, equations, and statements. See the sample
files for examples of problems.

Comments are not read by the Mercury solver, and serve
merely for clarity or documentation. A comment starts
with a semicolon (;) and runs until the end of the line.
Alternatively, comments can be enclosed in curly braces ({})
and may occupy several lines.

Definitions may be either variable initializations or function
definitions and are characterized by the := assignment
operator. If the left-hand-side is a name, it is taken to
be a variable and the right-hand-side is an expression which
evaluates to the initial value for that variable. Such initial
values can be critical to the iterative solver. If the
left-hand-side is a function, as in Square(x) := x^2, then the
right-hand-side serves as the definition for that function. In
this case, Square is then a function of one argument, and
Square(5) = 25.

Equations have a mathematical expression on each side of
an equals sign (=). An equation may also be an inequality
constraint, in which case the equals sign is replaced by
<, <=, >, or >=.

Statements are special directives to Mercury. They are
instructions either to do something other than solve the equations,
or to control the solution process. The allowed statements
are listed below, and examples are in the problem files.


Numbers
-------

The range of numbers is plus or minus 1e-307 to 1e+307.

When using the exact solver, a question mark indicates that the
next digit is uncertain. For example, 1.23? indicates a number
that might be anything between 1.225 and 1.235, as these are the
numbers which round to 1.23.

Imaginary numbers are indicated with the suffix i. For example,
x = 2 + 3i is the complex number with real part 2 and imaginary
part 3.

Percentages may be expressed with the suffix %. For example, 5.1%
is the same as .051.


Examples
--------

A number of example problem files (*.EKA) are on the program
disk. Examination of these is strongly recommended, as these
demonstrate most of Mercury's features. See Chapter 5.


3. Solving


Solving
-------

Mercury features three solver technologies.

1. Direct solver. This method consists of applying the rules of
high school algebra to manipulate the equations until solutions are
obtained for all the variables. For example,

2 x + 3 y = 8
4 x + 5 y = 14

can be solved directly by rearranging the first equation to
y = (8 - 2 x)/3 and substituting for y in the second equation.

See the LEVEL statement for user control over what manipulations
are allowed.

2. Iterative solver. The most difficult systems of equations cannot
be solved analytically. The best we can do is find some approximate
solution and then apply some iterative procedure to improve the
accuracy. In such case it is advisable to provide starting values
for the variables.

3. Exact solver. Mercury's most innovative feature is its ability
to use exact methods in many cases.


Solution Window
---------------

When you apply Solve to a problem file, the result is in the
Solution Window. The window is editable like the Edit window,
and can be scrolled and zoomed for easy viewed. The contents
can be saved in a report, if that is desired.

The solution lists all of the variables, with their final
values. Usually, the value is just a number, displayed to
however many digits is specified in the DIGITS statements or
menu options.

In some cases, a variable was solved directly and symbolically
in terms of other variables. If such an expression was used
to calculate the value, then the expression is shown.

If no value was ever assigned to the variable, then its value
is given as "UNDEFINED" or "NO SOLUTION". This occurs if the variable is
used only as a dummy variable, such as in a function definition
or as a variable of integration.

Occasionally, a variable value will be given as NAN, which
means Not-A-Number. This means the variable could not be computed
accurately, and only crude bounds were obtained. For example,
a result "x = NAN(2.1,7.5)" indicates that x may be anything
between 2.1 and 7.5. Sometimes such imprecise results represent
the best that can be said about an ill-posed problem, but sometimes
it represents a failure on the part of Mercury. Such results
should be used with caution.

When a variable appears to have the value of a simple fraction,
it is noted in the solution. For example, solving 3 x = 1 gives
x = 0.333333333333333 { 1 / 3 }. The fraction is reduced, meaning
that the numerator and denominator have no nontrivial factors. The
logic which recognizes these fractions is particularly effective
with the Exact solver.

In some cases, multiple roots for some variable are found. These
are listed after the list of variable values.

If the problem file has a LIST statement, then the list of the
abscissae and ordinate appear in the solution window.

The solution always has a list of residuals. These are extremely
important for assessing the validity and accuracy of a solution.
A residual is a quantity that should be zero if the equation were
solved perfectly. It is the absolute value of the difference
between the left and right hand sides of the equation. For
example, solving SIN(x) = .5 might give as a residual

{ 1E-16 } SIN(x)-.5=0

The number in braces, 1E-16, is the residual. It is the absolute
value of SIN(x)-.5 using the solved value of x. Residuals of this
size are quite common, as internally Mercury calculates to 16-digit
precision, and there is no machine representable x for which SIN(x)
is exactly 0.5.

The equation to the right of the braces is often the same as one of
the input equations, but sometimes Mercury rearranges some terms.
It might be a simple rearrangement as above, but it may also the
result of symbolically solving for one of variables and substituting
it into other equations. In any case, the equations shown with the
residuals are the actual equations used by the solver. Some control
of the symbolic substitutions is allowed by the LEVEL statement or
the Level option under the Solver menu.

Occasionally, you may see variables name T1, T2, ... These are temporary
variables introduced by Mercury in the course of solving. Most
commonly, they are used to enforce inequality constraints.
The constraint

EXP(x + y) + y * z <= 10

may be replaced with

EXP(x + y) + y * z + T1 = 10
T1 >= 0

The latter has some technical advantages, even though there is an
extra equation and an extra variable. Values for the extra variable
are not shown.

Finally, the solution ends with the largest residual, the method, and
the processor. The largest residual is simply the maximum of the
previous residuals. Assuming your problem is not scaled too badly,
then anything less than about 1E-10 should be considered a success.

The method is Exact, Direct, or Iterative. The exact and direct
solvers are more reliable, and Mercury tries them first. This logic
can be altered with the METHOD statement. The processor is a 8087,
80287, 80387, or emulator.


Reports
-------

A report is an unformatted ascii file holding the problem and the
solution. It can be saved to disk or printed to keep a record of
the solution. To save to disk, press Go in the Report menu. (This
menu item doesn't become active until you have solved a problem.)
Normally, the report has the same name as the problem but with the
.EKA suffix replaced with .RPT. You can use other file names if you
please.

Another way to keep a record of problems and solutions is to have
a Log file. Just turn Capture On in the Report menu. Then all
problems and solutions will be appended to a log file.

The reports and logs are ordinary ascii files, and can be printed.
If you have a Postscript printer, you will have to select a mode
in which it will accept an ascii file, or load a utility for
printing ascii files. (No such utility is provided with Mercury.)


Graphics
--------

Mercury may be used to generate graphs. These visually show
the behavior of functions. A graphics monitor is required.

To get a graph, you must first define a function of one variable
in your problem file. An example from the file BUMPY.EKA is

bumpy(x) := x^2 SIN(x)

which defines a function called "bumpy". The "x" is a dummy variable.
The has values func(0) = 0^2 SIN(0), func(1) = 1^2 SIN(1), etc. To
graph the function from -15 to +15, use the statements:

PLOT bumpy
GBOUNDS -15, +15

To assimilate this information into the Mercury solver, you must do
a Solve, even though you are not really solving for anything in this
case. Once the problem has been solved, the View, Print, and Write
commands become available under the Graph menu. Select View to see
the graph on the screen.

If the graph looks a little ragged, perhaps not enough points were
used to plot it. The default is 30. Increasing it to 100 will give
a much smoother graph. This can be done by either adding the
GPOINTS 100 statement to the problem file and solving it again, or
by selecting GPoints from the Graph menu.

It is also possible to have "parametric" plots, where both X and
Y are functions of some other independent variable. Merely use
the XAXIS statement to specify the X function. The GBOUNDS statement
then refers to the independent variable.

These graphs can be printed on graphics printers. This includes
most printers, except for daisy-wheel printers. Selecting Print
will print the graph to whatever printer has been selected under
the Options/Printer menu.

You can also select Write, which prints the graph to a file. Such
a file can be sent to a printer at a later time. The primary
usefulness of this feature is to export the graph in Lotus or
Postscript format, where it can be imported by another program.

The various options in the Graph menu are really the defaults, and
are overridden by the corresponding statements in the problem file.
If there are statements in the problem file setting graph options,
then the menu may not accurately reflect the options used to draw
the graph. Nevertheless, once a graph has been created, these
options can be modified from the graph menu, and then View will
show the revised graph.


4. Feature Reference

This chapter gives an alphabetical lookup for the Mercury built-in
functions and statements.


Operators
---------
+ add.
- subtract.
* multiply. a space may also be used.
/ divide.
^ power. Eg, 2^3 = 8.
~ complex conjugate.
< less than.
<= less than.
> greater than.
>= greater than.
= equals.
:= variable initialization or function definition.
: equation separator.
% percent, eg, 17% = .17.

These have the usual mathematical precedence rules, with ^ having
higher precedence than * and /, which in turn are higher than + and -.


Constants
---------

These two constants are built-in.

INF plus infinity
PI 3.1415926535... You can also use the greek letter by typing Alt-P.


Functions
---------

Functions take one or more arguments. The arguments are separated
by commas and enclosed in parentheses. Here is a list of the
built-in functions. Additional functions can be defined within
a problem file.

ABS(x)

The absolute value of x. You can also use |x|.

ACOS(x)

The arc cosine of x, inverse to COS(x).
The result is in radians.

ASIN(x)

The arc sine of x, inverse to SIN(x).
The result is in radians.

ATAN(x)

The arc tangent of x, inverse to TAN(x).
The result is in radians.

BESSJ(n,x)

The Bessel function of the first kind.
The first argument must be an integer.

BESSY(n,x)

The Bessel function of the second kind, sometimes
also called the Weber function.
The first argument must be an integer.
For each n, it is a solution to Bessel's
differential equation with a singularity at zero.

BINOM(n,k)

The number of combinations, choosing k of n items.
Given by n! / (k! (n-k)!).

CEIL(x)

The smallest integer greater than or equal to x.
Eg, CEIL(4.7) = 5.

COS(x)

The cosine of x. The angle x is measured in radians.

COSH(x)

The hyperbolic cosine of x, (EXP(x) + EXP(-x))/2.

CTERM(rate,fv,pv)

The number of periods required for a given present
value (pv) to increase to a given future value (fv)
if it grows at the given interest rate. The function
is compatible with Quattro/Lotus.

DERIV(f(x),x)

The derivative of the function f(x) with respect to x.
In most cases, the derivative is computed symbolically.

DLGAMMA(n,x)

The n-th derivative of LOGGAMMA, n = 0,1,2,...

ERF(x)

The error function of x. It is related to NCUM(x).

ERF(x) = 2 NCUM(x SQRT(2)) - 1

Eg, ERF(-INF) = -1, ERF(0) = 0, ERF(+INF) = +1.

ERFC(x)

The complementary error function of x. See ERF and NCUM.

ERFC(x) = 1 - ERF(x)

Eg, ERFC(-INF) = +1, ERFC(0) = 0, ERFC(+INF) = -1.

EXP(x)

The exponential function of x, e^x, e = 2.71828...
It is the inverse to LN(x).

FACT(x)

x factorial, sometimes written x!.
Eg, FACT(5) = 5*4*3*2*1 = 120.

FLOOR(x)

The largest integer less than or equal to x.
Eg, FLOOR(4.7) = 4.

FRAC(x)

The fractional part of x, x - FLOOR(x).
Eg, FRAC(4.7) = 0.7.

FV(pmt,rate,nper)

The future value of payments (pmt) at the end of nper
periods, assuming the given interest rate.
The function is compatible with Quattro/Lotus.

FVAL(rate,nper,pmt,pv)

Gives the future value of a financial with a payment
pmt in each of nper periods, with the given present
value pv, and the given interest rate.
The function is compatible with Quattro Pro.
It uses the financial mode specified by the FINANCE
statement to determine whether the payments are at the
end of the period (the default) or the beginning.

HYPOT(x,y)

The polar coordinate radius corresponding to cartesian
coordinates (x,y). Eg, HYPOT(3,4) = 5.

IFPOS(x,y,z)

Gives y if x >= 0, else it gives z. Eg, IFPOS(-3,6,7) = 7.

IM(x)

The imaginary part of x. The COMPLEX option must be in use.

INTEG(f(x),x,a,b)

INTEG(f(x),x,a,b) gives the numerical integral of f(x) with
respect to x from a to b. Improper integrals are allowed, so a
can be -INF, b can be +INF, and f can be singular at a or b. The
approximation method is adaptive and nonlinear, and often is
accurate to 15 digits.

INTEG1(f(x),x,a,b)

INTEG1 is similar to INTEG, but uses a simpler
strategy. It is nonadaptive and linear, and may be preferred in
situations where the result is supposed to be a smooth function
of a and b. INTEG1 is not nearly as accurate as INTEG on
singular functions.

LIMIT(f(x),x,a,INF)

Estimates the limit of f(x), as x goes from a to infinity.
It uses a numerical method to compute the limit
of f(x), as x goes from a to infinity. It is an nonlinear
extrapolation based on a fairly small number of terms. The
limit is only reliable if the function is well-behaved, and
this feature should be used with caution.

LN(x)

The natural logarithm (base e) of x.
It is the inverse to EXP(x).

LOG10(x)

The logarithm of x to the base 10. The inverse is 10^x.

LOGGAMMA(x)

The logarithm of the gamma function of x.

MAX(x,...)

The maximum value of the arguments.
Eg, MAX(-10,5,7) = 7.

MIN(x,...)

The minimum value of the arguments.
Eg, MIN(-10,5,7) = -10.

NCUM(x)

The normal cumulative probability function. NCUM(X) is the
probability that a normal random variable is below its mean,
plus X standard deviations.

Eg, NCUM(-INF) = 0, NCUM(0) = .5, NCUM(+INF) = 1.

PAYMT(rate,nper,pv,fv)

Gives the present value of a financial with a payment
pmt in each of nper periods, with the given future
value fv, and the given interest rate.
The function is compatible with Quattro Pro.
It uses the financial mode specified by the FINANCE
statement to determine whether the payments are at the
end of the period (the default) or the beginning.

PMT(pv,rate,nper)

Gives the amount of the payments required in each of nper
periods to balance the given present value pv and interest rate.
The function is compatible with Quattro/Lotus.


POLAR(x,y)

The polar coordinate angle corresponding to cartesian (x,y).
Same as the Quattro/Lotus @ATAN2(x,y) or the Fortran/C atan2(y,x).

POLY(x,a0,a1,...,an)

The polynomial a0 x^n + ... + an.
Eg, the polynomial 2 x^3 - 3 x + 7 can also be written
POLY(x,2,0,-3,7). The chief advantage of the latter is
notational convenience, and so it can be recognized by the
special polynomial solver.

POS(x)

The positive part of x, ie, x if positive and 0 if negative.

PV(pmt,rate,nper)

Gives the present value of nper payments of amount pmt,
using the given interest rate.
The function is compatible with Quattro/Lotus.

PVAL(rate,nper,pmt,fv)

Gives the present value of a financial with a payment
pmt in each of nper periods, with the given future
value fv, and the given interest rate.
The function is compatible with Quattro Pro.
It uses the financial mode specified by the FINANCE
statement to determine whether the payments are at the
end of the period (the default) or the beginning.

RATE(fv,pv,nper)

Gives the interest rate required for the present
value (pv) to increase to the future value (fv) in
nper periods. The function is compatible with Quattro/Lotus.

RE(x)

The real part of x. The COMPLEX option must be in use.

REM(x,y)

The remainder of x divided by y. Eg, REM(20,3) = 2.

SGN(x)

Gives +1 if x > 0, -1 if x < 0.

SIN(x)

The sine of x. The angle x is measured in radians.

SINH(x)

The hyperbolic sine of x, (EXP(x) - EXP(-x))/2.

SQRT(x)

The square root of x.

SUM(f(x),x,a,b)

The sum of f from a to b,

f(a) + f(a + 1) + ... + f(b)

If b = +INF, the limit is estimated as with the LIMIT function.

TAN(x)

The tangent of x, SIN(x)/COS(x).
The angle x is measured in radians.

TANH(x)

The hyperbolic tangent of x, SINH(x)/COSH(x).

TERM(pmt,rate,fv)

The number of periods required for a given payment
stream (pmt) to increase to a given future value (fv)
if it grows at the given interest rate.
The function is compatible with Quattro/Lotus.


Statements
----------

BOUNDS lower,upper

Specify bounds for the domains of the variables. The default is
BOUNDS -INF,INF. Some solving time can be saved with the
statement BOUNDS -1e6,1e6 if you are sure that all the relevant
values of your variables are less than a million.

CASEFOLD

Ignore case in names. Otherwise, the variable x is different from X.

CASESTRICT

Using CASESTRICT, with no args, causes built-in functions,
constants, and statements to be upper case only. Normally such
predefined names are not case sensitive, so SIN(x) is the same as
sin(x). Using this option reduces the chance of a name conflict.

COMPLEX

Declares that all the variables are to be considered complex
variables. Their solutions have a real and imaginary part.
These built-in functions may be used in a complex problem:

ABS, COS, COSH, EXP, IM, LN, RE, SIN, SINH, SQRT,
SUM, TAN, TANH.

DIGITS n

Display real numbers to n digits of precision. The default is 18.

EPSILON x

Forces numbers very close to zero to be displayed as zero. Useful
for showing complex numbers which are actually real. Default is EPSILON 0.

EXTERNAL function

Declares the name to be an externally defined function, to be
found on the disk in the problem directory with the file name
function.BIN. These functions are written in Turbo C++ or TASM,
and compiled into .BIN files. See the samples.

FINANCE type

Gives the type parameter to the Quattro compatible financial
functions, PVAL, PAYMT, and FVAL. The default is
type = 0, meaning that the payments are at the end of the
period. Use type = 1 if the payments are at the beginning.

GBOUNDS xleft, xright

The lower (xleft) and upper (xright) bounds for the X-axis in a graph.

GPOINTS n

The number of points (function values) used to draw a graph. The
default is 30. If your graph is too ragged, try increasing the
number of points.

GSTYLE n

Allows graph curves to be thick (GSTYLE 0) or thin (GSTYLE 1).

INCLUDE filename

The file with the given name is inserted in the problem at
that point. The filename must be in quotes, as in INCLUDE "CONST.INC". The
default file name extension is .INC. Include files cannot be nested.

ITERATIONS n

The maximum number of iterations used by the iterative solver. The
default is 100.

LEGEND

Puts a legend on the graph which identifies the function or functions.
Recommended when plotting more than one function.

LEVEL n

Allows user control over what symbolic substitutions are made.

0. no symbolic solving
1. solve X = constant
2. solve X = constant expression
3. solve only when X occurs once, no other variables
4. solve only when X occurs once, other variables possible
5. solve linear equations
6. solve squares, using square roots
7. solve quadratic equations
8. solve powers

The default is LEVEL 5, solving linear equations but not using
square roots. Strictly speaking, the substitutions involving
roots are not mathematically equivalent, as the substitution must
arbitrarily choose the positive or negative square root.

It is sometimes preferable to use LEVEL 0 to turn off all the
symbolic manipulations. Then Mercury effectively weights all
equations equally, and the solution can be considered the solution
to a least squares problem.

LIST function

List one or more functions in the solution window. Syntax is the
same as for PLOT.

MAXIMIZE x

The variable x is maximized.

METHOD n

Specify the solver method, where n = 1, 2, or 3.

1. Exact
2. Direct
3. Iterative

The default is METHOD 1, the exact solver. If it fails, the direct
solver is tried, and it that also fails, the iterative solver is
tried.

MINIMIZE x

The variable x is minimized.

PENALTY n

The value of the penalty constant, an arbitrary constant used
to enforce constraints when the iterative solver is used to
maximize or minimize a variable. The default is 30. Increasing
it forces the approximate solutions closer to the constraint
manifold at the cost of making the extremum harder to find. Readers
of The Hitchhiker's Guide to the Galaxy suggest using the value 42.

PLOT function

Creates a plot of the named function. To view the graph, select
Graph from the main menu. To plot several functions on the same
graph, list the names separated by commas. The functions must be
defined in the problem file, and be functions of one variable. For
example, to plot SIN(x) and x^3-x from -5 to +5, use

f(x) := SIN(x)
g(x) := x^3 - x
GBOUNDS -5, +5
PLOT f, g

PRINT

Same as PRINTFILE "LPT1". It prints the graph to the DOS device LPT1,
which is usually a printer on parallel port 1. The printing can be
configured to use another port from the Options menu, and the result
saved to a setup file.

PRINTFILE filename

Print the graph to the given file, whose name is in quotes.

These names have special meaning.

"PAR1" parallel port 1
"SER1" serial port 1
"PAR2" parallel port 2
"SER2" serial port 2
"LPT1" DOS lpt1
"LPT2" DOS lpt2
"LPT3" DOS lpt3
"LPT4" DOS lpt4
"EPT" IBM postscript port

PROGRESS x

Show the value of the variable x in the Progress box. Mercury
does not solve for all variables at once, so sometimes there
might be no value for the variable until the end of the solution
process. In such cases, the Progress window shows "x = NAN",
meaning "x is not a number".

If no PROGRESS statement is given, the Progress window shows the
value of the "Residual". This is the sum of squares of quantities
which should be zero, and which Mercury is trying to minimize. The
smaller the value, the more likely that Mercury is getting close to
the solution.

REPORT filename

Allows naming a report file from within a problem.

ROOTSIGN n

When solving an equation like x^2 = a, Mercury may take the square
root of both sides. This introduces two roots, +SQRT(a) and
-SQRT(a), and Mercury does not know which to take. You can specify
that you always want the positive root with ROOTSIGN +1, or
always the negative root with ROOTSIGN -1. The default is
ROOTSIGN 0, which leaves Mercury unable to evaluate the square
root.

SCREEN n

Choose a graphics screen. The default is SCREEN 0, which means
Mercury automatically tries to detect your graphics hardware.
Some graphics cards and modes cannot be detected, and must be
selected with a SCREEN statement.

0. AutoDetect
1. CGA
2. MCGA
3. EGA 64k
4. EGA 256k
5. EGA Mono
6. IBM 8514
7. Hercules
8. ATT 400 line
9. VGA
10. 3270 PC
11. Tandy 1000
12. ATI Super VGA
13. Orchid Super VGA
14. Paradise Super VGA
15. Vega Super VGA
16. Compro ABLE II Super VGA
17. SOTA Super VGA

From the main menu, the graphics screen can be selected with
Graph/Mode. Such a selection is ineffective after the first
graph is drawn, as the graphics has been initialized at that
point. We recommend saving the desired graphics mode to the
MERCURY.CFG configuration file.

(Note: The drivers for some of these graphics modes is not
included with some versions of Mercury. Registered customers
receive the full set of drivers.)

SHOW x

Show specified variables in the specified order. Other variables
are not displayed in the solution window.

SOLVE x

Instructs Mercury to solve only for the variable x. By default, it
solves for all variables named in the problem.

If SOLVE is given with a polynomial function name, as in

SOLVE f
f(x) := POLY(x,1,0,0,1)

then Mercury will apply a special polynomial root finder to get all
real and complex roots.

START x

The starting value for uninitialized variables while using the
iterative solver. The default is 1.00.

TERMS n

The most number of terms used by the INTEG and LIMIT functions. The
default is 50.

TIME n

The maximum time allowed for solution. The default is 200 seconds.
Same as MAXTIME in Eureka 1.0.

TITLE label

Argument is a quoted string, to be used as a graph title.
Default is no title.

SUBTITLE label

Argument is a quoted string, to be used as a graph subtitle.
Default is no title.

XLABEL label

A label for the X-axis of a graph. The label must be in quotes.

YLABEL label

A label for the Y-axis of a graph. The label must be in quotes.

XAXIS function

Specifies that the X-axis be a function instead of an independent
variable. The function must be defined elsewhere as a function
of one variable.

The X axis of the graph is a function with the given name. Useful
for parametric plots. Eg, to graph (x,y) = (cos(t),sin(t)) as
t goes from 0 to 2*PI, use

x(t) := cos(t)
y(t) := sin(t)
GBOUNDS 0, 2 PI
XAXIS x
PLOT y




  3 Responses to “Category : Financial and Statistics
Archive   : MRCRY209.ZIP
Filename : MANUAL

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/