home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Fest 1993
/
gamefest1993stgcomputerslimited1993.iso
/
soft
/
ed
/
pro5
/
mathplot.doc
< prev
next >
Wrap
Text File
|
1992-03-31
|
43KB
|
1,051 lines
M A T H P L O T
Mathematical Function Plotting Program
Phillip H. Sherrod
A "shareware" program.
MATHPLOT allows you to specify complicated mathematical
functions using ordinary algebraic expressions and
immediately plot them. Four types of functions may be
specified: cartesian (Y=f(X)); parametric cartesian
(Y=f(T) and X=f(T)); polar (Radius=f(Angle)); and
parametric polar (Radius=f(T) and Angle=f(T)). Up to
four functions may be plotted simultaneously. Scaling
is automatic. Options are available to control axis
display and labeling as well as grid lines. Hard copy
output may be generated as well as screen display.
MATHPLOT is an ideal tool for engineers, scientists,
math and science teachers, and anyone else who needs to
quickly visualize mathematical functions.
MATHPLOT -- Mathematical Function Plotter Page 1
INTRODUCTION
MATHPLOT is a program for IBM-PC computers which allows
interactive entry and plotting of mathematical functions. Some
of the features of MATHPLOT are listed below:
Direct entry of complicated mathematical functions
using normal algebraic expressions with embedded
operators and functions.
An assortment of built-in functions including
trigonometric, square root, log, Gamma, Bessel,
elliptic integrals, normal probability distribution,
etc.
The ability to plot four types of functions: cartesian
(Y=f(X)); parametric cartesian (Y=f(T) and X=f(T));
polar (Radius=f(Angle)); and parametric polar
(Radius=f(T) and Angle=f(T)).
The ability to simultaneously plot up to four
functions.
Automatic scaling and axis labeling.
The ability to save function specifications in command
files which then can be easily executed.
The ability to accept X-Y data points from an external
file.
Printed copies of plots may be produced on HP LaserJet
printers.
MATHPLOT -- Mathematical Function Plotter Page 2
INSTALLING MATHPLOT
The MATHPLOT system consists of the following files:
MATHPLOT.EXE -- The executable program.
MATHPLOT.HLP -- Text file accessed by HELP command.
MATHPLOT.FON -- Font file used for title line and axis labels.
MATHPLOT.LJF -- Font file for HP LaserJet printer.
MATHPLOT.FUN -- Example functions
MATHPLOT.DOC -- Documentation file.
To install MATHPLOT, copy the files into the directory of your
choice. If you do not plan to generated hard copy output for a
LaserJet printer, you may delete the MATHPLOT.LJF file. If the
MATHPLOT.HLP, MATHPLOT.FON, and MATHPLOT.LJF files are not in
your current directory, you must place a command of the following
form in your AUTOEXEC.BAT file to tell MATHPLOT where to look for
its help and font files:
SET MATHPLOT=directory
Where "directory" is the name of the device and directory where
the files are located. For example, if the files are located in
a directory named MATHPLOT on the C disk, the following command
could be used:
SET MATHPLOT=C:\MATHPLOT
GETTING STARTED
MATHPLOT is exceptionally easy to use. Although there are a fair
number of commands to control options, you only need to know a
couple of commands to begin using it.
Start the program by entering the command:
MATHPLOT
MATHPLOT will display a title screen; press Enter to proceed to
command mode. MATHPLOT prints a greater-than sign (">") to
prompt you for a command. Begin by specifying a simple function
to be plotted. I suggest you enter the command:
MATHPLOT -- Mathematical Function Plotter Page 3
Y=SIN(X)
You may use either upper or lower case letters when you type a
command. Next, command MATHPLOT to evaluate this function and
plot the results by entering the command:
PLOT
You should see a sine wave displayed on your screen. Press Enter
to return to command mode. Now let's make the function slightly
more complicated by entering the command:
Y=SIN(X)+SIN(3*X)/3
Enter the PLOT command again to see this function plotted.
So far, the function has been evaluated over the interval
(0,2*pi), which is the initial default domain. Use the following
command to change the domain to (-2*pi,2*pi):
DOMAIN -2*PI,2*PI
Also, use the following command to turn on grid line display:
GRID ON
Now use the PLOT command to display the result. As a final
exercise, use the following command to define a second function
to be displayed simultaneously with the first one:
Y2=SIN(X)
And, again use the PLOT command to display them. You should see
a simple sine wave (the Y2 function) superimposed on the previous
function (the Y function). Use the EXIT command to exit MATHPLOT
and return to DOS.
Demonstration Command File
The MATHPLOT distribution includes a command file named
MATHPLOT.FUN containing a number of interesting example plots.
You can execute this command file by using the MATHPLOT "DO"
command, or by specifying the command file on the invocation
line. The following DOS command starts the MATHPLOT program and
instructs it to execute the commands stored in the file
MATHPLOT -- Mathematical Function Plotter Page 4
MATHPLOT.FUN:
MATHPLOT MATHPLOT.FUN
MATHPLOT -- Mathematical Function Plotter Page 5
FUNCTION SPECIFICATION
Much of the power of MATHPLOT comes from its ability to evaluate
complicated functions entered in ordinary algebraic form. This
section explains the arithmetic operators and built in functions
that are used to define a function.
Arithmetic Operators
The following arithmetic operators may be used in expressions:
+ addition
- subtraction or unary minus
* multiplication
/ division
** or ^ exponentiation
Exponentiation has the highest precedence, followed by
multiplication and division, and then addition and subtraction.
Parentheses may be used to group terms.
As a convenience, MATHPLOT allows you to omit the multiplication
operator between a numeric constant and a following variable or
function. For example, the expressions "2pi", and "2 pi" are
equivalent to "2*pi". Similarly, "5X" is equivalent to "5*X".
However, if you specify a number before the letter "E", it will
be taken as the exponential form of a number (see below) rather
than the number times the constant E (base of natural
logarithms).
Numeric Constants
Numeric constants may be written in their natural form (1, 0,
1.5, .0003, etc.) or in exponential form, n.nnnEppp, where n.nnn
is the base value and ppp is the power of ten by which the base
is multiplied. For example, the number 1.5E4 is equivalent to
15000. All numbers are treated as "floating point" values,
regardless of whether a decimal point is specified or not.
Symbolic Constants
There are two numeric constants that may be specified using
symbolic names. The symbolic name "PI" is equivalent to the
value of pi, 3.14159... Similarly, the symbolic constant "E" is
equivalent to the base of natural logarithms, 2.7182818...
MATHPLOT -- Mathematical Function Plotter Page 6
Parameter values
MATHPLOT allows you to use parameters named P0, P1, ..., P9 in
function definitions. You can then assign values to the
parameters and replot the function without having to retype the
function to change a value. To assign a value to a parameter,
type the parameter name as a command followed by the value to be
assigned. For example, the following command assigns the value
0.67 to the parameter P0:
P0 0.67
Note that parameters are like constants during the evaluation and
plotting of a function (i.e., their values do not change). But
you can assign new values to parameters between plot generations.
For example, consider the following commands which define a
function and then plot it twice with two different values of the
P0 parameter:
Y = EXP(-P0*X) * COS(X)
P0 0.6
PLOT
P0 0.8
PLOT
This function represents the response of a damped oscillator with
the P0 coefficient controlling the damping factor. By changing
the value of the P0 parameter you can examine different forms of
the function without having to retype the function.
Built in Functions
The following functions are built into MATHPLOT and may be used
in expressions:
ABS(x) -- Absolute value of x.
ACOS(x) -- Arc cosine of x. Angles are measured in radians.
ASIN(x) -- Arc sine of x. Angles are measured in radians.
MATHPLOT -- Mathematical Function Plotter Page 7
ATAN(x) -- Arc tangent of x. Angles are measured in radians.
BETAI(x,a,b) -- Incomplete beta function: Ix(a,b). The
incomplete beta function can be used to compute a
variety of statistical functions. For example, the
probability of Student's t with `df' degrees of freedom
can be computed with BETAI(df/(df+t^2),.5*df,.5). The
probability of the F statistic with df1 and df2 degrees
of freedom can be computed with
2*BETAI(df2/(df2+df1*f),.5*df2,.5*df1).
COS(x) -- Cosine of x. Angles are measured in radians.
COSH(x) -- Hyperbolic cosine of x.
COT(x) -- Cotangent of x. (COT(x) = 1/TAN(x)).
CSC(X) -- Cosecant of x. (CSC(x) = 1/SIN(x)).
DEG(x) -- Converts an angle, x, measured in radians to the
equivalent number of degrees.
EI1(alpha,phi) -- Elliptic integral of the first kind. Computes
the integral from 0 to phi radians of the function
d.phi/sqrt(1-k**2*sin(phi)**2), where k = sin(alpha).
alpha and phi must be in the range 0 to pi/2.
EI2(alpha,phi) -- Elliptic integral of the second kind. Computes
the integral from 0 to phi radians of the function
sqrt(1-k**2*sin(phi)**2)*d.phi, where k = sin(alpha).
alpha and phi must be in the range 0 to pi/2.
EIC1(alpha) -- Complete elliptic integral of the first kind.
Computes the integral from 0 to pi/2 radians of the
function d.phi/sqrt(1-k**2*sin(phi)**2), where
k = sin(alpha). alpha must be in the range 0 to (less
than) pi/2.
EIC2(alpha) -- Complete elliptic integral of the second kind.
Computes the integral from 0 to pi/2 radians of the
function sqrt(1-k**2*sin(phi)**2)*d.phi, where
k = sin(alpha). alpha must be in the range 0 to pi/2.
MATHPLOT -- Mathematical Function Plotter Page 8
ERF(x) -- Standard error function of x.
EXP(x) -- e (base of natural logarithms) raised to the x power.
FAC(x) -- x factorial (x!). Note, the FAC function is computed
using the GAMMA function (FAC(x)=GAMMA(x+1)) so
non-integer argument values may be computed.
GAMMA(x) -- Gamma function. Note, GAMMA(x+1) = x! (x factorial).
GAMMAI(x) -- Reciprocal of GAMMA function (GAMMAI(x) =
1/GAMMA(x)).
GAMMALN(x) -- Log (base e) of the GAMMA function.
HAV(x) -- Haversine of x. (HAV(x) = (1-COS(x))/2).
J0(x) -- Bessel function of the first kind, order zero.
J1(x) -- Bessel function of the first kind, order one.
JN(n,x) -- Bessel function of the first kind, order n.
LOG(x) -- Natural logarithm of x.
LOG10(x) -- Base 10 logarithm of x.
MAX(x1,x2) -- Maximum value of x1 or x2.
MIN(x1,x2) -- Minimum value of x1 or x2.
NORMAL(x) -- Normal probability distribution of x. X is in units
of standard deviations from the mean.
PAREA(x) -- Area under the normal probability distribution curve
from -infinity to x. (i.e., integral from -infinity to
x of NORMAL(x)).
PULSE(a,x,b) -- Pulse function. If the value of x is less than a
or greater than b, the value of the function is 0. If
x is greater than or equal to a and less than or equal
to b, the value of the function is 1. In other words,
it is 1 for the domain (a,b) and zero elsewhere. If
you need a function that is zero in the domain (a,b)
and 1 elsewhere, use the expression (1-PULSE(a,x,b)).
MATHPLOT -- Mathematical Function Plotter Page 9
RAD(x) -- Converts an angle measured in degrees to the equivalent
number of radians.
SEC(x) -- Secant of x. (SEC(x) = 1/COS(x)).
SIN(x) -- Sine of x. Angles are measured in radians.
SINH(x) -- Hyperbolic sine of x.
SQRT(x) -- Square root of x.
STEP(a,x) -- Step function. If x is less than a, the value of
the function is 0. If x is greater than or equal to a,
the value of the function is 1. If you need a function
which is 1 up to a certain value and then 0 beyond that
value, use the expression STEP(x,a).
T(n,x) -- Chebyshev polynomial of order n.
TAN(x) -- Tangent of x. Angles are measured in radians.
TANH(x) -- Hyperbolic tangent of x.
Y0(x) -- Bessel function of the second kind, order zero.
Y1(x) -- Bessel function of the second kind, order one.
YN(n,x) -- Bessel function of the second kind, order n.
MATHPLOT -- Mathematical Function Plotter Page 10
FUNCTION TYPES
MATHPLOT allows four different types of functions to be plotted:
cartesian, parametric cartesian, polar, and parametric polar.
Each of the function types is described below:
Cartesian Functions
A cartesian function has the form Y=f(X), where X is the
independent variable that is plotted along the horizontal axis
and Y is the dependent variable plotted on the vertical axis.
The value specified with the DOMAIN command controls the interval
of X values over which the function is evaluated. Some examples
of this type of function are listed below:
Y=SIN(X)
Y=2*X**2-3*X+5
Y=SIN(X)/EXP(X)
Y=1/SQRT(2*(X+1))
Parametric Cartesian Functions
Parametric functions use a third variable, which we will call T,
as the independent variable. Both X and Y are dependent
variables defined as functions of T. The value of the T variable
is not directly displayed on the plot but is used only in the
functions that define the values of the X and Y variables that
are plotted. For example, the following commands define X and Y
as functions of T:
X=COS(T)
Y=SIN(T)
When parametric functions are defined, the DOMAIN statement
specifies the interval over which the T variable is computed. If
the two functions of X and Y specified above are plotted over the
domain (0,2*PI), the result is a circle with radius 1 centered
around the origin.
Polar Functions
A polar function specifies the distance (or radius) of a point
from the origin as a function of the angle swept around the
origin. The angle (A) is the independent variable and the radius
(R) is the dependent variable. The DOMAIN statement specifies
MATHPLOT -- Mathematical Function Plotter Page 11
the interval of values that the angle is to be evaluated over.
The angle begins on the positive X axis; positive angles are
measured counterclockwise around the origin. Angles are measured
in radians; the RAD and DEG functions can be used to convert
between degrees and radians. The simplest polar function is
R=1
which specifies that for all angles the radius is 1. If this
function is plotted over the domain (0,2*pi) the result is a
circle of radius 1 centered around the origin. Another simple
polar function is
R=A
which defines a spiral with the radius increasing with the angle.
Parametric Polar Functions
A parametric polar function defines the radius (R) and angle (A)
as functions of the parametric variable, T. The DOMAIN statement
defines the interval of T values over which the function is
evaluated. The following is an example of a parametric polar
function definition:
R=COS(T)
A=SIN(T)
Over the domain (0,2*pi), this produces a figure-eight pattern.
PLOTTING SIMULTANEOUS FUNCTIONS
Up to four functions may be plotted at the same time. When
defining multiple functions, add a single-digit suffix to the
dependent variable name for the function. For example, the
following commands define four functions to be plotted
simultaneously:
Y1=SIN(X)
Y2=COS(X)
Y3=SIN(2*X)
Y4=COS(2*X)
MATHPLOT -- Mathematical Function Plotter Page 12
If no number is specified, the default value is 1. Thus, the
following two function definitions are equivalent:
Y=2*X**2
Y1=2*X**2
You can remove a function definition by defining another function
for the same dependent variable or by specifying the dependent
variable without a function. For example, the following command
removes the definition for Y2:
Y2
When a function of a type (cartesian, polar, etc.) different from
the current type is defined, all of the currently defined
functions are removed.
MATHPLOT -- Mathematical Function Plotter Page 13
MATHPLOT COMMANDS
The commands described in this section are used to control
MATHPLOT. When MATHPLOT is waiting for a command, it displays a
greater-than sign (">") as a prompt. If you need to type a
command that is longer than a single line, you may continue a
command by typing a minus sign as the last character on the line
to be continued. When MATHPLOT detects a minus sign as the last
character of a line, it deletes the minus sign and requests
additional command input using the prompt "->".
Commands may be abbreviated to the first three letters of their
keyword. Commands may be typed using upper or lower case
letters.
You may place comments on commands by preceding the comment by an
exclamation point. For example, the following commands have
comments:
! Define square wave function
Y=SIN(X)+SIN(3*X)/3 ! Approximate square wave
DOMAIN 0,2*PI ! One cycle of the function
Startup Command File
The DOS command to start MATHPLOT is:
MATHPLOT [filename]
where "filename" is an optional parameter specifying the name of
a file containing commands to be executed by MATHPLOT as soon as
it is started. This startup command file may contain commands to
set preferred default values, or it may contain one or more
complete sets of statements to define functions and plot them.
The default file extension is ".FUN". See also the descriptions
of the DO and SAVE commands for additional information about
command files.
Initialization file
Each time Mathplot is started it attempts to open a file named
MATHPLOT.INI. If this file exists, all commands in it are
executed. You may create such a file to contain initialization
commands to set default values. For example, if you normally
like to have grid lines turned on, create a file named
MATHPLOT -- Mathematical Function Plotter Page 14
MATHPLOT.INI containing the command "GRID ON". Mathplot looks
for this file first in the current directory and if it does not
find it there it checks to see if a MATHPLOT environment variable
has been defined to specify a directory. The initialization file
is executed before any file specified on the command that starts
Mathplot.
Command Arguments
Many of the commands accept numeric arguments. In the
descriptions below, the notation "cexpr" is shown wherever a
numeric argument may be specified. These numeric arguments may
consist of numbers, symbolic constants, and expressions using
operators and built in functions. For example, the following is
a valid DOMAIN command:
DOMAIN -2*PI,PI*SQRT(2)
The argument expressions may NOT contain variables such as X, Y,
R, A, or T, or parameters such as P0 or P1.
Arguments shown in brackets are optional. Braces around a set of
options indicate that you must choose one of the options in the
set.
ALPHABETICAL LIST OF COMMANDS
AXES {ON | OFF} (default=ON) -- Specifies whether to display axes
without labels. Use the LABELS command to display axes
with labels.
CALCULATE cexpr -- Evaluate the specified expression, which must
contain only numbers, operators, and built in functions,
and print the result.
CAXES cexpr (default=3) -- Specify the color to be used for the
axis lines and labels.
CFn cexpr (default=2,1,4,3) -- Define the color to be used when
plotting function 'n'. For example, the command "CF1 3"
specifies that color 3 is to be used when plotting
function 1.
MATHPLOT -- Mathematical Function Plotter Page 15
CGRID cexpr (default=8) -- Specify the color to be used for grid
lines.
CLEAR -- Clear the screen.
COMMONSCALE {ON | OFF} (default=OFF) -- If this option is turned
on, the X and Y directions are forced to have the same
scale. If this option is off, the X and Y ranges are
scaled independently, which may cause figures to be
distorted - for example, a circle may display as an
ellipse. However, turning this option on may result in
one of the dimensions using only a small portion of the
screen if the X and Y ranges are very different. This
option is always on for polar function plots.
CTITLE cexpr (default=7) -- Specify the color to use for the
title line.
DATA filename -- Causes X and Y data values to be read from an
external file rather than being computed as function
definitions. After the data has been read, use the PLOT
command to display it. Any function definition following
this command will clear the external data values and
revert to function mode. Each X,Y data pair must be
specified as a separate line in the file with a space
separating the X value from the Y value. The default
extension for the file is ".DAT".
DISPLAY string -- Display the string on the console. This
command may be placed in command file to cause
information to be printed while the command file is being
processed.
DO filename -- Execute the MATHPLOT commands stored in an
external file. This allows you to specify a complete
plot request, including functions and options, and then
execute it without having to retype the commands. An
external file may itself contain a DO command and this
nesting may be performed to a depth of 10 files. The
default file extension is ".FUN". See also the
description of the SAVE command.
MATHPLOT -- Mathematical Function Plotter Page 16
DOMAIN cexpr1,cexpr2 (default=0,2*pi) -- Define the domain of the
independent variable over which the functions are
evaluated and plotted. The lower end of the domain
(cexpr1) must be less than the upper end (cexpr2). This
command may be abbreviated to "DOM".
EXIT -- Stop MATHPLOT and return to DOS.
GRID {ON | OFF} (default=OFF) -- Specify whether grid lines are
to be displayed.
HELP -- Display several pages of help text.
LABEL {ON | OFF} (default=ON) -- Specify whether axes with labels
are to be displayed.
LIST {ON | OFF} (default=OFF) -- Specify whether commands
executed from an external file by use of the DO command
are to be listed as they are executed.
NUMPOINTS cexpr (default=100) -- Specify the number of points at
which the functions are to be evaluated over the domain.
Specifying a larger number of points results in a
smoother plot but increases the computation time. The
maximum number of points that may be computed is 2000.
This command may be abbreviated to the single letter 'N'.
ORIGIN {ON | OFF} (default=OFF) -- Specify whether the origin
(0,0) is to be forced to be included in the plot. If
this option is off and the range of values does not span
0, then the origin may not be displayed. Turning this
option on allows the range of the function relative to
the origin to be observed, but may result in a small
scale factor if the range is far from the origin.
Pn cexpr -- Specify a value for parameter Pn where 'n' is in the
range 0 to 9. MATHPLOT allows you to use up to ten
parameter values in function specifications. The
parameters are named P0, P1, ..., P9. You can assign a
new value to a parameter and replot the function without
having to retype the function.
MATHPLOT -- Mathematical Function Plotter Page 17
PAUSE [cexpr] (default=0) -- This command may be placed in a
command file to cause execution to pause until a key is
pressed or the specified number of seconds elapse. If
cexpr is omitted or has the value 0, execution pauses for
an indefinite time until a key is pressed.
PDEVICE device (default=PRN) -- Allows you to specify the device
or file to which printer output is written when printing
is turned on by use of the PRINT ON command. The default
device is "PRN" but you may specify another device such
as LPT2 or COM. You may also direct output to a disk file
that you can printer later using the DOS PRINT or COPY
commands.
PLOT [cexpr] (default=0) -- Evaluate the currently defined
functions and plot them. If an optional value (cexpr) is
specified, the function is displayed for the specified
number of seconds or until a key is pressed. If the
optional value is omitted or is zero, the plot is
displayed for an indefinite time until a key is pressed.
The use of the optional value is most useful when the
PLOT command occurs in a command file producing a "slide
show" of functions. This command may be abbreviated to
the letter 'P'.
PRINT {ON | OFF} (default=OFF) -- Turns printer output on or off.
When turned on, any plot displayed on the screen is also
written to the printer (or file as directed by the
PDEVICE command).
RESET -- Reset all parameters and options to their initial values
and remove all function definitions.
SAVE filename -- Write the current function definitions and the
values of all options and parameters to the specified
file. The DO command can then be used at a later time to
redisplay the function. The default file extension is
".FUN".
TABULATE -- Evaluate the functions and print the values in
tabular form rather than plotting them.
MATHPLOT -- Mathematical Function Plotter Page 18
TITLE string -- Define a title line to be displayed at the top of
the plot.
WAXES cexpr (default=3) -- Specify the width (in dots) of the
axis lines for printed output. This parameter does not
affect the screen display.
WFn cexpr (default=3) -- Specify the width (in dots) of the line
used to draw the plot of function 'n'. This only affects
hard copy output.
WGRID cexpr (default=1) -- Specify the width (in dots) of the
grid lines. This only affects hard copy output.
MATHPLOT -- Mathematical Function Plotter Page 19
ADVANCED APPLICATIONS
Root Finding
MATHPLOT can be used to find the roots of equations. To do this,
turn on axis labeling (LABEL ON) and plot the function over the
domain in which a root occurs. Observe the approximate X value
at which the function crosses the X axis and then reset the
domain to closely span the crossing point. Replot the function
and obtain a new X estimate. After several iterations you will
be able to determine the root to several significant digits. For
example, use this technique to find the root of the function:
Y = X^4 - EXP(X)
in the domain (2,9.5).
For a course in Algebra I, MATHPLOT can be used to demonstrate
the graphical method of solving two simultaneous linear equations
by locating the point of intersection. For an Algebra II course,
MATHPLOT can be used to locate minimum and maximum points for
quadratic and cubic equations.
Multiple Domains
MATHPLOT only allows specification of a single continuous domain
of values. However, by using the multiple function plotting
capability it is sometimes possible to simulate multiple domains.
For example, the function X*Y=5 defines a hyperbola with branches
in both the positive X-Y domain (upper right quadrant) and the
negative X-Y domain (lower left quadrant). The following set of
commands defines two parametric functions to draw each of the
branches:
X1=T
Y1=5/T
X2=-T
Y2=-5/T
DOMAIN 0.5,10
LABEL ON
COMMONSCALE ON
PLOT
MATHPLOT -- Mathematical Function Plotter Page 20
Interesting Functions
The following specifications plot interesting and attractive
functions:
TITLE Four Leaved Rose
CTITLE 4
R=2*SIN(2*A)
CF1 3
DOMAIN 0,2*PI
NUMPOINTS 150
AXES ON
CAXES 1
PLOT
TITLE Prolate Cycloid
CTITLE 4
Y=1-2*COS(T)
X=T-2*SIN(T)
CF1 2
DOMAIN -4*PI,4*PI
NUMPOINTS 400
CAXES 1
COMMONSCALE ON
PLOT
TITLE Hypocycloid of four cusps (Asteroid)
CTITLE 4
Y=SIN(T)^3
X=COS(T)^3
CF1 2
DOMAIN 0,2*PI
NUMPOINTS 100
AXES ON
CAXES 1
COMMONSCALE ON
PLOT
MATHPLOT -- Mathematical Function Plotter Page 21
TITLE Bifolium
CTITLE 4
Y=2*SIN(T)^2*COS(T)^2
X=2*SIN(T)*COS(T)^3
CF1 3
DOMAIN 0,2*PI
NUMPOINTS 100
AXES ON
CAXES 1
COMMONSCALE ON
PLOT
TITLE Epicycloid
CTITLE 4
Y=5*SIN(T)-SIN(5*T)
X=5*COS(T)-COS(5*T)
CF1 3
DOMAIN 0,2*PI
NUMPOINTS 150
AXES ON
CAXES 1
COMMONSCALE ON
PLOT
"Artistic" Plots
When MATHPLOT plots a function, it evaluates the function at the
number of points specified by the last NUMPOINTS command and then
connects the points together using straight lines. By specifying
very large domain values for polar or parametric functions, the
lines connecting the points span large distances and produce
interesting and "artistic" plots. It is best to turn off axis
display (AXES OFF, LABELS OFF) and turn on common scaling
(COMMONSCALE ON) for these plots. Here are some examples to try:
Y=SIN(T)^3
X=COS(T)^3
CF1 2
DOMAIN 0,4000
NUMPOINTS 500
MATHPLOT -- Mathematical Function Plotter Page 22
R=2*SIN(2*A)
CF1 3
DOMAIN 0,2000
NUMPOINTS 500
Y=5*SIN(T)-SIN(5*T)
X=5*COS(T)-COS(5*T)
CF1 3
DOMAIN 0,6000
NUMPOINTS 400
Parametric and polar functions seem to produce the best artistic
plots. By varying the NUMPOINTS and DOMAIN values you can
usually produce many different plots from the same functions.
MATHPLOT -- Mathematical Function Plotter Page 23
USE AND DISTRIBUTION OF MATHPLOT
MATHPLOT is a "shareware" product. You are welcome to make
copies of this program and pass them on to friends or post this
program on bulletin boards.
However, if you find MATHPLOT to be useful and/or entertaining
you are expected to send to the author the registration form
printed on the next page with $20 to help cover the development
and support of MATHPLOT. In return, you will receive the most
recent version of the program and a bound copy of the manual.
Add $5 if Mathplot is being shipped out of the United States.
See also the special offer with Nonlin that follows.
You are welcome to write to the author at:
Phillip H. Sherrod
4410 Gerald Place
Nashville, TN 37205-3806
Both the MATHPLOT program and documentation are copyright (c)
1991-1992 by Phillip H. Sherrod. You are not authorized to
modify the program. "MATHPLOT" is a trademark.
Disclaimer
MATHPLOT is provided "as is" without warranty of any kind, either
expressed or implied. This program may contain "bugs" and
inaccuracies, and its results should not be assumed to be correct
unless they are verified by independent means. The author
assumes no responsibility for the use of MATHPLOT and will not be
responsible for any damage resulting from its use.
MATHPLOT -- Mathematical Function Plotter Page 24
N O N L I N
Nonlinear Regression Analysis Program -- Special Offer
If you like Mathplot, you should check out Nonlin -- the
nonlinear regression analysis program by the same author. And,
if you register your use of Mathplot and order Nonlin at the same
time, you can get both for the special price of $36.
What is regression analysis? Regression analysis is a
mathematical technique for determining the best values of
parameters to fit an equation to a set of data points. For
example, you might want to develop an equation of the form
price = p0 + p1*age + p2*miles
to predict the price of a used car based on its age and the
number of miles driven. With Nonlin you can collect data from
car ads and then perform the analysis using the following set of
commands:
VARIABLES PRICE,AGE,MILES
PARAMETERS P0,P1,P2
FUNCTION PRICE = P0 + P1*AGE + P2*MILES
DATA
Nonlin will analyze the data and determine the best values of the
parameters P0, P1, and P2 to fit the data values.
Ordinary linear regression programs can only determine parameter
values for linear (straight line) equations. Nonlin, on the
other hand, can handle multivariate, linear, polynomial, and
general nonlinear equations. For example, using Nonlin you can
easily determine the best values for the parameters Offset,
Amplitude, and Frequency for an equation of the form:
Y = Offset + Amplitude * sin(Frequency * X)
Nonlin uses the same expression evaluator as Mathplot so you can
model complicated equations using the full set of operators and
library functions available in Mathplot.
If you do any data analysis, or would just like to learn about
the incredibly useful regression analysis technique, you need
Nonlin!
MATHPLOT -- Mathematical Function Plotter Page 25
=====================================================================
Software Order Form
=====================================================================
NAME ______________________________________________________
ADDRESS ___________________________________________________
CITY _______________________ STATE _______ ZIP ___________
TELEPHONE _________________________________________________
COMPUSERVE ACCOUNT (optional) _____________________________
MATHPLOT VERSION (on title screen) ________________________
BULLETIN BOARD WHERE YOU FOUND MATHPLOT ___________________
COMMENTS __________________________________________________
Check the box below which indicates your order type:
___ I wish to register Mathplot ($20).
___ I wish to order Nonlin ($20).
___ I wish to register Mathplot and order Nonlin ($36).
Add $5 to any amount shown above if the software is being shipped
out of the United States.
Distribution disk choice (check one):
3.50" HD (1.4 MB) ______
5.25" HD (1.2 MB) ______
5.25" DD (360 KB) ______
Send this form with the amount indicated to the author at:
Phillip H. Sherrod
4410 Gerald Place
Nashville, TN 37205-3806