Assignment statements

The statement

    > r := sqrt(x^2+y^2);
defines the symbol r. The definition remains in effect during the session until it is explicitly redefined or removed. We can do:
    > plot3d(r, x=-1..1, y=-1..1);

A second assignment to r replaces the previous definition, as in:

    > r := ln(x)/x;

To show the expression assigned to a symbol, type the symbol's name:

    > r;
            (sqrt(x^2+y^2))

To remove the definition assigned to r, that is, to undefine r, assign r to itself:

    > r := r;

Remark: The latter is incompatible with Maple's syntax where one types r := 'r';

Assignments are evaluated recursively:

    > r := sqrt(x^2+y^2);
    > x := a+b;
    > r;
            (sqrt((a+b)^2+y^2))

The order of assignments is immaterial, that is:

    > x := a+b;
    > r := sqrt(x^2+y^2);
    > r;
            (sqrt((a+b)^2+y^2))

In either case, if subsequently the definition of x is removed, then r reverts to its previous value:

    > x := x;
    > r;
            (sqrt(x^2+y^2))

It is also possible to assign a name to a plot, as in:

    > p := plot3d(x^2+y^2, x=-1..1, y=-1..1);

This evaluates and displays the graph. Had we terminated the statement with a colon instead of a semicolon, the displaying of the graph would have been suppressed.

To display a named graph, type its name, as in:

    > p;

The command

    > dump;
displays the contents of the symbol table.

The command

    > restart;
clears the symbol table, i.e., undefines all previously defined symbols, in effect putting dynagraph in a freshly started state.
Back to table of contents