Chapter 32
Representing Noncommutative Expressions with Commutative Ones.

32.0.3 NCXRepresent[aListOfExpressions, aListOfVariables, aListOfDims, aListOfFunctions, aListOfExtraRules]

Aliases: none
Description: NCXRepresent[aListOfExpressions,aListOfVariables, aListOfDims, aListOfFunctions,aListOfExraRules] replaces each occurrence of the variables in the list aListOfVariables with a matrix in commuting symbols of size specified in aListOfDims in the set of relations in the first arguement. The argument aListOfDims should be a list of pairs {n1,n2} specifying the number of rows and columns of the corresponding variable. The fourth arguement is best described by an example. If one has the variable x and also the indeterminate F[x], then often one wants the F[x] to be replaced by a symbolic matrix as well as x. If F appears in the fourth list, every occurrence of indeterminates F[x],F[y] etc. will be replaced by matrices of the same size as x,y etc. with entries that look like Fx11,,Fy11,. This clearly is not appropriate for functions such as Aj and Tp denoting the adjoint and transpose of a symbol. But for other functions such as Inv this is quite necessary. The output of NCXRepresent is a matrix for each relation in aListOfExpressions.

The last (fifth) arguement is a sort of catch-all for unusual rules specific to the problem. The following are some favorites.
Arguments: aListOfVariables, aListOfDims, aListOfExpressions, aListOfFunctions, aListOfExtraRules
Comments / Limitations: If aListOfExpressions includes constant terms, one must first replace them with a variable and then use the optional list of rules to replace them with identity matrices of appropriate size. Mathematica does bad things to expressions that contain both a matrix and a constant, namely it adds the constant to each entry of the matrix. Any of the lists other than aListOfExpressions may be left as the empty set. A warning: if a variable appears only as the arguement in a function in aListOfFunctions one must still put the variable in the second arguement, and its size in the third. The reason is, its size must be specified somewhere for the function to work. aListOfVariables should include only those variables that are to be replaced by purely symbolic matrices, and should not appear in the left-hand side of a rule in aListOfOptionalRules.

Examples

 
  In[99]:= NCXRepresent[  {A**B}, { A, B}, { {2,1}, {1,1}  },{},{} ]  
 
 Out[99]:= {{{A11 B11},{A21 B11}}}  
 
 
 
  In[100]:= NCXRepresent[  {A**tp[B]}, { A, B}, { {2,2}, {1,2} }, {tp},{} ] =  
 
 Out[100]:= {{{A11 B11+A12 B12},{A21 B11+A22 B12}}}