
Description


•

Environment variables can be used in a simple assignment. In a procedure body, the assignment is automatically undone on exit from the procedure. The value of the environment variable is available to all subprocedures called from that procedure, unless locally superseded.

•

The following is a list of predefined environment variables:

%

%%

%%%

_ans

Digits

UseHardwareFloats

index/newtable

mod

Normalizer

NumericEventHandlers

Order

printlevel

Rounding

Testzero









•

A variable with name beginning with "_Env" is considered an environment variable.

•

$\%$, $\%\%$, and $\%\%\%$ are the results of the last, second last, and third last computation in the current environment.

•

Digits is the number of significant digits used for floatingpoint operations, and is set to 10 initially.

•

mod is set to `modp` initially.

•

Normalizer is set to `normal` initially, and is used by the kernel in series to normalize leading terms of divisors.

•

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.

•

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.

•

Testzero is initialized with proc() evalb(Normalizer(args[1]) = 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, for determining whether a potential pivot is zero. In principle, every test for zero and every call to normal should be done using these functions.

•

The call anames('environment') returns a sequence of all the currently active environment variables. Note that an _Env variable is not considered to be an environment variable at the top level; only once execution is inside a procedure is an environment set up to protect the toplevel value of the variable. So, _Env variables only show up if these variables are modified within a procedure, and anames('environment') is called from within the procedure or at a deeper level of execution.



Examples


>

t := proc() Digits := Digits + 4; end proc:

>

$\mathrm{print}\left(\mathrm{Digits}\right)$

During the execution of "t", Digits is increased by 4, and automatically reset on exit from "t".
>

$\mathrm{print}\left(\mathrm{Digits}\right)$

The following is an example of a userdefined environment variable.
>

$\mathrm{\_Envy}\u2254\mathrm{foo}$

${\mathrm{\_Envy}}{\u2254}{\mathrm{foo}}$
 (4) 
>

p := proc() _Envy := bar end proc:

>

$\mathrm{anames}\left(\mathrm{environment}\right)$

${\mathrm{Testzero}}{,}{\mathrm{UseHardwareFloats}}{,}{\mathrm{Rounding}}{,}{\%}{,}{\mathrm{\_ans}}{,}{\mathrm{\%\%\%}}{,}{\mathrm{Digits}}{,}{\mathrm{index/newtable}}{,}{\mathrm{mod}}{,}{\mathrm{\%\%}}{,}{\mathrm{Order}}{,}{\mathrm{printlevel}}{,}{\mathrm{Normalizer}}{,}{\mathrm{NumericEventHandlers}}{,}{\mathrm{\_Envy}}$
 (7) 
>

p := proc() _Envy := bar; anames(environment) end proc:

${\mathrm{Testzero}}{,}{\mathrm{UseHardwareFloats}}{,}{\mathrm{Rounding}}{,}{\%}{,}{\mathrm{\_ans}}{,}{\mathrm{\%\%\%}}{,}{\mathrm{Digits}}{,}{\mathrm{index/newtable}}{,}{\mathrm{mod}}{,}{\mathrm{\%\%}}{,}{\mathrm{Order}}{,}{\mathrm{printlevel}}{,}{\mathrm{Normalizer}}{,}{\mathrm{NumericEventHandlers}}{,}{\mathrm{\_Envy}}{,}{\mathrm{\_Envy}}$
 (8) 


