4.12 Manipulating an Expression — less useful commands

4.12.1 NCTermArray[expr,aList,anArray]

Aliases: None
Description: NCTermArray[expr,aList,anArray] creates an array anArray whose contents represent the terms of expr sorted by degree. The variables anArray[”variables”], anArray[”types”] and elements such as anArray[x**x,y] and anArray[x **x **x,y **y] to hold the terms with 2 x‘s and 1 y and 3 x’s and 2 y’s, respectively (assuming that aList = {x,y}). You can reconstruct expr from anArray via ReconstuctTaylor[anArray].
Arguments: expr is an algebraic expression, aList is a list of variables and anArray is a symbol.
Comments / Limitations: Not available before NCAlgebra 1.0

The following is an example of the above command.

In[22]:= expr = x ** z ** x ** w + x ** z ** y ** w + z ** x ** x ** w +  
    z ** x ** y ** w;  
 
 
In[23]:= NCTermArray[expr,{x,y},foo]  
 
Out[23]= foo  
 
In[24]:= ??foo  
Global‘foo  
 
foo["types"] = {{1, 1}, {2, 0}}  
 
foo["variables"] := {x, y}  
 
foo[x, y] = x ** z ** y ** w + z ** x ** y ** w  
 
foo[x ** x, 1] = x ** z ** x ** w + z ** x ** x ** w  
 
foo[x___] := 0

4.12.2 NCReconstructFromTermArray[anArray]

Aliases: None
Description: NCTermArray[expr,aList,anArray];
newexpr   = N CReconstructF   romT ermArray[anArray];
sets newexpr equal to expr.
Arguments: anArray is a symbol previously filled by NCTermArray
Comments / Limitations: Not available before NCAlgebra 1.0

If we continue with the example above we have the following

In[24]:= NCReconstructFromTermArray[foo]  
 
Out[24]= x ** z ** x ** w + x ** z ** y ** w + z ** x ** x ** w +  
 
>    z ** x ** y ** w  

However, now one can also do some manipulation before reconstructing as shown below.

In[25]:= foo[x,y] = NCC[foo[x,y],y**w]  
Out[25]= (x ** z + z ** x) ** y ** w  
 
In[26]:= foo[x**x,1] = NCC[foo[x**x,1],x**w]  
 
Out[26]= (x ** z + z ** x) ** x ** w  
 
In[27]:= ??foo  
Global‘foo  
 
foo["types"] = {{1, 1}, {2, 0}}  
 
foo["variables"] := {x, y}  
 
foo[x, y] = NCC[x ** z ** y ** w + z ** x ** y ** w, y ** w]  
 
foo[x ** x, 1] = NCC[x ** z ** x ** w + z ** x ** x ** w, x ** w]  
 
foo[x___] := 0  
 
In[27]:= NCReconstructFromTermArray[foo]  
Out[27]= (x ** z + z ** x) ** x ** w + (x ** z + z ** x) ** y ** w  

4.12.3 NCCompose[aVerySpecialList]

Aliases: NCCom
Description: NCCompose[NCDecompose[poly,a]] will reproduce poly. For example, NCCompose[NCDecompose[poly,a,b], 1, 0] will reconstruct the elements of poly which are of order 1 in a and of order 0 in b.
Arguments:
Comments / Limitations: Called within NCCollect. The average user would never use this.

4.12.4 NCDecompose[expr, listofsymbols]

Aliases: NCDec
Description: NCDecompose[poly, a] or NCDecompose[poly, a, b, c, ...] will produce a list of elements of poly in which elements of the same order of a (or the same order of a, b, c, ... ) are collected together.
Arguments:
Comments / Limitations: Called within NCCollect. The average user would never use this.