MAPLETALK!

Editor:Volume 1, Issue 3
Jerry G. Ianni15 June 1998



Editor's Note:   In this issue of MAPLETALK!, an introduction to plotting is given.

The basic plotting command in Maple is "plot". This command will produce a graph of a functional relationship between two variables in the Cartesian plane. A simple example appears below. Notice that the input to the "plot" command consists of three parts. The first part is the output expression for the function. The second part is a specification of domain values to appear on the graph. The third part is a declaration of the dependent variable.

> plot(x^2,x=-5..5,y);

[Maple Plot]

The graph of [Maple Math] from [Maple Math] to [Maple Math] .

There are several variations that can be made to the "plot" command input. For example, one could specify the range values that appear on the graph as follows: plot(x^2, x=-5..5, y=0..15);. If the dependent variable is not declared, the graph will still appear. However, the vertical axis will not have a label. Try the following: plot(x^2, x=-5..5);. Notice that the letter "y" is no longer present.

> plot(x^2);

Plotting error, empty plot

Notice that the independent variable must be specified to avoid the "empty plot" error. However, domain values can be left out of the command. In that case, Maple will use [Maple Math] to [Maple Math] by default. Try plot(x^2,x); to observe this phenomenon.

> f:=x->x^2;

[Maple Math]

By defining the squaring function in a formal way as above, we can avoid specifying the independent variable in the "plot" command. Both plot(f); and plot(f(x),x); will produce graphs of the function f over the domain -10 to +10. In the case of plot(f);, the horizontal axis will not have a label. In other words, the letter "x" will not be present. Maple is interpreting the function f to have an "abstract" independent variable. In the case of plot(f(x),x);, the letter "x" will appear on the horizontal axis since it has been specified as the independent variable. However,...

> plot(f(x));

Plotting error, empty plot

The plotting error occurs here because the independent variable for the function f has been specified as "x", but the horizontal axis is not also defined this way. Maple is confused about the "role" of the horizontal axis. Does it represent the independent variable or not?

Until next issue...!