 Accessing Top-level Commands after Rebinding Their Names - Maple Programming Help

Accessing Top-level Commands after Rebinding Their Names

 Some commands in Maple have similar names. For example, the top-level command name diff is similar to the package-level command name VectorCalculus[diff].
 When the short-form name of package-level command is defined using the with command, the short-form name is bound to the package-level command. This happens regardless of whether a top-level command with the same name, protected or not, exists. For example, after issuing with(VectorCalculus, diff), the command name diff refers to the package-level VectorCalculus[diff] command.
 You can still directly access the top-level command after its name has been rebound if the package invoked is implemented as a module, but not if the package is implemented as a table.

How to determine if a package is implemented as a module or table

 Use the type command to determine if a package is implemented as a module or as a table.
 • type(packagename, module);
 • type(packagename, table);
 For example,
 > type(networks, 'module');
 ${\mathrm{false}}$ (1)
 > type(VectorCalculus, 'module');
 ${\mathrm{true}}$ (2)
 Once you have determined how the package has been implemented, follow the instructions in one of the following sections.

Packages Implemented as Modules

 To use a top-level command after its name has been rebound to a package-level command, use the colon-dash syntax (:-commandname).
 The following example intentionally employs an error message to illustrate which command level is used.
 > diff( );
 Note: The message refers to the top-level diff command.
 Now invoke the VectorCalculus package.
 > with(VectorCalculus);
 $\left[{\mathrm{&x}}{,}{\mathrm{*}}{,}{\mathrm{+}}{,}{\mathrm{-}}{,}{\mathrm{.}}{,}{\mathrm{<,>}}{,}{\mathrm{<|>}}{,}{\mathrm{About}}{,}{\mathrm{AddCoordinates}}{,}{\mathrm{ArcLength}}{,}{\mathrm{BasisFormat}}{,}{\mathrm{Binormal}}{,}{\mathrm{ConvertVector}}{,}{\mathrm{CrossProduct}}{,}{\mathrm{Curl}}{,}{\mathrm{Curvature}}{,}{\mathrm{D}}{,}{\mathrm{Del}}{,}{\mathrm{DirectionalDiff}}{,}{\mathrm{Divergence}}{,}{\mathrm{DotProduct}}{,}{\mathrm{Flux}}{,}{\mathrm{GetCoordinateParameters}}{,}{\mathrm{GetCoordinates}}{,}{\mathrm{GetNames}}{,}{\mathrm{GetPVDescription}}{,}{\mathrm{GetRootPoint}}{,}{\mathrm{GetSpace}}{,}{\mathrm{Gradient}}{,}{\mathrm{Hessian}}{,}{\mathrm{IsPositionVector}}{,}{\mathrm{IsRootedVector}}{,}{\mathrm{IsVectorField}}{,}{\mathrm{Jacobian}}{,}{\mathrm{Laplacian}}{,}{\mathrm{LineInt}}{,}{\mathrm{MapToBasis}}{,}{\nabla }{,}{\mathrm{Norm}}{,}{\mathrm{Normalize}}{,}{\mathrm{PathInt}}{,}{\mathrm{PlotPositionVector}}{,}{\mathrm{PlotVector}}{,}{\mathrm{PositionVector}}{,}{\mathrm{PrincipalNormal}}{,}{\mathrm{RadiusOfCurvature}}{,}{\mathrm{RootedVector}}{,}{\mathrm{ScalarPotential}}{,}{\mathrm{SetCoordinateParameters}}{,}{\mathrm{SetCoordinates}}{,}{\mathrm{SpaceCurve}}{,}{\mathrm{SurfaceInt}}{,}{\mathrm{TNBFrame}}{,}{\mathrm{TangentLine}}{,}{\mathrm{TangentPlane}}{,}{\mathrm{TangentVector}}{,}{\mathrm{Torsion}}{,}{\mathrm{Vector}}{,}{\mathrm{VectorField}}{,}{\mathrm{VectorPotential}}{,}{\mathrm{VectorSpace}}{,}{\mathrm{Wronskian}}{,}{\mathrm{diff}}{,}{\mathrm{eval}}{,}{\mathrm{evalVF}}{,}{\mathrm{int}}{,}{\mathrm{limit}}{,}{\mathrm{series}}\right]$ (3)
 The VectorCalculus package contains a diff command. For differences between the two commands, see diff and VectorCalculus[diff].
 Enter the diff(); command again.
 > diff();
 The message now indicates that the error is generated by the VectorCalculus package-level command and not the top-level diff command.
 To use the top-level diff command, use the :- syntax.
 > :-diff();
 Note: The message once again indicates that the error is generated by the top-level diff function.

Packages Implemented as Tables

 To use a top-level command after its name has been rebound to a package-level command, you must first use the restart; command.
 The following example intentionally employs an error message to illustrate which command level is used.
 > minimize();
 Note: The message refers to the top-level minimize command.
 > with(simplex);
 $\left[{\mathrm{basis}}{,}{\mathrm{convexhull}}{,}{\mathrm{cterm}}{,}{\mathrm{define_zero}}{,}{\mathrm{display}}{,}{\mathrm{dual}}{,}{\mathrm{feasible}}{,}{\mathrm{maximize}}{,}{\mathrm{minimize}}{,}{\mathrm{pivot}}{,}{\mathrm{pivoteqn}}{,}{\mathrm{pivotvar}}{,}{\mathrm{ratio}}{,}{\mathrm{setup}}{,}{\mathrm{standardize}}\right]$ (4)
 The simplex package contains a minimize command.
 > minimize();
 Note: The message refers to the package-level simplex[minimize] command.
 > :-minimize();
 Note: Packages implemented as tables overwrite any conflicting top-level commands when you invoke the package. You cannot access the top-level command by using the :- syntax.
 To use the top-level minimize command, first invoke the restart command.
 > restart;
 > minimize();
 >
 Note: The message once again refers to the top-level minimize command.