Dec 092017
Excellent equation plotter that works with EGA.
File AGR.ZIP from The Programmer’s Corner in
Category Printer + Display Graphics
Excellent equation plotter that works with EGA.
File Name File Size Zip Size Zip Type
AGR.BAS 38439 9064 deflated
AGR.EXE 86784 38334 deflated
README 7040 2977 deflated

Download File AGR.ZIP Here

Contents of the README file

Instructions for

A Graphing Routine

This program requires EGA and displays 2- and 3-dimensional graphs in
vivid color on a color monitor. It displays quite well on mono-
chrome, too. The original program, written in Turbo Basic, is in-
cluded for your convenience. The program is quite self-explanatory,
but we shall present a guide to its features. An 8087 mathematics
coprocessor chip is highly recommended, as this speeds graphing

You are first asked if you want to write the functions in AOS or RPN
logic. AOS is the logic of Texas Instrument calculators and is the
way one ordinarily writes algebraic expressions. RPN is the logic of
Hewlett-Packard scientific calculators. Consult these manufacturers
if you need instructions in the logics. AOS is easier for the
programmer to write, but the graphs will run faster if the functions
are written in RPN.

You then choose whether you want to graph in 2 or 3 dimensions and
whether the graph should be written in ordinary rectangular coordi-
nates (y = f(x) or z = f(x,y)) or in parametric rectangular coordi-
nates (x = f(t), y = g(t) in 2 dimensions, or x = f(u,v), y = g(u,v),
z = h(u,v) for 3-dimensional surfaces). Curves in space are always
entered in the form x = f(t), y = g(t), z = h(t). In 2 dimensions
you have the third option of polar coordinates r = f(t), where t is
used for theta in radians.

You have the chance to correct entry errors reasonably often, since
you are frequently asked if everything is ok. Hit "n" to go back and
change the latest choices.

When you are asked to enter a function, you are told the logic you
have chosen and the functions available to you. USE LOWER CASE
VARIABLES ONLY! This program does not recognize upper case letters
at all. Note that "sqr" and "cube" square and cube the variables
they follow whereas "sqrt" and "cuberoot" take the square and cube
roots of their variables. In AOS, only the functions "sqr" and
"cube" follow their variables (so "3 sqr" yields 9); all other
operators precede their variables in AOS logic.

In RPN logic, the space is the delimiter (so "5 2 sin +" produces
5 + sin 2 = 5.909...). There is no "enter" instruction: "x" recalls
the value of x whenever it appears, and "sto1", "sto2", and "sto3"
allow you to store three (awkward) values for recall later in the
expression (so "x sqr y sqr + sto1 chs exp rcl1 /" computes
2 2
-(x + y ) 2 2
e /(x + y ),
for example).

In AOS logic the space is the delimiter, but so also are +, -, *, /,
^, (, and ) delimiters (so the displayed expression above would be
entered as "exp(-x sqr-y sqr)/(x sqr+y sqr)", with additional spaces
added as desired for clarity). Do not put spaces in the middle of a
word ("ex p" will not be read as "exp").

You are asked for minimum and maximum values of the variables. The
first values must be less than the second one and they can be sepa-
rated by either a space or a comma. Many entry errors will be caught
immediately and you will be asked to re-enter the values. You can
correct other errors by answering "n" to the "Is everything ok?"
question that always follows shortly.

After you have entered the functions and the variable limits, you are
asked "Plot every nth pixel for n =" when you are in 2-dimensional
rectangular coordinates. The screen has 640 pixels across. For most
graphs it is sufficient to plot every 2nd to every 5th pixel. The
program draws straight lines between plotted points. Thus you would
usually enter a positive integer from 1 to 10 here, but it could be
any positive number. For certain graphs with great variation, it may
be appropriate to plot even more points than the 640 screen pixels.
The smaller n is, the longer the graph takes to plot and the more
accurate it is. I usually use n = 3 for most graphs.

For polar graphs I usually use n = 20 when asked the corresponding
question. This plots 144 points. Again, n must be positive. The
next question asks where, in revolutions, you want to start and stop
plotting. For example, to let theta run from -pi/2 to +pi/2, you
would enter "-1/4, 1/4". Polar graphing also asks whether you want
coordinate circles plotted. The usual answer is "y" for yes. Then
you can estimate coordinates better.

For 3-dimensional graphs you are asked how many lines you would like
in the x- and y-directions (or in the u- and v-directions). You can
use any number from 1 to 80. Generally 5 to 40 lines give a good
graph. The number of points plotted is the product of one more than
each of the two numbers. Thus for 5 lines in the u-direction and 40
in the v-direction, the program will plot a grid of 6x41 = 246
points. The time required to do the plotting varies accordingly. If
you are graphing a space curve, you are asked "How many t-values?".
Generally 40 to 100 points suffice, although 1 to 2000 will be

After a 3-dimensional plot is completed, you must hit any key to see
the function displayed. Two-dimensional graphs automatically display
the function when graphing is complete. To continue, hit any key
(again). You are asked "Do you want to graph this same function
again?" If you answer "y", you can re-enter the variable limits and
re-graph the last function that you just graphed. Thus you can
"zoom" any function after graphing it, without having to re-enter
the function. If you answer "n", then you are asked if you want to
graph another function on top of this one. A "y" answer allows you
choose (in most cases) whether you want to use a new color and then
to enter a new function and plot it on the same axes on top of the
previously-plotted graph(s). Another "n" answer and you are asked
to decide whether you want to quit or start over right from the

beginning. A "p" answer (plot a new graph) saves you from having to
load the program again.

The 3-dimensional rectangular graph (only) has a built-in hidden-
line routine included. Also the "underside" of the graph is a
different color from the "top" of the graph. Hence plotting another
graph on top of such a graph, although permitted, is not recommended.
Also, the colors do not change here when a new graph is plotted.

This program is supplied as shareware. You are encouraged to pass
it along to others, along with the original Turbo Basic listing and
this file. If you use this program, you are asked to mail $5 to
the author, listed below. If you wish the latest version of this
program on disk, please send $10. The first person sending any
valid correction to the program will receive a free update disk.

Send your $5 or $10 to

Clayton W. Dodge
Mathematics Department
University of Maine
Orono, Maine 04469
AGR, ver. 1.00

 December 9, 2017  Add comments

Leave a Reply