home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
educatio
/
eval103.zip
/
EVAL.DOC
next >
Wrap
Text File
|
1991-12-12
|
10KB
|
261 lines
EVAL V1.03 Copyright (c) 1991 Copy Con Incorporated Page 1
OVERVIEW
--------
EVAL is a mathematical expression evaluator, capable of evaluating
virtually any formula, including those with trigonometric functions
and user-defined variables. Formulas are typed in at the command line,
and the formula and outcome (and optionally the variable values) are
immediately displayed on your screen, or can be sent elsewhere via
standard DOS redirection.
DISCLAIMER
----------
EVAL is distributed on an "AS IS" basis without warranty, expressed or
implied. Considerable testing effort has been expended, but the user
is advised to check the program's suitability before relying on it.
The user assumes full risk as to the results of using this program.
Any liability of the author will be limited exclusively to product
replacement. In no event shall the author be liable for any
consequential damages arising from the use, or inability to use this
program.
REGISTRATION
------------
EVAL is NOT free - it is being offered to you as Shareware. If you
plan to continue using EVAL, you are obligated to pay the modest
registration fee of $15. For the latest version of EVAL, minus the
"nag" messages, add $5.
Send check or money order in U.S. funds to:
Copy Con Incorporated
P.O. Box 23255
Baltimore, MD 21203
Specify 5.25" or 3.5" diskette. Maryland residents add $1 sales tax.
We thank you for your support.
EVAL V1.03 Copyright (c) 1991 Copy Con Incorporated Page 2
OPERATION
---------
EVAL is activated from the command line, using the format
EVAL [variable=expression;...] expression [options]
Expressions are mathematical formulas built with the supported
functions, operators, constants and variables.
FUNCTIONS
---------
Following is the list of functions that EVAL supports:
Function Description
-------- -----------
abs Absolute value
acos Arc cosine
asin Arc sine
atan Arc tangent
ceil Smallest integer not less than input value (rounds up)
cos Cosine
cosh Hyperbolic cosine
csc Cosecant
ctn Cotangent
cub Cube root
exp E to the power of input value
flr Largest integer not more than input value (rounds down)
int Rounds down (same as FLR)
ln natural logarithm
log natural logarithm (same as LN)
logt Base 10 logarithm
sec Secant
sgn Sign of input value (positive=1, negative=-1, zero=0)
sin Sine
sinh Hyperbolic sine
sqr Square root
tan Tangent
tanh Hyperbolic tangent
Parentheses are optional when using functions; if they are not used,
only the first value following the function will be considered for
input. For example:
sin pi is equivalent to sin(pi)
sin pi/2 is equivalent to sin(pi)/2
sin(pi/2) is equivalent to sin(pi/2)
EVAL V1.03 Copyright (c) 1991 Copy Con Incorporated Page 3
OPERATORS
---------
Each operator has a precedence, and operators with higher precedence
are evaluated before operators with lower precedence. Operators with
equal precedence are handled from left to right within a function.
Following is the list of operators that EVAL supports, along with
their precedences:
Operator Precedence Description
-------- ---------- -----------
( 5 Left parenthesis
) 5 Right parenthesis
! 4 Factorial
^ 3 Exponential
* 2 Multiplication
/ 2 Division
% 2 Modulus
+ 1 Addition
- 1 Subtraction
CONSTANTS
---------
EVAL supports numeric constants, as well as two alphabetic constants,
PI and E. Alphabetic constants cannot directly follow functions; use
"sin pi" or "sin(pi)", not "sinpi". Numeric constants need not be
separated from functions; "sin3" is okay.
Here are the approximate values of PI and E:
PI = 3.14159265
E = 2.71828183
VARIABLES
---------
The letters A-Z (except for E and I) are set aside as user-definable
variables. Variables have a default value of 0, and are assigned
values using the equals sign. For example:
EVAL a=pi;b=2;b*cos(a)
will assign a value of PI to A, a value of 2 to B, and will print out
the value of B times the cosine of A. As with alphabetic constants,
variables cannot directly follow functions; use a space delimiter, or
parentheses as above.
EVAL V1.03 Copyright (c) 1991 Copy Con Incorporated Page 4
OPTIONS
-------
Options must be in the form "OPTION:value", as in "a:g" or "d:5". Case
is not important. Separate options with spaces.
Option Description
------ -----------
A Angular unit - whether angles will be expressed as degrees,
radians, or grads. Use the first letter of the unit, as in
"a:d". By default, angular units are expressed as radians.
D Significant Digits - the number of significant digits shown in
the expression outcome. Range is 1 thru 20; the default is to
display as many digits as needed.
V Show Variables - whether variables and their values will be
displayed as they are assigned values; default is N.
ERROR MESSAGES
--------------
Following is the list of error messages you may have the misfortune to
see, along with their descriptions and corresponding DOS errorlevels:
Level Message & Description
----- ---------------------
1 Invalid command line options - you have attempted to use an
unsupported option, or you have exceeded an option's range.
2 Invalid function '(function)' - you have attempted to use an
unsupported function. If it's a common function, let us know,
and we will add it.
3 Abnormal program termination - either we erred in trapping a
math function, or the program has been corrupted somehow.
(Please drop us a line describing everything that led up to
this error, if you happen to come across it.)
4 Expression too complex - your formula has 128 or more
constants, or more than 255 combined constants, functions, and
operators.
5 Invalid operator '(op)' - you have attempted to use an
unsupported operator. If it's a common operator, let us know,
and we will add it.
6 Mixmatched parentheses - there were an uneven amount of
parentheses, or a right parenthesis was encountered before its
matching left paren.
EVAL V1.03 Copyright (c) 1991 Copy Con Incorporated Page 5
ERROR MESSAGES (continued)
--------------------------
7 Invalid use of functions - functions cannot be directly
followed by an operator (unless the operator is a "+" or "-"
indicating the sign of the value that follows).
8 Invalid use of operators - operators cannot be directly
followed by other operators (unless the second operator is a
"+" or "-" indicating the sign of the value that follows).
9 Domain/range error - a function in the formula cannot evaluate
its input value, as the value is outside of the function's
range.
10 Division by zero - a denominator in your formula has a value of
zero, which is mathematically undefined.
11 Overflow error - the formula evaluates to a number higher than
the maximum value allowed, or lower than the minimum allowed.
12 Invalid variable '(variable)' - an attempt was made to assign a
value to a constant or a non-variable.
EXAMPLES
--------
EVAL sqr3 d:4
displays the square root of 3, limited to 4 significant digits.
( sqr3 is equivalent to sqr(3) )
EVAL a=pi ; b=2 ; b*cos(a) v:y
assigns a value of PI to A, a value of 2 to B, and displays the
value of B times the cosine of A. The values of A and B are also
displayed. (The spaces around the semicolons are not required)
EVAL x=.1 ; asin(5x) a:d
assigns a value of .1 to X, and displays the arcsine of quantity
5 times X, expressed in degrees. ( 5x is equivalent to 5*x )
CORRESPONDENCE
--------------
If you have any comments, suggestions, bug reports, etc., write to:
Copy Con Incorporated
P.O. Box 23255
Baltimore, MD 21203
If you would like a reply, please include a self-addressed, stamped
envelope. We look forward to hearing from you.