Chapter 10
NCGB Facilitates Natural Notation

Now we turn to a more complicated (though mathematically intuitive) notation. Also we give some more examples of Simplification and GB manufacture. We shall use the variables

y,Inv[y],Inv[1 -  y],a and  x.
(10.1)

In NCAlgebra, lower case letters are noncommutative by default, and functions of noncommutative variables are noncommutative, so the SetNonCommutative command, while harmless, is not necessary. Using Inv[] has the advantage that our TeX display commands recognize it and treat it wisely. Also later we see that the command NCMakeRelations generates defining relations for Inv[] automatically.

10.1 A Simplification example

We want to simplify a polynomial in the variables of (10.1). We begin by setting the variables noncommutative with the following command.

In[5]:= SetNonCommutative[y, Inv[y], Inv[1-y], a, x]

Next we must give the computer a precise idea of what we mean by “simple” versus “complicated”. This formally corresponds to specifying an order on the indeterminates. If Inv[y] and Inv[1 - y] are going to stand for the inverses of y and 1 - y respectively, as the notation suggests, then the order

y < Inv[y] < Inv[1 - y] < a < x
sits well with intuition, since the matrix y is “simpler” than (1 - y)-1. 1 To set this order input 2
In[6]:= SetMonomialOrder[{ y, Inv[y], Inv[1-y], a, x}]

Suppose that we want to connect the Mathematica variables Inv[y] with the mathematical idea of the inverse of y and Inv[1 - y] with the mathematical idea of the inverse of 1 - y. Then just type 3 in the defining relations for the inverses involved.

In[7]:= resol = {y ** Inv[y] == 1,   Inv[y] ** y == 1,  
                 (1 - y) ** Inv[1 - y] == 1,   Inv[1 - y] ** (1 - y) == 1}  
Out[7]= {y ** Inv[y] == 1, Inv[y] ** y == 1,  
       (1 - y) ** Inv[1 - y] == 1, Inv[1 - y] ** (1 - y) == 1}

As an example of simplification, we simplify the two expressions x**x and x + Inv[y] **Inv[1 -y] assuming that y satisfies resol and x **x = a. The following command computes a Gröbner Basis for the union of resol and {x2 - a} and simplifies the expressions x **x and x + Inv[y] **Inv[1 - y] using the Gröbner Basis. Experts will note that since we are using an iterative Gröbner Basis algorithm which may not terminate, we must set a limit on how many iterations we permit; here we specify at most 3 iterations.

In[8]:= NCSimplifyAll[{x**x,x+Inv[y]**Inv[1-y]},Join[{x**x-a},resol],3]  
Out[8]= {a, x + Inv[1 - y] + Inv[y]}

We name the variable Inv[y], because this has more meaning to the user than would using a single letter. Inv[y] has the same status as a single letter with regard to all of the commands which we have demonstrated.

Next we illustrate an extremely valuable simplification command. The following example performs the same computation as the previous command, although one does not have to type in resol explicitly. More generally one does not have to type in relations involving the definition of inverse explicitly. Beware, NCSimplifyRationalX1 picks its own order on variables and completely ignores any order that you might have set.

In[9]:= <<NCSRX1.m  
In[10]:= NCSimplifyRationalX1[{x**x**x,x+Inv[z]**Inv[1-z]},{x**x-a},3]  
Out[11]= {a ** x, x + Inv[1 - z] + inv[z]}

WARNING: Never use inv[  ] with NCGB since it has special properties given to it in NCAlgebra and these are not recognized by the C++ code behind NCGB

10.2 MakingGB’s and Inv[], Tp[]

Here is another GB example. This time we use the fancy Inv[] notation.

In[1]:= <<NCGB.m  
In[2]:= SetNonCommutative[y, Inv[y], Inv[1-y], a, x]  
In[3]:= SetMonomialOrder[{ y, Inv[y], Inv[1-y], a, x}]  
In[4]:= resol = {y ** Inv[y] == 1,   Inv[y] ** y == 1,  
                 (1 - y) ** Inv[1 - y] == 1,   Inv[1 - y] **  
                 (1 - y) == 1}

The following commands makes a Gröbner Basis for resol with respect to the monomial order which has been set.

