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

Online Help

All Products    Maple    MapleSim


ToInert

conversion to an inert representation

FromInert

conversion from an inert representation

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Calling Sequence

ToInert( expr, exclude = { ... }, include = { ... } )

FromInert( inert_expr )

Parameters

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

Description

• 

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.

Thread Safety

• 

The ToInert and FromInert commands are thread-safe as of Maple 15.

• 

For more information on thread safety, see index/threadsafe.

Examples

Inspect structure of 5x.

ToInert5x

_Inert_PROD_Inert_NAMEx,_Inert_INTPOS5

(1)

In a procedure, find all the global names that have no attributes.

f := proc(x) ASSERT(type(x,integer)); ifactor(x) end proc;

fprocxASSERTtypex,integer;ifactorxend proc

(2)

globals_findetsop5,ToInertevalf,1,_Inert_NAMEanything

globals_f_Inert_NAMEifactor,_Inert_NAMEprotected

(3)

Rename the local variable i to j.

g := proc() local i; end proc;

gproclocali;end proc

(4)

inert_gToInertevalg,1

inert_g_Inert_PROC_Inert_PARAMSEQ,_Inert_LOCALSEQ_Inert_NAMEi,_Inert_OPTIONSEQ,_Inert_EXPSEQ,_Inert_STATSEQ_Inert_EXPSEQ,_Inert_DESCRIPTIONSEQ,_Inert_GLOBALSEQ,_Inert_LEXICALSEQ,_Inert_EOP_Inert_EXPSEQ

(5)

new_gFromInertsubsop2=subsi=j,op2,inert_g,inert_g

new_gproclocalj;end proc

(6)

Convert to the inert form the expansion of (x+y)^10 without applying ToInert on products.

ToInertexpandx+y10,exclude=_Inert_PROD

_Inert_SUM_Inert_VERBATIMx10,_Inert_VERBATIM10x9y,_Inert_VERBATIM45x8y2,_Inert_VERBATIM120x7y3,_Inert_VERBATIM210x6y4,_Inert_VERBATIM252x5y5,_Inert_VERBATIM210x4y6,_Inert_VERBATIM120x3y7,_Inert_VERBATIM45x2y8,_Inert_VERBATIM10xy9,_Inert_VERBATIMy10

(7)

See Also

dagtag

dismantle

inert

ProgrammingGuide/Appendix