Dec 092017
 
Parametric plotting with full Basic source code.
File AGR103.ZIP from The Programmer’s Corner in
Category Science and Education
Parametric plotting with full Basic source code.
File Name File Size Zip Size Zip Type
AGR103.BAS 54228 12647 deflated
AGR103.DOC 8448 3560 deflated
AGR103.EXE 109334 42034 deflated

Download File AGR103.ZIP Here

Contents of the AGR103.DOC file








Instructions for

A Graphing Routine

version 1.03


This program requires 320K of RAM and works on EGA or CGA, displaying
2- and 3-dimensional graphs in vivid color on a color monitor. It
also displays quite well on monochrome, too. An 8087 mathematics
coprocessor chip is highly recommended, as this speeds graphing
considerably. The original program, written in Turbo Basic, is
included on this disk for your convenience. The program is quite
self-explanatory, but we shall present a guide to its features.
After the opening credits, you are shown instructions for writing 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,
especially with longer functions.

In RPN logic, "5 2 sin +" produces 5 + sin 2 = 5.909...). This
program does not recognize the "enter" instruction: "x" recalls
the value of x whenever it appears, and "sto1", "sto2", and "sto3"
allow you to store three 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 either logic delimiters are the space, +, -, *, /, ^, and in AOS
( and ). Hence in AOS logic the displayed expression above would be
entered as "exp(-x sqr-y sqr)/(x sqr+y sqr)", with additional spaces
inserted as desired for clarity. Do not put spaces in the middle
of a word ("ex p" will not be read as "exp").

Available functions include the arithmetic operations of addition +,
subtraction -, multiplication *, division /, and raising to a power
^. Thus 2^3 in AOS logic (or 2 3^ in RPN) produces 2 to the third
power or 8. Other functions include absolute value (abs), sign (sgn)
(sgn x = 1 if x > 0, sgn x = 0 if x = 0, and sgn x = -1 if x < 0),
greatest integer (int) (int x returns the largest integer less than
or equal to x), square root (sqrt), cube root (cuberoot), square
(sqr), and cube (cube). Trigonometric functions include sin, cos,
tan, arctan, all given in radian measure. Other transcendental
functions available are natural logarithm (ln), base ten logarithm
(log), and the natural exponential (exp).

Next you will be shown one of five graphing menus. All menus have
the following common features. At the extreme top or bottom is a
statement of the menu type: 2- or 3-dimension and parametric,
rectangular, or polar. When this statement is highlighted, hit
to toggle to next menu. Near the top right of the screen is
a logic statement. When this is highlighted, toggles
between AOS and RPN logic. "Insert Mode" toggles between insert and
overwrite (for editing functions) by -v or . "EGA Mode"
toggles between EGA and CGA-low resolution and CGA-high resolution.
Full color is obtained in EGA mode, but the utility program
GRAPHICS.COM allows a graph to be printed when you use either CGA
mode.

At the bottom of the screen, "Quit" toggles between yes and no. If
yes, then terminates the program and returns you to DOS.
"Return to opening menu" also toggles between yes and no. if yes,
then returns to the opening statement so you can read the
function instructions again. All variable choices are cancelled.
Above that are two statements. The first allows you to draw an
entirely new graph on new axes (new) or draw on top of the existing
graph (old). If present, the second statement allows you to chose
whether you want the new graph in a new color (new) or the same color
as the last graph (same).

In EGA mode the first color used is bright yellow. If you toggle
through the graphic sequence, returning to EGA mode, the graphing
color is returned to yellow.

On the right side of each menu is a set of general instructions for
using the menu.

Initial values have been selected when a menu appears. These may be
left alone, if they are o.k. Otherwise highlight the item by using
the up and down arrow keys to move from one item to the next. Then
hit to toggle items that can be toggled, or enter new
functions or values by typing (lower case letters only, please) the
new value or function. Existing functions can be edited. Highlight
the function. Then hit either left or right arrow. A green block
appears at the highlighted character. Typing a character now either
inserts or overwrites, according to the insert toggle setting. Use
the left and right arrows to move to the desired location. Use
or -g to delete the character at the cursor, backspace to
delete the preceding character. When done, the up and down arrows
end the editing session and move you to the next block.

When all values have been chosen as desired, hit . "Quit" takes
first precedence, "Return to opening menu" is second. Otherwise the
graph you have selected will be plotted. After a 3-dimensional graph
plots, hit any key and the function equations will be displayed at
the bottom of the graph. The functions display automatically for a
2-dimensional graph. Then hit any key to return to the menu. To
quit the program, hit the up arrow to highlight "Quit", hit ,
and .

"Reasonable" values have been selected when opening menus display.
For parametric curves, "How many t-values?" selected the number of
points plotted across the screen. Generally 40 to 400 is suitable,
but 1 or greater is acceptable. The larger the value, the longer the
plot takes. The number of lines in the u- or v-direction or in each
direction is generally 15 to 40, but may be 1 to 80. Time necessary
to draw the graph increases rapidly as these values are taken larger.
The larger this value, the more detail is shown on the graph.
For polar graphs, 2880 t-values are allotted, far too many in
general. Plotting every 10th to 50th pixel generally produces a
sufficiently smooth graph in a reasonable time. Usually graphs in
color look best if coordinate circles are printed, but try it both
ways. Theta (t) normally runs from 0 to 2 pi = 6.283. Any real
values may be used here. For example taking t = -.25 to t = .25 lets
theta run from - pi/2 to + pi/2.

Finally, in 2-dimensional rectangular coordinates, the screen has 640
pixels in EGA (320 in CGA lo res) horizontally. Plotting every 3rd
to 10th pixel is generally sufficient. This value can be any
positive number (using .5, for example evaluates the function 1280
times). In all graphs, straight lines are drawn between plotted
points, so the smaller this number is, the better the graph looks.

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.
Thus, you should always use coordinates that increase from minimum to
maximum. On the other rectangular graphs you can go from large to
small from left to right or down to up, but avoid such irregular
choices on the 3-dimensional rectangular graph.

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 registered owner sending
any valid correction to the program will receive a free update disk.
This program is supplied "as is." There are no warrantees whatever.

Send your $5 or $10 to

Clayton W. Dodge
Mathematics Department
University of Maine
Orono, Maine 04469
AGR, ver. 1.03
June 7, 1988


 December 9, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)