ToInert
conversion to an inert representation
FromInert
conversion from an inert representation
Calling Sequence
Parameters
Description
Thread Safety
Examples
ToInert( expr, exclude = { ... }, include = { ... } )
FromInert( inert_expr )
expr
-
expression
inert_expr
valid Inert representation
exclude
specifies a list or set of tags not to convert to inert form
include
specifies the complete list or set of tags to convert to inert form
It can be difficult to manipulate some Maple expressions because they may change form during evaluation. Therefore, it is useful to convert an active form of an expression into an inert form that can be freely modified without worry of evaluation. Once the changes are made, the expression can be converted back to an active form.
The ToInert routine converts any Maple expression into an inert form. The FromInert routine converts any valid inert representation back to an active Maple object.
Inert forms closely mirror the Maple internal DAG data structure representation. For example, the expression xy is stored internally as a power of the name x and the name y. The inert representation is a series of embedded function calls with "_Inert_XXX" names describing the structure of the given expression. There are some differences between the internal representation and the inert representation, mostly in the cases of sums and products, as the internal representation is designed for fast polynomial arithmetic as opposed to convenient programmatic manipulation. For the exact internal representation, see dismantle.
For a list of the various Maple DAGs, refer to the Appendix in the Maple Programming Guide.
The exclude and include options to ToInert allow you to prevent inertization of certain expressions. If an identifier is part of the exclude list then whenever that kind of expression is encountered, an _Inert_VERBATIM tag is created containing the raw expression. Similarly, an include list restricts the tags to only those mentioned in the list. You are allowed either an exclude list, or an include list, not both.
Some expressions cannot be explicitly excluded. Usually this happens for objects that do not make sense on their own (for example, a _Inert_HASHPAIR outside a _Inert_TABLE), or because they cannot be represented outside their context (for example, _INERT_NARGS). Additionally, the _Inert_PROD tag may appear during expansion of a series or a SDMPolynom. Expressions that contain references to parameters and locals also cannot be excluded.
The ToInert and FromInert commands are thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Inspect structure of 5⁢x.
ToInert⁡5⁢x
_Inert_PROD⁡_Inert_NAME⁡x,_Inert_INTPOS⁡5
In a procedure, find all the global names that have no attributes.
f := proc(x) ASSERT(type(x,integer)); ifactor(x) end proc;
f ≔ procxASSERT⁡type⁡x,integer;ifactor⁡xend proc
globals_f≔indets⁡op⁡5,ToInert⁡eval⁡f,1,_Inert_NAME⁡anything
globals_f≔_Inert_NAME⁡ifactor,_Inert_NAME⁡protected
Rename the local variable i to j.
g := proc() local i; end proc;
g ≔ proclocali;end proc
inert_g≔ToInert⁡eval⁡g,1
inert_g≔_Inert_PROC⁡_Inert_PARAMSEQ⁡,_Inert_LOCALSEQ⁡_Inert_NAME⁡i,_Inert_OPTIONSEQ⁡,_Inert_EXPSEQ⁡,_Inert_STATSEQ⁡_Inert_EXPSEQ⁡,_Inert_DESCRIPTIONSEQ⁡,_Inert_GLOBALSEQ⁡,_Inert_LEXICALSEQ⁡,_Inert_EOP⁡_Inert_EXPSEQ⁡
new_g≔FromInert⁡subsop⁡2=subs⁡i=j,op⁡2,inert_g,inert_g
new_g ≔ proclocalj;end proc
Convert to the inert form the expansion of (x+y)^10 without applying ToInert on products.
ToInert⁡expand⁡x+y10,exclude=_Inert_PROD
_Inert_SUM⁡_Inert_VERBATIM⁡x10,_Inert_VERBATIM⁡10⁢x9⁢y,_Inert_VERBATIM⁡45⁢x8⁢y2,_Inert_VERBATIM⁡120⁢x7⁢y3,_Inert_VERBATIM⁡210⁢x6⁢y4,_Inert_VERBATIM⁡252⁢x5⁢y5,_Inert_VERBATIM⁡210⁢x4⁢y6,_Inert_VERBATIM⁡120⁢x3⁢y7,_Inert_VERBATIM⁡45⁢x2⁢y8,_Inert_VERBATIM⁡10⁢x⁢y9,_Inert_VERBATIM⁡y10
See Also
dagtag
dismantle
inert
ProgrammingGuide/Appendix
Download Help Document