Dec 162017
 
Graph 2D-3D-polar math functions; save screen to GIF file. Works with most graphics adapters. Options for color, scaling, resolution, etc.
File GR105.ZIP from The Programmer’s Corner in
Category Science and Education
Graph 2D-3D-polar math functions; save screen to GIF file. Works with most graphics adapters. Options for color, scaling, resolution, etc.
File Name File Size Zip Size Zip Type
DESC.SDI 57 57 stored
GR.DOC 20502 6387 deflated
GR.EXE 51902 50855 deflated
HISTORY.TXT 1454 665 deflated
REGISTER.TXT 2293 743 deflated

Download File GR105.ZIP Here

Contents of the GR.DOC file





GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 1


TO PRINT THIS FILE, TYPE "COPY GR.DOC PRN" AT THE DOS PROMPT.


OVERVIEW
--------
GRAPHITI is a mathematical function plotter, capable of displaying
user-defined two-dimensional, three-dimensional, and polar functions,
with the option of saving the output as a GIF file. GRAPHITI will work
with any MS-DOS compatible computer with a CGA, Hercules, MCGA, EGA,
VGA, or SVGA graphics adapter, and will take advantage of a math
coprocessor if available.


DISCLAIMER
----------
GRAPHITI 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
------------
The unregistered version of GRAPHITI is freely distributable and fully
functional, and may be used for a 30-day trial period. If you plan to
continue using GRAPHITI after the trial period, you are obligated to
pay the modest registration fee of $20. Registered users will receive
the latest version of GRAPHITI with the "nag" messages removed, one
free upgrade upon request, and half-priced subsequent upgrades.

All registration information is contained in the REGISTER.TXT file. If
that file is missing, register by sending a check or money order for
$20 in U.S. dollars, drawn on a U.S. bank, to:

Copy Con Incorporated
PO Box 23255
Baltimore MD 21203-5255

We thank you for your support.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 2


OPERATION
---------
GRAPHITI is activated from the command line, using the format

GR expression [options]

To stop a plot in progress, press any key, and the plotting will stop;
another keypress will exit the program. Ctrl-Break will stop and exit
immediately.


EXPRESSIONS
-----------
Expressions are mathematical formulas built with the supported
functions, operators, constants and variables. Expressions must be in
one of the following forms:

x=f(y) 2-dimensional vertical Angles specified in radians
y=f(x) 2-dimensional horizontal " " " "
z=f(x,y) 3-dimensional " " " "
r=f(p) Polar " " " degrees


FUNCTIONS
---------
Following are the functions that GRAPHITI 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)
frac Fractional part of input value
int Integer part of input value
ln Natural logarithm
log Natural logarithm (same as LN)
logt Base 10 logarithm
rand Random integer between 1 and input value (max 32767)
sec Secant
sgn Sign of input value (positive=1, negative=-1, zero=0)
sin Sine
sinh Hyperbolic sine
sqr Square (x^2)
sqrt Square root
tan Tangent
tanh Hyperbolic tangent



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 3


FUNCTIONS (continued)
---------------------
Parentheses are optional when using functions; if they are not used,
only the first value following the function will be considered the
argument. For example:

y=sin x is equivalent to y=sin(x)
y=sin x/2 is equivalent to y=sin(x)/2
y=sin(x/2) is equivalent to y=sin(x/2)

Use of functions without parentheses is potentially erroneous, and it
is generally preferable to use parens to indicate function arguments.


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.

Precedence is indicated by order in the following table (the first
line has the highest precedence):

Operators Description
--------- -----------
( ) Left parenthesis,Right parenthesis
! Unary factorial
+ - Unary sign
^ Exponential
* / % Multiplication,Division,Modulus
+ - Addition,Subtraction

Where it is not ambiguous, multiplication can be indicated by
adjacency: 8(6-4) = 8*(6-4) = 16. Implicit multiplication is
potentially erroneous, and it is generally preferable to use the '*'
symbol to indicate multiplication.


CONSTANTS
---------
GRAPHITI supports numeric constants, as well as two alphabetic
constants, PI and E. Alphabetic constants cannot directly follow
functions; use "y=sin x" or "y=sin(x)", not "y=sinx". Numeric
constants need not be separated from functions with spaces; "y=sin3"
is okay.

Numerical constants are entered just as you would ordinarily write
them. They can be preceeded with optional + or - signs. The following
are all valid numerical entries:

6.78 0.678 .678 -678

Blanks are not permitted in numbers; the expression "7 8" would be
evaluated as 7 times 8, not 78.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 4


