WinPlot is a graphing utility that was written and maintained
by the late Richard Parris, who was a math instructor at Phillips Exeter Academy
in Exeter, New Hampshire. The last version of the program can be downloaded
from the web site at http://faculty.madisoncollege.edu/alehnen/winptut/Install_Winplot.html . All of the WinPlot modules have fairly thorough Help
menus which give detailed information about the workings of the program.
Upon launching WinPlot you will see the following introductory screen.
By clicking on Window you will be presented with the following two plotting options:
2-dim Allows you to generate plots in the x,
3-dim Allows you to generate plots of surfaces or space curves in x, y, z space.
If Open last file is checked, then for any option chosen the last file saved will automatically appear in the chosen window.
If Use defaults is checked a standard viewing window for each type of plot will be initialized.
Graphs in 2D
Changing the viewing window
From the introductory screen choose Window 2-dim . You will then see a window containing an x, y grid. The appearance of this viewing window can be altered using the View pull down menu.
To change the plot window use the command View. This brings up the following menu.
Click on the upper right "radio button" or check circle entitled "set corners". This allows you to set the window’s lower left (left, down) and the upper right (right, up) coordinates by just entering the appropriate values.In reference back to the first View menu, if the scales on the two axes are not equal (so that circles don’t look circular), you can use Zoom square to make them so. Click Fit window to make all active examples fit within the window. Because this might not be possible, results are sometimes unpredictable. Restore returns to the default window settings. Checking the Axes option displays the x and y axes.
The Grid dialogue box allows you to display a Cartesian or polar grid by clicking the appropriate radio button. If "both" is selected both x and y axes are displayed. Checking either "x" or "y" displays only the axis selected. If "polar" is selected you can specify the number of sectors by clicking on the square to the left of "polar sectors" and entering the number to the right.
Check "labels" to put the letters 'x' and 'y' into the diagram. If you check "arrows", you get small arrows at the ends of the axes. Check "ticks" to put equally spaced marks on the axes. The distance between successive ticks is the value of "interval". Click on "scale" and "mark scale on axes" to put the corresponding numerical values next to the ticks. Click on "scale" and "mark scale on border" to place the numbers at the edge of the window. The number of decimal places displayed is entered as "places". If there are too many values showing, enter a higher number in the corresponding "freq" box. Check "pi" if you want the ticks labeled using multiples of pi. For this last option to be effective, the corresponding tick interval should be a rational multiple of pi with a small denominator, and the font in the "Scale on axes" option of the Misc/Fonts menu should be set to "Symbol". If "grid" is checked, grid lines appear in the quadrants checked. If "grid" is not checked and "dots" is checked you will see an array of small crosses where the grid lines would meet. The polar grid can be on at the same time as the rectangular grid. To effect the changes of this menu press the "apply" button.
You can insert text into the graphing window by use of the mouse buttons. First use the "Btns" pull down menu to make sure that the Text option is checked. Second place the mouse pointer at the spot where you want to enter text, click the right mouse button, and type in the desired text. If you wish, you can change both the color and font of the text.
To insert a circular dot at a point go to the Equa pull down menu and select Point. In the dialogue box give the point’s coordinates. The value of "dot size" determines the diameter of the dot and the color can be adjusted via the color button.
Plotting the graphs of equations
To see a graph in WinPlot you must either Open an old WinPlot file (files with the extension wp2), or else enter a new equation by clicking on the Equa menu. There you will be presented with the following four options for generating curves.
1) y=f(x)… Graphs y as an explicit function of x .
2) r=f(t)… Graphs polar curves where the polar
coordinate r is an explicit function of the polar angle theta (here
3) x=f(t)… Graphs parametric curves of the form x = f (t ), y = g(t ) for f and g explicit functions of some parameter t . By letting g(t ) = t this in effect allows you graph x as an explicit function of y, i.e., x = f (y) .
4) 0 =f(x,y)… Graphs implicit relations between x and y defined by this formula.
Clicking y=f(x)… from the Equa menu results in the following dialogue box.
By typing over the "y =" box you can enter an expression that defines y as a function of x. Click the "color" button to obtain the color palette and click the small box that shows the color you want for the graph. You can type an integer into the "plotting density" box to alter the density of plotted points. This is rarely necessary. If you want to specify the domain of the function enter the interval in the boxes "low x" and "high x" and then click on the box "lock interval". This overrides the default which is to use the interval defined by the plot window as the domain.
More than one graph can be displayed in the same graph window. Just return to the Equa menu and repeat the procedure outlined above. In fact, you can mix graphs of y as a function of x with polar curves, parametric curves, and implicit curves by simply using the different options for entering equations.
By choosing Inventory from the Equa menu you access the inventory dialogue box. This allows you to inspect and edit any of the equations already entered and perform other modifications and constructions. To select an equation, click on it with the mouse. Only one example can be selected at a time. The Inventory options include the following:
edit – This button opens the dialogue box that was used to create the curve and allows you to make changes.
delete – This button causes the curve to disappear from the inventory and from the screen. There is no "undo". All equations that are dependent on the equation are also deleted.
dupl – This button copies the selected equation and opens the editing dialogue. This allows you to create a similar example without changing the original.
clip – This button copies the text of the defining equation to the clipboard where it can be pasted into other applications.
derive – This button calculates the derivative of the selected curve. This option only applies to curves defined explicitly by the y=f(x), r=f(t) or x=f(t) options. The result is graphed and added to the inventory. A derivative can therefore also be selected, but only its attributes (color, thickness, etc.) can be edited.
graph – This button hides the graph of a selected equation without removing it from the inventory. A second click restores the graph.
equa – This button displays the text of a highlighted equation in the upper left corner of the graph window. A second click removes this display.
web – This button overlays a web diagram which is an iteration used to locate fixed points of a curve of the type y = f(x). You can specify the starting x-value, the number of steps, and the color of the overlay. To generate the web diagram select "define". To delete the web diagram select "undefine".
family – This powerful feature allows you to display a family of curves generated from a selected equation. The equation must be defined with one or more extra parameters. For example, the equation y = sin(ax)+b defines a sine wave that depends on the two parameters a and b. Either one of these can be used to create a family of curves. To vary the frequency type "a" into the "parameter" box, enter a range of values by filling in the "low" and "high" boxes, and indicate the number of curves to be drawn by filling in the "steps" box (this is one fewer than the number of curves). Click "define" to generate the family. This also modifies the definition of the equation in the inventory. To remove the family, select the equation and click "undefine".
x-axis – This button generates the reflection of the selected
curve across the x-axis.
y-axis – This button generates the reflection of the selected curve across the y-axis.
y = x – This button generates the reflection of the selected curve across the line y = x. This is the inverse relation to that of the original curve.
table – This button opens a text window that displays values of the selected function for curves defined explicitly by the y=f(x), r=f(t) or x=f(t) options. You can alter the contents of the table by clicking "Params" on the menu bar. To see tables for a different equation use the command sequence "File/Next example".
WinPlot like a graphing calculator has built-in "Zoom" features. To "Zoom in" and thus obtain a close up view of a smaller portion of the x, y plane choose Zoom in from the View menu. Similarly, to "Zoom out" choose Zoom out from the View menu. If you’re not happy with the new image choose Last window from the View menu.
When entering formulas in WinPlot the following conventions are used:
Multiplication is indicated by *
Division is indicated by /
Addition is indicated by +
Subtraction is indicated by !
Exponentiation is indicated by placing the ^ (caret symbol) between the expression for the base and the expression for the exponent. The caret is the upper case of 6 on the keyboard.
Actually, WinPlot does recognize algebraic notation. For example, "two times ex", can be entered either as 2x or 2*x . Similarly, "three times ex cubed", can be entered as 3x^3 or 3*x^3 or 3*x*x*x or even as 3xxx. The only valid grouping symbols are parentheses ( ), but these may be nested as in (6x ! x^(sqr(5)+3))/(5x + 2). The rules for the order of operations are the conventional ones used in mathematics and science.
Certain standard functions are "built into" WinPlot, but the arguments must always appear in parentheses. For example, "the sine of 3 times x" should be written as sin(3x).
The names of the principal "built in" functions are given below.
abs(x) is the absolute value of x
sgn(x) is the signum or sign function = abs(x)/x
sqr(x) is the square root of x (for non-negative x)
root(n,x) is the principal n-th root of x
fact(n) is n!
exp(x) is the exponential function evaluated at x
ln(x) is the natural logarithm function for positive x
log(x) is the base 10 logarithm function for positive x
sin(x) is the sine of x (All trig functions assume the argument is in radians.)
arcsin(x) is the arc or inverse sine
cos(x) is the cosine of x
arccos(x) is the arc or inverse cosine
tan(x) is the tangent of x
arctan(x) is the arc or inverse tangent of x
sinh(x) is the hyperbolic sine of x
cosh(x) is the hyberbolic cosine of x
tanh(x) is the hyberbolic tangent of x
pi is the constant pi=3.14159265… To multiply p and x, enter pi*x, not pix.
As an example, suppose you want a graph of the cubic polynomial
From the Equa menu select y=f(x)… and enter the formula as shown below.
Clicking the "ok" button results in the following: (the grid settings used are also displayed)
Suppose now we click, r=f(t)… from the Equa menu. This results in the following dialogue box for a polar curve. This second curve will be graphed along with the previous polynomial.
The usual theta domain for polar curves will include at
least zero to 2pi. Entering 2pi for "high t" is the same as entering
6.28319 . The result of graphing both curves in the graph inventory is shown below.
Suppose we wanted to graph the ellipse centered at (2, !1) with major axes parallel to the x axis, a semi-major axis of 3, and a semi-minor axis of 2. Since y is not a function of x for this figure, a single y = f (x ) graph can not generate the plot. However, we can graph it by using the parametric input mode. Selecting x=f(t)… from the Equa menu and entering the formulas shown below generates the correct result.
The standard equation of this ellipse is . An alternate way to graph it is to use the implicit input mode. The equation generating the graph must be stated as f(x,y)=0. The points on the curve are generated by a numerical search. If the "long search" option is checked the program will continue searching for points until you press "Q" (for quit). Failure to type "Q" causes the program "to hang". Selecting 0=f(x,y)… from the Equa menu and entering the formula shown below generates the graph shown.
Mathematical calculations and demonstrations
In addition to graphing equations WinPlot can perform numerical and graphical procedures on curves. These options are found in the Anim, One, Two and Misc menus.
The Anim menu provides for some of the most dramatic and illuminating demonstrations available in WinPlot. In WinPlot the letters a ... z always have a numerical value, and letters other than x, y, and z can be used in equations as parameters as was discussed in the Inventory/family option. The value of such a variable can be altered using the scrollbar dialogue boxes listed in this menu. The box labeled by the upper case name of each parameter controls the values of that parameter. When a parameter value is changed, all parameter-dependent graphs, including vector field plots generated under the DEq Equa option, change accordingly.
The values of a parameter vary from its lowest or left-most value "L" to its largest or right-most value "R". These values can be entered and then set with the buttons "set L" and "set R". Within this domain the value of the parameter can be set manually by moving the scroll bar. This process can be automated by pressing the "autorev" or "autocyc" buttons. The "autorev" option varies the parameter according to the sequence L…R…L:… R… , while the "autocyc" option uses the sequence L…R L…R L…R. In both automatic modes the dialogue box disappears and you must press "Q" to stop the animation and restore normal program control. By default there are 100 intermediate values for the parameter between the L and R values. This number can be changed by clicking on the "1=Scrollbar units" item.
For diagrams that respond slowly to parameter changes, it may help to create a slide show. It takes some time to create the slides and put them into memory, but then they can be played back quickly. To activate this mode, check the "2=slides" item.
As an example, suppose we wish to animate the parameterized function f (x) = sin(a*x) + b . Use the Anim menu and select A and B in succession to set the range for each parameter. In the figures shown below B was set to 0 and A varied from 0.1 to 10.
The Area of a Sector option evaluates the area of the sector (centered at the origin) swept out by a selected arc defined by an explicit function.
The Length of arc option computes the arc length of a non-implicit curve. If there are multiple equations in the graph’s inventory use the drop-down list at the top of the dialogue box to select the desired equation. The starting and ending values of the independent variable are entered into the "lower limit" and "upper limit" boxes respectively. Specify a value for the number of "subintervals" (n) and press the "length" button to obtain the numerical result.
The Centroid demo of the Misc menu allows you to describe a region of the x, y plane by making a list of inequalities of the form 0<F(x , y). Each functions F(x , y) is entered under the Equa menu as an implicit curve. The module estimates the centroid of the region by randomly "throwing lots of darts" at it and averaging their coordinates. You prescribe the number of darts to be thrown. The coordinates of the average point are displayed in the dialogue box. This illustrated in the next figure.
The Two pull down menu lists four procedures that WinPlot can do to two functions at a time.
Saving, printing and copying a graph
To save all of the equations, windows and related settings associated with a WinPlot graph choose Save or Save As from the File menu. Type in the desired file name and click the "Save" button. If you want to save to a particular location, insert the path before the file name or use the pull-down list to access the desired device or directory. For example, to save a WinPlot graph called "mygraph" to the floppy drive, type a:\mygraph in the File name: box. To retrieve a graph, choose Open from the File menu and give the desired path and filename of the previously saved WinPlot file.
To print your graph:
Graphs in 3D
Many of the features (the inventory dialogue box, the conventions for entering formulas and function names, the insertion of text, the use and control of parameters, the printing and saving of files, etc.) of WinPlot’s 2D graph module are implemented identically in the 3D graph module.
Entering equations and viewing surfaces
There are five principal ways of generating a 3D graph by entering an equation.
1) z=f(x, y)… Graphs a surface with z as an explicit function of x and y.
2) z=f(r,t)… Graphs a surface with z as an explicit function of r and t , where r and t are polar coordinates.
3) x=f(t,u), … Graphs a parametric surface of the form x = f (t, u), y = g(t, u), and z = h(t, u), for explicit functions f , g and h and a pair of parameters t and u .
4) 0=f(x,y,z)… Graphs an implicit surface defined by the relationship expressed in the equation.
5) Curve x=f(t), … Graphs a parametric space curve of the form x = f (t), y = g(t), and z = h(t), for explicit functions f , g and h of a single parameter t .
For surfaces generated by explicit functions it is probably best to use the "quick" drawing mode. This provides greater speed and ease in both generating and modifying surfaces. This option is on when the item Fast draw mode is checked in the View menu. For this reason it is probably more convenient to generate a surface with several explicit formulas rather than use a single implicit formula. For example, to generate the surface of the elliptic hyperboloid of two sheets described by the equation
solve for z and graph the following explicit functions:
Below is a bitmap copy of a surface generated using thefast draw option.
This same surface could be generated using a parameter in the decaying exponential as shown below. This parameter could then be controlled from the Anim menu to give a dynamic "breathing" surface!
Clicking z=f(x,y)… from the Equa menu results in the following dialogue box.
Define the domain of the function by entering the extreme values for x and y. Only rectangular domains are allowed. This means a surface whose base is a region in the x, y plane defined by non-constant boundary functions of y in terms of x or x in terms of y can not be generated by this option. The methods for drawing the graph make use of the x and y division values. Increasing these gives a "smoother" graph but at the expense of greater computation time. The upper and lower sides of the surface will be shaded differently if the "shade" box is checked and if different colors are picked via the "col 1" and "col 2" boxes. Click on the "ok" button to see the graph.
In the following example the value of the parameter A was set at 0.16 by the scroll bar selected from the Anim menu.
To compute a numerical approximation to the double integral of f (x, y) over its rectangular domain choose Integrate from the One pull down menu.
The procedure for entering a surface with "z=f(r,t)…" is essentially the same as for entering a surface with "z=f(x,y)…".
From the Inventory menu you can select "levels" which generates level curves for a given surface.
Enter a value into the box labeled "level values for z". For surfaces defined by the z=f(x,y) option the surface from z = "low" to z = "high" is sliced by this number of equally spaced planes parallel to the x, y plane. The intersections between each plane and the surface are then projected onto the x, y plane resulting in a given level curve. The location of these intersection points involves a numerical search. The quickest method is press the "auto" button and let the program search over all the levels in succession. For some of the level curves this may miss some points. If this happens you can refine the search by specifying the value of z in the "curr" box and pressing the "search level" button. Because the program does not know when to stop, it is necessary to press "Q" to quit. To obtain a contour plot press the button "see all". This draws all of the level curves in a single 2D graph. To superimpose the level surfaces onto the 3D perspective surface plot uncheck the Fast draw item in the View menu.
Graphs of implicit surfaces 0 = f(x,y,z) are generated by using the "levels" menu. Choose a level by selecting one of the three coordinate variables x, y or z and entering a value for that variable into the "current level" box. To see the level curves in the 2D window, click the "search level" button. The program will search for starting points and then draw the resulting contours, until you press "Q" to quit that level. The level values can be chosen individually, or you can set up a uniform selection by entering a count into the "level values for" box and extreme values into the "low" and "high" boxes. Click the "next level" or "previous level" buttons to enter a value into the "curr" box for you. As before, clicking the "auto" button will automatically search each level.
As the level curves are found, they are displayed in a 2D window and entered into a drop-down inventory box. You can delete unwanted curves from this list. When the level-curve inventory for the surface is satisfactory, click the "keep changes" button to exit the dialog and see the levels in 3D perspective. If you click the "discard changes" button, all editing is ignored and no changes are made to the 3D figure.
As an example of entering a space curve consider the periodic trajectory defined as follows:
The parameter t could be interpreted as the polar angle theta. For this curve to "retrace" itself the domain of t needs an interval of length 4*pi. Sample inputs and outputs for this trajectory are shown below.
Some View Menu Options
As in WinPlot’s 2D graph module the View menu in the 3D module allows you to alter the appearance of graphs.
Checking Axes displays x, y, and z axes in the 3D plots. This is useful in establishing the orientation of the figure. Drawing the axes does slow down the drawing of the graph, particularly when rotating a figure with the F8, F9, Ctrl F8, and Ctrl F9 keys.
The lengths of the axes can be adjusted and "locked" in the Lock lengths dialogue box.
Changing the position of the Observer changes the perspective. In particular, adjusting Up (press the F8 key), Down (press Ctrl F8), Turn (press F9), or Back (press Ctrl F9) rotates the figure. Pressing F8 decreases the polar angle, "phi", by a fixed amount (the default is 6 degrees, but this can be reset in the Angle dialogue box). Pressing F9 increases the azimuth, "theta", about the z axis by this same fixed amount.
Zoom/Zoom Out shrinks the size of the figure
by a fixed ratio (the default is 1.2 but this can be changed in the Zoom/Factor
dialogue box). Similarly, Zoom/Zoom In increases the size
of the figure.
Plotting Phase Space Trajectories of Differential Equations
The DEq option from WinPlot’s 2-Dim Equa menu can generate graphs of slope fields and solutions for first order differential equations (the dy/dx option) or graphs in two dimensional phase space for a system of first order differential equations in two dimensions (the dy/dt option). Such systems are often referred to as dynamical systems and even an introduction to such problems is outside the scope of this tutorial. The discussion here will be limited to using the dy/dt module to plot the direction field of a vector field or to generate phase space trajectories for second order ordinary differential equations.
Plotting the direction field of a vector fields in 2D
The 2-dim DEq dy/dt module is designed to generate plots in x, y space of solutions to the dynamical system defined by the first order system:
If the functions F and G are independent of the parameter t the system is called autonomous. Suppose this is the case, then from the chain rule
Thus, the solutions in x, y space follow the direction of the vector field
To plot the direction field of a vector field use the 2-dim DEq dy/dt module as follows:
This is illustrated in the following two examples.
Example 1: Plot the direction field of the radial vector field
Example 2: Plot the direction field of the circulating vector field
Generating Phase Space Trajectories for Second Order Differential Equations
The use of phase space to describe solutions of second order ordinary differential equations is introduced in the following web site: htttp://www.madison.tec.wi.us/alehnen/webphase/sld001.htm.
To plot the phase space trajectories of a second order ordinary differential equation use the 2-dim DEq dy/dt module as follows:
These notes were authored by Al Lehnen, a math instructor
at Madison Area Technical College in Madison, Wisconsin.
I welcome any comments and suggestions. Please feel free to E mail me at firstname.lastname@example.org or write to me at the following address.
Madison Area Technical College
1701 Wright Street
Madison, WI 53704