Classroom Tips and Techniques: Interactive Plotting of Points on a Curve
Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft
Introduction
Recently, I needed to draw points on the graph of a curve. Now, this is a task I have done many times, using two plots, one of the points, and one of the curve, and merging the plot datastructures with the display command from the plots package. I was delighted to discover that I could construct this same graph interactively, using the Plot Builder and Maple's draganddrop functionality for plots. In this month's article, we'll show how to create the desired graph interactively.
Initializations
Let's start by loading the plots package interactively, using the Tools/Load Package menu. The evidence that the package has been loaded is the notation
Loading
plots
Generating a Curve
For a curve, generate a cubic polynomial that has relative extrema at the points and . After determining the cubic, graph it and the two given points.
The coefficients in the generic cubic polynomial
are determined by the four equations

(1) 
The solution has been obtained interactively by selecting Solve from the Context Menu.
The desired polynomial is then

(2) 
Building the Plot with the display Command
The required graph appears in Figure 1.

Figure 1 The points and and the cubic polynomial for which these are relative extrema

Figure 1 has been constructed by merging separate plots of the points and the polynomial.
Building the Plot Interactively
Points First
First draw a graph of the points, then drop the polynomial onto that graph. To obtain a plot of the points, apply the Plot Builder from the Context Menu for the list

(3) 
Onto this graph drop the polynomial . The result is Figure 2, in which the default range has been applied.

Figure 2 Draganddrop onto a PlotBuilder graph of the points

Figure 3 shows the Axis Properties dialog that can be accessed from the Context Menu for Figure 2.

Figure 3 Select Axes/Properties in the Context Menu for Figure 2

When the option "Use data extents" is unchecked, the "Range min" and "Range max" boxes become available for writing. Enter 1 in the first box and 5 in the second, then select "Vertical Axis" and repeat the process, this time entering and 3 for the ranges boundaries. Click "Apply" and "OK". The result will be Figure 4.

Figure 4 Figure 2 modified by Context Menu: Axes/Properties

The default symbol for the points are an open rhombus, drawn at a size of 10 points. If this is not sufficient, the symbol and symbol size can be changed interactively through the Context Menu. If Figure 4 is modified to have symbol Circle (Solid), and symbol size 15 points, Figure 5 results.

Figure 5 Figure 4 with symbol and symbol size interactively modified through the Context Menu

Curve First
As in the previous section, graph the points

(4) 
with the Plot Builder launched from the Context Menu applied to the list of points. Now draw a second graph of the polynomial, again with the Plot Builder. Within the Plot Builder, set the plot window so that and . Select one of the points in the point graph, and draganddrop the content of this plot onto the graph of the polynomial. This will result in Figure 6. As before, the symbol used for the point, and its size, can be changed interactively.

Figure 6 Interactive plot generated by dropping graphed points onto graph of cubic polynomial

The advantage of dropping the polynomial onto a graph of the points is that only one graph has to be drawn. However, the modification of the plot window does not seem to me to be as convenient as it is in the Plot Builder.
The advantage of drawing two graphs, and dropping the image of the points onto the graph of the polynomial is that the Plot Builder can be used to set the plot window for the resulting figure. It might also be more natural to graph the polynomial, then decide to show certain points on it. So, those points can be listed and plotted, then dropped onto the graph of the polynomial.
While working out the details of the constructions discussed here, it became evident that a Context Menu method for adding the image of points to a graph would be useful. This functionality has been added to the feature request list for a future release of Maple.
Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for noncommercial, nonprofit use only. Contact the author for permission if you wish to use this application in forprofit activities.