Application Center - Maplesoft

App Preview:

Classroom Tips and Techniques: Interactive Plotting: Vertical lines and Multiples of Pi

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

Classroom Tips and Techniques:
Interactive Plotting: Vertical lines and Multiples of Typesetting:-mrow(Typesetting:-mi(
 

 

Robert J. Lopez 

Emeritus Professor of Mathematics and Maple Fellow
Maplesoft 

? Maplesoft, a division of Waterloo Maple Inc., 2007 

 

Introduction 

 

This month, we will discuss two interactive plotting strategies I had to consult the developers to master.  It's likely that many of our readers will already have discovered the same devices themselves, but I'm also sure that there are others like me who will have struggled to find these functionalities on their own. 

 

The Plot Builder is Maple's most robust interactive plotting tool.  It provides access to the type of plot to be drawn, and to the properties of the plot.  The other interactive plotting tools available in the Plots option of the Context Menu lack this flexibility.  Consequently, we discuss how, with the Plot Builder, to plot a vertical line, and how to label an axis with multiples of Typesetting:-mrow(Typesetting:-mi( 

 

Initializations 

 

> Typesetting:-mrow(Typesetting:-mi(
 

> Typesetting:-mrow(Typesetting:-mi(
 

Plotting the Graph of a Vertical Line 

 

In the Typesetting:-mrow(Typesetting:-mi(-plane, the graph of the solution set of the equation Typesetting:-mrow(Typesetting:-mi( is a vertical line.  This line cannot be obtained as the graph of a function, so Maple's plot command will not graph the vertical line without user intervention.  Figure 1 shows a portion of this line drawn with the plot command as a line segment.  Figure 2 draws this same line segment as the parametric curve Typesetting:-mrow(Typesetting:-mi(

 

> Typesetting:-mrow(Typesetting:-mi(
 

Plot_2d
 

> plot([1, t, t = -1 .. 1])
 

Plot_2d
 

Figure 1   Graph of the vertical line segment by specifying its endpoints 

Figure 2   Parametric plot of the vertical line segment 


Clearly, graphing a vertical line segment via the plot command requires significant user intervention and knowledge of Maple syntax.  Figure 3 provides a graph of the vertical line segment drawn as an implicit plot with the implicitplot command from the plots package. 

 

> implicitplot(x = 1, x = 0 .. 2, y = -1 .. 1)
 

Plot_2d
 

Figure 3   Graph of the vertical line Typesetting:-mrow(Typesetting:-mi( drawn as an implicit plot 


Figures 1 - 3 all require some mathematical insight on the part of the user, who must correspondingly implement some appropriate Maple construct that reflects that view of the vertical line.  Now what happens when the user naively tries to plot Typesetting:-mrow(Typesetting:-mi( interactively via the Context Menu?  Right-click on the equation Typesetting:-mrow(Typesetting:-mi( and the Context Menu will contain Plots/2-D Implicit Plot, and the two choices Typesetting:-mrow(Typesetting:-mi( and Typesetting:-mrow(Typesetting:-mo(.  Assuming that the first choice means the horizontal axis is the Typesetting:-mrow(Typesetting:-mi(-axis, the resulting graph will be that of the horizontal line Typesetting:-mrow(Typesetting:-mi(  This is clearly incorrect, an error that will be corrected in the next release of Maple.  Note that this graph by-passes the Plot Builder where there might have been a chance to select as plot type, an implicit plot. 

 

To involve the Plot Builder, launch it from the Tools/Assistants menu. In the Expressions section, click the Add button, and in the ensuing dialog box, enter Typesetting:-mrow(Typesetting:-mi(.  See Figure 4. 

 

Image      Image 

Figure 4   Launch the Plot Builder from the Tools/Assistants menu; under Expressions, select Add, enter the equation Typesetting:-mrow(Typesetting:-mi( and press the Accept button 


Pressing the Accept button will enter the equation Typesetting:-mrow(Typesetting:-mi( into the Expression box, and add the variable Typesetting:-mrow(Typesetting:-mi( to the Variables box.  In the Variables section, click the Add button and add the variable Typesetting:-mrow(Typesetting:-mi(.  See Figure 5. 

 

Image     Image 

Figure 5   Add the variable Typesetting:-mrow(Typesetting:-mi( to the Variables box 


When the Accept button is pressed, the variable Typesetting:-mrow(Typesetting:-mi( will be added to the Variables box.  Pressing the OK button will lead to the dialog box shown in Figure 6. 

 

Image 

Figure 6   The Plot Builder now provides access to the 2-D implicit plot, from which the graph of the vertical line Typesetting:-mrow(Typesetting:-mi( follows 


Alternatively, right-clicking on the expression Typesetting:-mrow(Typesetting:-mi( provides access to the Plot Builder through Plots in the Context Menu.  In this case, the Edit Functions button (see Figure 7) will lead to the Add Variables option shown in Figure 5. 

 

Image 

Figure 7   Use the Edit Functions button to access the Add Variables option as shown in Figure 5 

Labeling an Axis in Multiples of Typesetting:-mrow(Typesetting:-mi(  

 

The Plot Builder can be used for the interactive drawing of a graph whose Typesetting:-mrow(Typesetting:-mi(-axis, for example, can be labeled in multiples of Typesetting:-mrow(Typesetting:-mi(.  Use the context menu to launch the Plot Builder for graphing, say, Typesetting:-mrow(Typesetting:-mi(.  As per Figure 8, press the Options button to access the dialog for plot options, then select the Advanced Settings option in the Axes section on the lower left.  In the Advanced Axis Settings dialog box, open the drop-down listing under Tickmarks for the Typesetting:-mrow(Typesetting:-mi(-axis.  At the very end of the list, select "spacing(2, 0)." 

 

Image 

 

 

 

 

 

Image 

Figure 8   On the left, click "Advanced Settings" in the Axes box; on the right, in the Typesetting:-mrow(Typesetting:-mi(-row of the Axis box, click the down arrow in the Tickmarks column and select "spacing(2, 0)," the last item in the drop-down listing. 

 

After selecting "spacing(2,0)," edit the "2" to the desired multiple of Typesetting:-mrow(Typesetting:-mi( that should be used on the graph.  For example, change the "2" to Pi/2.  (Remember, in Maple's pop-up dialogs, all entries are in text mode.)  Press the Apply button and proceed with the usual plotting steps in the Plot Builder.  Figure 9 shows the typical outcome. 

 

Plot_2d 

Figure 9   Plotting in multiples of Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mi( via the Plot Builder 

 

Note that instead of obtaining rational multiples of Typesetting:-mrow(Typesetting:-mi(, Maple has floated the rational coefficients of Typesetting:-mrow(Typesetting:-mi(.  This is the best that can be achieved with the Plot Builder.  To obtain a graph labeled with rational multiples of Typesetting:-mrow(Typesetting:-mi(, the plot command must be used.  Figure 10 shows that the "simplest" usage of the plot command also produces a graph with floating-point coefficients of Typesetting:-mrow(Typesetting:-mi(

 

> plot(sin(x), x = 0 .. 10, tickmarks = [spacing(`+`(`*`(`/`(1, 2), `*`(Pi)))), default], scaling = constrained)
plot(sin(x), x = 0 .. 10, tickmarks = [spacing(`+`(`*`(`/`(1, 2), `*`(Pi)))), default], scaling = constrained)
 

Plot_2d
 

Figure 10   Naive use of the plot command produces floating-point coefficients of Typesetting:-mrow(Typesetting:-mi( on the horizontal axis 

 

The more complex syntax used to produce Figure 11 results in rational coefficients of Typesetting:-mrow(Typesetting:-mi( along the horizontal axis. 

 

> Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
 

Plot_2d
 

Figure 11   Use of the plot command to label an axis with rational coefficients of Typesetting:-mrow(Typesetting:-mi( 

 

The plot command in Figure 11 requires that the location and notation for the axis labels be explicitly provided.  The syntax appearing in the tickmarks option generates the sequence of equations 

 

> Typesetting:-mrow(Typesetting:-mi(
 

0 = 0, `+`(`*`(`/`(1, 2), `*`(Pi))) = `+`(`*`(`/`(1, 2), `*`(Pi))), Pi = Pi, `+`(`*`(`/`(3, 2), `*`(Pi))) = `+`(`*`(`/`(3, 2), `*`(Pi))), `+`(`*`(2, `*`(Pi))) = `+`(`*`(2, `*`(Pi))), `+`(`*`(`/`(5, 2)...
 

The left side of one such equation gives the location of the axis label, while the right side gives the notation that is to appear at that location.  This becomes transparent in Figure 12 where the horizontal axis is labeled in multiples of the symbol "A". 

 

> plot(sin(x), x = 0 .. 10, tickmarks = [[seq(`+`(`*`(`/`(1, 2), `*`(k, `*`(Pi)))) = `*`(k, `*`(A)), k = 0 .. 6)], default], scaling = constrained)
plot(sin(x), x = 0 .. 10, tickmarks = [[seq(`+`(`*`(`/`(1, 2), `*`(k, `*`(Pi)))) = `*`(k, `*`(A)), k = 0 .. 6)], default], scaling = constrained)
 

Plot_2d
 

Figure 12   Labeling the horizontal axis in multiples of the symbol "A" 

 


Legal Notice: The copyright for this application is owned by Maplesoft. The application is intended to demonstrate the use of Maple to solve a particular problem. It has been made available for product evaluation purposes only and may not be used in any other context without the express permission of Maplesoft.  

 

Image