In[8]:= NCMakeGB[resol,3]  
Out[8]= {1 - Inv[1 - y] + y ** Inv[1 - y], -1 + y ** Inv[y],  
>    1 - Inv[1 - y] + Inv[1 - y] ** y, -1 + Inv[y] ** y,  
>    -Inv[1 - y] - Inv[y] + Inv[y] ** Inv[1 - y],  
>    -Inv[1 - y] - Inv[y] + Inv[1 - y] ** Inv[y]}

10.3 Simplification and GB’s revisited

Changing polynomials to rules

The following command converts a list of relations to a list of rules subordinate to the monomial order specified above.

In[9]:= PolyToRule[%]  
Out[9]= {y ** Inv[1 - y] -> -1 + Inv[1 - y], y ** Inv[y] -> 1,  
>    Inv[1 - y] ** y -> -1 + Inv[1 - y], Inv[y] ** y -> 1,  
>    Inv[y] ** Inv[1 - y] -> Inv[1 - y] + Inv[y],  
>    Inv[1 - y] ** Inv[y] -> Inv[1 - y] + Inv[y]}

Changing rules to polynomials

The following command converts a list of rules to a list of relations.

In[10]:= PolyToRule[%]  
Out[10]= {1 - Inv[1 - y] + y ** Inv[1 - y], -1 + y ** Inv[y],  
>    1 - Inv[1 - y] + Inv[1 - y] ** y, -1 + Inv[y] ** y,  
>    -Inv[1 - y] - Inv[y] + Inv[y] ** Inv[1 - y],  
>    -Inv[1 - y] - Inv[y] + Inv[1 - y] ** Inv[y]}

Simplifying using a GB revisited

We can apply the rules in §10.3 repeatedly to an expression to put it into “canonical form.” Often the canonical form is simpler than what we started with.

In[11]:= Reduction[{Inv[y]**Inv[1-y] - Inv[y]}, Out[9]]  
Out[11]= {Inv[1 - y]}

10.4 Saving lots of time when typing

10.4.1 Saving time when typing relations involving inverses:NCMakeRelations

One can save time in inputting various types of starting relations easily by using the command NCMakeRelations.

In[12]:= <<NCMakeRelations.m  
In[13]:= NCMakeRelations[{Inv,y,1-y}]  
Out[13]= { y ** Inv[y] == 1, Inv[y] ** y == 1,  
           (1 - y) ** Inv[1 - y] == 1, Inv[1 - y] ** (1 - y) == 1}

WARNING

It is traditional in mathematics to use only single characters for indeterminates (e.g., x, y and α). However, we allow these indeterminate names as well as more complicated constructs such as

Inv[x],Inv[y],Inv[1 - x * *y] and Rt[x].
In fact, we allow f[expr] to be an indeterminate if expr is an expression and f is a Mathematica symbol which has no Mathematica code associated to it (e.g., f = Dummy or f = Joe, but NOT f = List or f = Plus). Also one should never use inv[m] to represent m-1 in the input of any of the commands explained within this document, because NCAlgebra has already assigned a meaning to inv[m]. It knows that inv[m] **m is 1 which will transform your starting set of data prematurely.

Besides Inv many more functions are facilitated by NCMakeRelations, see Section 22.0.1.

10.4.2 Saving time working in algebras with involution: NCAddTranspose, NCAddAdjoint

One can save time when working in an algebra with transposes or adjoints by using the command NCAddTranpose[ ] or NCAddAdjoint[ ]. These commands “symmetrize” a set of relations by applying tp[ ] or aj[ ] to the relations and returning a list with the new expressions appended to the old ones. This saves the user the trouble of typing both a = b and tp[a] = tp[b].

            NCAddTranspose[ { a + b , tp[b] == c + a } ]

returns

{ a + b , tp[b] == c + a, b == tp[c] + tp[a], tp[a] + tp[b] }

10.4.3 Saving time when setting orders: NCAutomaticOrder

One can save time in setting the monomial order by not including all of the indeterminants found in a set of relations, only the variables which they are made of. NCAutomaticOrder[aMonomialOrder, aListOfPolynomials] inserts all of the indeterminants found in aListOfPolynomials into aMonomialOrder and sets this order. NCAutomaticOrder[ aListOfPolynomials] inserts all of the indeterminants found in aListOfPolynomials into the ambient monomial order. If x is an indeterminant found in aMonomialOrder then any indeterminant whose symbolic representation is a function of x will appear next to x.

              NCAutomaticOrder[{{a},{b}},  { a**Inv[a]**tp[a] + tp[b]}]

would set the order to be a < tp[a] < Inv[a] b < tp[b].