CONSTANTS (continued)
---------------------
Alphabetic constants can be used as easily as real numbers; just be
careful not to string them together with functions, variables, and
other alphabetic constants; instead of "z=lnx+ypi", use
"z=ln x + y pi", or "z=ln(x)+y*pi". "y=3pi/x" and "x=3e" are valid, as
GRAPHITI can tell where one constant ends and another begins.

Following are the approximate values of the alphabetic constants:

PI = 3.14159265
E = 2.71828183


VARIABLES
---------
The three variables (X, Y, and P) change value from their lower range
to their higher range (with increments determined by the D and L

options), and the function's value is plotted accordingly. Variables
can be used in the following functions:

Variable Functions
-------- ---------
X y=f(x), z=f(x,y)
Y x=f(y), z=f(x,y)
P r=f(p)

The variables are plotted according to the functions they are used in:

x=f(y), y=f(x) | z=f(x,y) | r=f(p)
---------------------|------------------------|--------------------
y | z -y(back) | r
| | | / | |
| | |/ | |
-x ------+------ x | -x ------+------ x | r ------+------ r
| | /| | |
| | / | | |
-y | (fore)y -z | r


OPTIONS
-------
Options must be in the form "OPTION:value[,value...]", as in "u:2" or
"rx:-3,5". Case is not important. Separate options with spaces.

Option Description
------ -----------
A Axis lines - determines whether the X- Y- and/or Z-axes
will be drawn. Default is Y.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 5


OPTIONS (continued)
-------------------

Option Description
------ -----------
C Color - the color of the plotted graph. Range is 0 thru the
maximum amount of colors for the video screen. Default is 1
for a monochrome screen, 13 for a color screen. Colors are
as follows:

COLOR MONOCHROME
Num Color Num Color
--- ----- --- ----
0 Black 0 Black
1 Blue 1 White
2 Green
3 Cyan
4 Red
5 Magenta
6 Brown
7 Light Grey
8 Dark Grey
9 Light Blue
10 Light Green
11 Light Cyan
12 Light Red
13 Light Magenta
14 Yellow
15 White

For 3D graphs, the fill color and fill style can also be
specified. Use the above chart for the fill colors (default
is 0). Fill styles are as follows (default is 1):

Num Style
--- -----
0 No fill (for see-thru graphs; plots faster)
1 Solid fill
2 Fill with ---
3 Fill with ///
4 Fill with ///, thick lines
5 Fill with \\\, thick lines
6 Fill with \\\
7 Light hatch fill
8 Heavy crosshatch fill
9 Interleaving line fill
10 Widely spaced dot fill
11 Closely spaced dot fill

D Dot resolution - number of pixels per scan line for 2D and
polar graphs. Range is 1 thru 10; the amount of pixels will
be 2^(D-1). Default is 1.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 6


OPTIONS (continued)
-------------------

Option Description
------ -----------
FS GIF file save - GIF filename to save screen to after
plotting. A pixel will appear on the right side of the
current line being processed. When the pixel reaches the
bottom, the screen has been saved; if any key is pressed
before that time, the incomplete GIF file will be deleted.
Default is none.

L Line resolution - number of lines per unit for 3D graphs.
Range is 1 thru 5; number of lines will be 2^(L-1). Default
is 2.

RP Range of P - low and high range of variable P in r=f(p).
Ranges are any two numbers, as long as the low range is
less than the high range. If only one number is entered,
the range will be the negative value of the number to the
positive value. Defaults are 0,360.

RX Range of X - low and high range of variable X in y=f(x) and
z=f(x,y). Low range is -15 times the unit value (see option
U) to the high range. High range is the low range to 15
times the unit value. That can be expressed as:

-15*U <= low range < high range <= 15*U

If only one number is entered, the range will be the
negative value of the number to the positive value.
Defaults are -15,15.

RY Range of Y - low and high range of variable Y in x=f(y) and
z=f(x,y). Ranges and defaults:

Graph Range (See option U) Defaults
-------- --------------------------------------- --------
x=f(y) -10*U <= low range < high range <= 10*U -10,10
z=f(x,y) -15*U <= low range < high range <= 15*U -15,15

If only one number is entered, the range will be the
negative value of the number to the positive value.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 7


OPTIONS (continued)
-------------------

Option Description
------ -----------
S SVGA mode - type of Super VGA card in your system. Range is
0 thru 6, where:

