Local Names - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Reclaiming the use of the names 'I', 'D', 'gamma', and more

Maple's long history and extensive math library have invariably claimed some names that you may want to use for something else. For example, the capital letter 'I' in Maple means the imaginary unit, but why not the identity matrix instead?  Similarly, after defining variables, A, B, and C, why can't you continue the pattern and use D? In Maple 17 you can.

local D := 5:

D+D;

10

(1)

 

By declaring 'D' local at the top-level, a new local variable has been created with the name 'D' and made the default in the current name-space in a way similar to that of using the short-name to access package exports after using the "with" command to load a package. The global version of this name, the differential operator, is still available by prefixing the name with colon-dash.

:-D(f)(0);

:-Df0

(2)

convert(:-D(f)(0), 'diff');

ⅆⅆt1ft1t1=0|ⅆⅆt1ft1t1=0

(3)

Any variable can be declared local, even ones that are not protected.

local x, y, min:

x := 4.4; y := 320.1; min := 0.001;

x:=4.4

y:=320.1

min:=0.001

(4)

 

The global versions remain available via :-.

:-x, :-y, :-min(x,y);

:-x,:-y,4.4

(5)

 

The imaginary unit, I, also obeys a local declaration even though it is a special alias governed by interface(imaginaryunit). In this case the name of the global version becomes _I instead of :-I.

local I:

I := <1, 0, 0; 0, 1, 0; 0, 0, 1>;

I^2;

_I^2;

1

(6)

See Also

Initially Known Names in Maple