next up previous contents
Next: When to use Up: Labels Previous: What is a

Choosing names for labels

The only restrictions Maple places on labels are that they be made up of only letters, digits, and the underscore character (_). Also, they should start with a letter and must be less than 499 characters long. Usually, the length restriction is not a problem - labels are supposed to save typing, not add to it - so most labels consist of only a few characters.

In choosing a label, there are two things to keep in mind. The first is that the label should help identify the result it labels. That is, the label should associate with what it labels. For example, a good label for a polynomial expression would be something like poly, or polynom, or even poly1 if the expression was the first of several that you wanted to label.

The second thing to keep in mind is that short labels will reduce the amount of typing you have to do. Many times, especially if the worksheet is not a long one, a single letter works just fine.

Another thing to keep in mind is that you must avoid using strings that are special to Maple as labels. For example, Maple uses exp to refer to the standard exponential function, so you should never use it as a label. More generally, never use the name of a Maple command as a label. If you don't know all the names of the thousands of Maple commands, don't worry too much because Maple will warn you if you try to use a command name as a label. See the example below.

  > exp := x+1;

Error, attempting to assign to `exp` which is protected

The main use of the underscore character in labels is to separate words. For example, suppose you wanted to use first deriv to label the derivative of an expression. Maple will complain if your label has a space in it, but replacing the space with an underscore works just fine, as shown in the following example.

  > first deriv := diff(x*sin(x),x);

syntax error:
first deriv := diff(x*sin(x),x);

  > first_deriv := diff(x*sin(x),x);

next up previous contents
Next: When to use Up: Labels Previous: What is a

William W. Farr
Mon Aug 28 09:31:56 EDT 1995