Dec 142017
 
Display equations in graphic format.
File EGAGRAPH.ZIP from The Programmer’s Corner in
Category Science and Education
Display equations in graphic format.
File Name File Size Zip Size Zip Type
EGAGRAPH.DOC 7611 3187 deflated
EGAGRAPH.EXE 89054 48928 deflated

Download File EGAGRAPH.ZIP Here

Contents of the EGAGRAPH.DOC file


Robert L. Clowers Programming language: BASIC
5114 Geyer Springs Rd. Egagraph.exe: 89k (object code)
Little Rock, Arkansas 72209 Egagraph.bas: 26k (source code)


Mathematical Descriptions


I searched and searched the bulletin boards for a program
that would demonstrate a combination of mathematics and graphing
plus show off my EGA monitor (this program also works with CGA).
I found only a few programs, and they were either too short or
too similar to each other. I was wanting a program that would
plot hyperbolas, parabolas, ellipses, sin wave functions,
cycloids, polar coordinates and the like. Plus I wanted some
stuff that would just look neat on the screen! Back in the
summer I "discovered" how to plot some simple parametric
equations, and that opened up a whole can of worms for me. I
decided I would have to write my own program! I have a
background in math, so I promptly turned to my old (now ancient)
classroom notes and searched through a number of my old textbooks
to find corresponding inspiration.
This program--Mathematical Descriptions--is essentially a
series of individual programs that have been combined into one
larger program through an integrated menu system.
When you enter "egagraph" at the DOS prompt, an introductory
screen will inquire if your monitor is EGA or CGA compatible.
With EGA you get full color; CGA is in black and white. After
selecting the appropriate monitor compatibility, you will next
view a screen that displays the following descriptive text:

Most of the mathematical functions or relations found here
are seen in algebra, trigonometry, or calculus textbooks.
The "fun stuff" are merely variations! The input values
vary for each of these descriptions. In some cases, small
values are appropriate (as with y = sin x), while larger
values are better for others (such as the ellipse or
circle). The Cardioid is most versatile: a value of 1 is
interesting as is a value of 782.9 or 785. Some
descriptions, such as the Cycloid and Epicycloid, are
"fragile" and require experimentation with the entered
values before they will begin to look like they should. All
entered values must be followed by the return key. In cases
where too large a value is entered, either the screen will
appear blank for a period of time before there is any
visible output, or you will get an error message (in which
case you must restart this program). All entered values
should be greater than zero. Negative numbers give
unpredictable results. Generally speaking, most of the
values you enter will be between one and 50. In some
cases, values up to 1000 could prove interesting. You
are encouraged to try any values you like as well as
mix the major and minor axis values. Pressing the
return key without entering a value will return the
main menu.

Following the descriptive screen, the main menu comes next.
Simply press the letter or number corresponding to the program
you want to run. Each program will then prompt you for some
value; enter a value and press the return key to start that
program. Pressing the return key once during the execution of
the lengthier programs will suspend those computations and return
you to that program's initial prompting; pressing the return key
alone at any individual program's initial prompting will return
you to the main menu. As the screen with the descriptive text
will indicate, most of the values you enter will be between 1 and
50. For some of the programs, such the probability curve, the
useful values you enter will be small, for example, ranging from
1 to 6. The logarithm function, y = ln(x), has a useful range of
1 to 250. For the cycloid, try values of 5 and 2 or 15 and 3 for
the major and minor axis values respectively. When running the
epicycloid, try values for the major axis that are multiples of
the minor axis, such as 24 and 6. Note: entering too large a
value, such as 10 for y = tan(x), will cause an overflow and the
program will end. Just restart if this occurs.
Some of the "just for fun to look at stuff" include the
filled rectangles (try values from 1 to 500), filled targets (try
1 second), random lines (try 1 to whatever), random ellipses (my
favorite--try 3 seconds), the slinky (try 10 and 35), the slinky
atom (try 3 or 9), and so forth.
The slinky itself needs some explanation; it is the only one
of the programs that make use of the function keys, in this case
F1 and F2. The F1 key will simply pause the program after the
current "leg" it is drawing has been completed; this allows you
to look at your work without the slinky continuing to move
around; pressing any other key after it has paused will resume
the program. The F2 key is used to overlay the drawing of one
slinky diameter size with that of another; pressing F2 while the
program is drawing will cause what is being drawn to pause much
like the F1 key except that you will also be prompted for another
diameter value; entering a second (or a third, forth, etc.) value
will draw a slinky over what has already been drawn. If you
press the return key rather that the F1 or F2 keys, the image
will be interrupted immediately, and you will be prompted for
another diameter value. If you press the return key at the
diameter prompt without entering a value, you are returned to the
main menu. The purpose of the F1 and F2 keys is simply to make
the slinky drawing neater and more controllable. Try this: when
prompted for a diameter value, enter 10 and press return; then
watch it go around for a while; next press the F2 key and enter a
value of 35 and press return; watch this cycle for a while; if
you see a design appear that is especially interesting, press the
F1 key, and it will pause until you press any other key to
continue. You will find that you are able to create an infinite
number of graphic designs this way.
The Pythagorean triples program is perhaps the most
dissimilar of the programs. This program calculates the
instances where a right triangle is formed when the sum of the
squares of two legs of a triangle is equal to the square of the
hypotenuse of the formed triangle using whole number values. The
term "lower bound" refers to the smallest hypotenuse you wish to
look for. The term "upper bound" refers to the largest
hypotenuse you wish to look for. For example, if you enter 1 for
the lower bound and 10 for the upper bound, you will find that
there are 2 right triangles formed from whole numbers when the
hypotenuse was attempted for all whole number values ranging
through 10.
As a postscript to this text, I should make note of the use
of the source code as a learning tool. The 33 different modules
that comprise this overall program can be examined for
programing techniques to make various graphic images. Writing
this program has been a true learning experience for myself!
An examination of the source code will reveal a piecemeal approach.
While the modules were originally written and tested independent of
the main program, they were only slightly modified before being
added to the main program. Please feel free to write for information
concerning the source code.

DISCLAIMER: THE AUTHOR OF THIS PROGRAM ASSUMES NO RESPONSIBILITY
FOR ITS USE OR THE CONSEQUENCES RESULTING FROM ITS USE!


 December 14, 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)