Num SVGA Card
--- ---------
0 None
1 ATI
2 Orchid
3 Paradise
4 VEGA
5 Compro
6 SOTA

This option does nothing unless VGA/SVGA is detected, but
GRAPHITI cannot tell what type of SVGA card is present, so
do not use the S option without the proper card. If you are
not sure what type of video card you have, don't mess with
the S option - you may do harm to your video system.
Default is 0.

T True graph - whether 2D and polar graphs will just display
the plotted points (Y), or also attempt to draw connecting
lines between them (N). Default is N.

U Unit value - value of one unit (used for scaling). There
are ten units from the center of the screen to the top, and
the units are marked on the axis lines. Range is .0001 to
10000. Default is 1.


ERROR MESSAGES
--------------
Following are error messages you may come across, along with their
descriptions and corresponding DOS errorlevels:

Level Message & Description
----- ---------------------
1 Invalid command line options - GRAPHITI cannot understand
your input. Functions must start with "X=", "Y=", "Z=", or
"R=". Options must be in the form "OPTION:value[,value...]",
as in "u:2" or "rx:-3,5". Don't type the quotes! Case is not
important.

2 Graphics hardware not detected - either your computer is not
equipped with a graphics adapter, or GRAPHITI cannot
determine what type of adapter it is.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 8


ERROR MESSAGES (continued)
--------------------------

Level Message & Description
----- ---------------------
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 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.

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 - either there were an uneven amount
of parentheses, or a right paren was encountered before its
matching left paren.

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 Formula too complex - your function has 128 or more
references to constants and variables.

10 Formula cannot reference itself - the function variable on
the left side of the equals sign cannot be referred to on
the right side (as in "y=sin y").

11 Variable '(variable)' cannot be used in this function -
function must be in the form "x=f(y)", "y=f(x)", "z=f(x,y)",
or "r=f(p)".

12 Unable to open file '(file)' - the named GIF file cannot be
opened for writing.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 9


EXAMPLES
--------
GR y=sin x c:3 rx:0,10

displays a sine wave, using color #3 (cyan), and shows only the
part of the graph where X falls between 0 and 10.

GR x=tan(y) t:y d:4

displays a tangent wave using true graphing and a dot resolution of
4. If true graphing had been kept off, the asymptotes would have
been displayed, and they are not an actual part of the tangent
function. The resolution was increased so that more of the function
points would be plotted. (The D option is generally not needed if
true graphing is left off.)

GR r=p u:360 rp:7200 a:n

displays a polar graph with a unit value of 360 (meaning there are
now 3600 units from the center of the screen to the top), showing
all values where P >= -7200 and <= 7200 (since only one number was
used for the range), and keeping the axis lines off.

GR y=sqr abs cos x sgn cos x s:3

displays a 2D graph, using a Paradise SVGA card at 800x600. The
function could also have been written as

GR y=sqr(abs(cos(x)))*sgn(cos(x)) s:3 ,

either way is fine. BTW, the S option does nothing unless VGA/SVGA
is detected, but GRAPHITI cannot tell what type of SVGA card is
present, so do not use the S option without the proper card. If you
are not sure what type of video card you have, don't mess with the
S option - you may do harm to your video system.

GR z=cos((x*x+y*y)/20) l:3 c:2,1,9 fs:3d_cos

displays a 3D graph with a line resolution of 3 (l:3), in color #2
(green), with a fill color of 1 (blue), and fill style #9
(interleaving line fill). When finished, the screen will be saved
to file 3D_COS.GIF (.GIF is appended by default).

GR z=2sin(x*y/8) l:3 c:9,,0
displays a sine graph, with a fill style of 0 (no fill), which will
produce a see-thru graph. A fill color was not specified, but it
wouldn't have shown up anyway, due to the fill style.



GRAPHITI V1.05 Copyright (c) 1991-1992 Copy Con Incorporated Page 10


CREDITS
-------
GIF encoding routines based on code by David Rowley.

SVGA driver written by John Sieraski.

Much thankage to John "Catman" Lalmond and to Deborah Carey, the
original beta-testers.


CORRESPONDENCE
--------------
If you have questions, comments, suggestions, bug reports, etc.,
feel free to contact us by one of the following methods:

1: By modem at The Programmer's Corner (301-596-7692 or 410-995-6873).
Send a message to user number 3000, and check back in a couple of
work days for a reply.

2: By U.S. Mail at the address given on the first page. If you would
like a reply, please include a self-addressed, stamped envelope.

We look forward to hearing from you.


 December 16, 2017  Add comments

Leave a Reply