An environment variable is similar to a global variable, except that any assignments made to it during the execution of a procedure are only in effect during the execution of that procedure, and any procedures called from it (to any depth) during the execution. When the procedure that assigned the environment variable exits, the assignment is undone, restoring any value the variable may have had previously.
Maple has several built-in environment variables, with initial values as shown:
%, %%, %%%
The previous three results.
Equivalent to %
The built-in normal procedure.
proc(x) evalb(Normalizer(x) = 0) end proc
The built-in modp procedure.
A variable with a name beginning with "_Env" defines a non-built-in environment variable. Such names are not active environment variables, in the sense that no space is reserved to save and restore their values, until they are assigned within a procedure.
%, %%, and %%% are the results of the last, second last, and third last computation in the current environment. _ans is a synonym for %.
Digits is the number of significant digits used for floating-point operations, and is set to 10 initially.
Normalizer is set to `normal` initially, and is used by the kernel in series to normalize leading terms of divisors.
NumericEventHandlers controls how numeric events such as numeric overflow are handled. See NumericEventHandler for details.
Order represents the order of series calculations performed by Maple. It does not represent the order of the series output. Order is set to 6 initially.
Rounding controls the rounding of floating-point results. See Rounding for more details.
Testzero is initialized with proc(x) evalb(Normalizer(x) = 0) end proc, which is a relatively trivial test for zero. Testzero is used in the kernel by series, when it needs to determine whether a leading coefficient is zero for division. It is also used by many symbolic commands in the LinearAlgebra package, for example, to determine if a potential pivot is zero.
UseHardwareFloats controls whether Maple's hardware or software floating-point computation environment is used to perform floating-point operations when hardware floating-point values are present in an expression. See UseHardwareFloats for more information.
`index/newtable` is used as a validation function during the implicit creation of a new table via an assignment such as T[a] := b where T does not yet refer to a table.
`mod` can be set to modp or mods, and controls which function is called to evaluate the mod operator. It is set to `modp` initially. See mod for more information.
The setting of printlevel causes the display of the results of all statements executed up to the level indicated by printlevel. Initially, printlevel is set to 1. See printlevel for more information.
The call anames('environment') returns a sequence of all active environment variables (as listed in the table above), and all global names beginning with _Env, whether or not they are active environment variables yet.
The call anames('environment','active') returns a sequence of only active environment variables. Global names beginning with _Env are included only if they are active in the environment of some active procedure. Thus, this call will never return _Env variables unless invoked from within a procedure that has assigned to such a variable, or a procedure called directly or indirectly by such a procedure.
t := proc() Digits := Digits + 4; end proc:
During the execution of "t", Digits is increased by 4, and automatically reset on exit from "t".
The following are examples of user-defined environment variables.
_EnvX ≔ 1
_EnvY ≔ 2
p := proc() _EnvY := 3 end proc:
The first call below returns the _Env names, but the second does not because they are not currently active.
If called from a procedure, the _Env names that have become active are also returned.
p := proc() _EnvY := 4; anames('environment','active') end proc:
Download Help Document
What kind of issue would you like to report? (Optional)