Classroom Tips and Techniques: Gems 26-30 from the Red Book of Maple Magic
Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft
|
Introduction
|
|
In 2011, this column published five "Maple Magic" articles, each containing five "gems" gleaned from interactions with Maple and the Maplesoft programmers. Here are five more recent additions to the Red Book, every one of which contained something about Maple that was a surprise to me, experienced Maple user that I am.
|
|
Gem 26
|
|
While articulating a "sliding-ladder" problem for a related-rates example, I drew the appropriate diagram and then wanted to annotate the diagram with the notation . Figure 26.1 shows the result of my first attempt to add this notation programmatically. My naive assumption that the typeset option would work was unfounded.
Fortunately, access to our graphics experts is near-at-hand, and Figure 26.2 shows the result of applying the Gem: Use Typesetting:-Typeset in place of just typeset.

|
![display(textplot([1, 1, typeset(diff(x(t), t) = 3)]))](/view.aspx?SI=141091/8793129655976a46327e68ff5a6e12d9.gif)
|
![display(textplot([1, 1, Typesetting:-Typeset(diff(x(t), t) = 3)]))](/view.aspx?SI=141091/d20fdef4b74ae465fb20a812451abb41.gif)
|
Figure 26.1 Naive approach
|
Figure 26.2 Gem!
|
|
|
|
|
Gem 27
|
|
The equation implicitly defines the function , whose domain is the set of reals less 0 and . Figure 27.1 is a graph drawn with Maple's implicitplot command used naively. It contains the graph of the line , along which the left-hand side of the equation is not defined, and which does not belong in a graph of .
Figure 27.2 shows that inclusion of the signchange option renders the implicitly drawn graph correct.

|
![implicitplot(Eq, x = -3 .. 3, y = -2 .. 2, gridrefine = 3, grid = [300, 300])](/view.aspx?SI=141091/405e1c7f964c8af542e86f2272e268f8.gif)
|
![implicitplot(Eq, x = -3 .. 3, y = -2 .. 2, gridrefine = 3, grid = [200, 200], signchange = false, axes = box)](/view.aspx?SI=141091/fd6c7a8f6f25c36dee0bbd50fb30c510.gif)
|
Figure 27.1 Naive implicit plot
|
Figure 27.2 Implicit plot with signchange option
|
|
|
If , then elementary manipulations applied to = give . No point on this parabola can be in common with the line . Therefore, the solutions
must be excluded from the graph. Hence, the two gaps in in the curve shown in Figure 27.2.
|
|
Gem 28
|
|
Table 28.1 illustrates the use of the EnableParseRule command in the Typesetting package. By this means, certain functions in Maple are both displayed and referenced by their common mathematical notations.
•
|
In extended typesetting mode, certain Maple functions are echoed in their common mathematical notation. For example, would echo as .
|
|

|
|

|
Table 28.1 Common math notation on input as well as output
|
|
|
With the typesetting mode set to extended, changes made in the Typesetting Rules Assistant take effect. In particular, Figures 28.1 and 28.2 compare this Assistant before and after the parse rule for BesselJ has been changed. In Figure 28.1, the relevant portion of the Assistant shows the default settings for the Rules section. Figure 28.2, shows this section after the parse rule for BesselJ has been selected.
|
|
Figure 28.1 Rules Assistant in default state
|
Figure 28.2 Rules Assistant after parse rule enabled
|
|
|
|
|
Gem 29
|
|
•
|
Execute the restart command to the right.
|
•
|
Tools_Load Package: Student Linear Algebra
|
|

Loading
Student:-LinearAlgebra
|
•
|
Matrix palette: Enter the matrix shown to the right.
|
•
|
Context Menu: Assign to a Name_
|
|
 
|
•
|
Figure 29.1 is obtained with the EigenPlot command applied to the matrix . In Maple 16, the default colors strike some as too dark, and without sufficient contrast.
|
|
Figure 29.2 is an image of the same graph drawn in Maple 15. The brighter and more contrasting colors in Figure 29.2 are seen by some as superior to those in Figure 29.1.
|
>
|
A:=Matrix(2,2,[1,1,1,0]):
Student:-LinearAlgebra:-EigenPlot(A,showunitvectors,caption="");
|
|
Figure 29.1 EigenPlot command in Maple 16
|
|
|
|
|
Figure 29.2 EigenPlot as per Maple 15
|
|
|
|
•
|
Unit vectors (inside the circle) are in one color. Their images under left multiplication by are in another color. Two other colors are used for the eigenvectors, that is, vectors whose images are collinear with a unit vector.
|
•
|
These distinctions seem to be easier to make in Figure 29.2 that in Figure 29.1. The colors in Figure 29.1 can be modified from within the EigenPlot command, but that requires some tedious syntax. The alternative is supposedly provided by the SetColors command, thereby modifying the color table used in the Student packages.
|
|
|
|
In Maple 16, the SetColors command in the Student package returns the following list of 16 colors that the visualization commands in the Student packages are supposed to use in sequence, as needed.

The SetColors command can also be used to modify the list of default colors. Here, the ten colors from Maple 15 overwrite the first ten colors to be used in Maple 16. The color table continues to have 16 entries, the last six, not overwritten, are retained.
The astute reader will immediately realize that there is no "yellow" in the Maple 15 color list, yet the unit vectors in Figure 29.2 are in yellow! The astute reader will also notice the use of tentative language such as "supposed to" with respect to the behavior of the default color list. The reason for these observations becomes clear below.
•
|
Figure 29.3 is the EigenPlot in Maple 16 after the execution of the SetColors command with which we attempted to restore the color list from Maple 15. Compare this figure with Figure 29.2. The unit vectors in Figure 29.2 are in yellow, but there is no yellow in the Maple 15 color list.
|
•
|
Turns out that some of the colors in the Student visualization commands have become hard-coded into the commands. This was a great surprise!
|
•
|
Fortunately, it appears that in future releases of Maple, the color list provided by SetColors will be rigorously adhered to, and that will obviate the need to syntactically modify colors through the options in the visualization commands themselves.
|
|
|
Figure 29.3 EigenPlot in Maple 16 after SetColors used to install the colors from Maple 15
|
|
|
|
|
|
|
|
Gem 30
|
|
A May 8, 2012, post to MaplePrimes asked how to simplify
to . A number of solutions were contributed. In particular, acer suggested
and I suggested
As I sought to simplify my answer further, I realized that the simplest calculation stems from an application of the double-angle formula . That would transform the denominator of immediately to , with an immediate simplification to . Here is the complete calculation:
It should be possible to make this transformation via the Smart Popups introduced into Maple 16. However, as can be seen in Figure 30.1, a missing table-entry precludes success along these lines.
|
Figure 30.1 Smart Popup for
|
|
|
There are three double-angle identities for and the Smart Popup in Figure 30.1 contains two of them, with one of them repeated. This doubling of one identity and the omission of the third is endemic to the table of trig identities in
When Maple invokes a double-angle identity for via the orthodox call to expand, it defaults to the first one in Figure 30.1, namely to
Even more surprising than the success of reciprocation is this result:
The expression is undefined whenever is an integer. But is likewise undefined whenever is an integer multiple of . Our final experiment, namely,
suggests that as soon as the arguments of the trig functions are not simple names, the path through the simplifier is no longer smooth.
|
Legal Notice: © Maplesoft, a division of Waterloo Maple Inc. 2012. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.
|