## Chapter 23Retrieving Categories and Regular Output

Crucial to our approach to “semi-automatic” discovery of formulas and theorems is the sorting of relations according to which unknowns appear in them — in other words, sorting lists of polynomials into categories. RegularOutput does this sorting and presents categories of relations (by storing them in file). Actually the core of RegularOutput is a command CreateCategories which creates categories and gives them a name. These categories can be summoned into your session using the GetCategory command.

#### 23.0.5 GetCategory[aListOfVariables, NCPAns]

Aliases: None
Description: GetCategory[aListOfV ariables,aName] retrieves the polynomials in the category stored in aName corresponding to the list of variables in the list aListOfV ariables. See Section 14.3 for an example. To be recognized immediately after an NCProcess run aListOfV ariables must equal a list of unknowns which corresponds to a category in that NCProcess run. The NCProcess stores all category information in NCPAns. The next NCProcess starts by clearing NCPAns and writes the category information it produces in NCPAns.
Arguments: aListOfV ariables is a list of variables. aName is a symbol which has not been used previously.
Comments / Limitations: Not available before NCAlgebra 1.2. See CreateCategories.

Another way to summon categories is by ”name”.

#### 23.0.6 GetCategory[aCharString,NCPAns]

Aliases: None
Description:
(1) If aCharString is ”Undigested”, then all of the undigested relations are returned.
(2) If aCharString is ”Digested”, then all of the digested relations are returned.
(3) If aCharString is ”Unknowns”, then all of the undigested relations are returned.
(4) If aCharString is ”Knowns”, then all of the relations involving just knowns are returned.
(5) If aCharString is ”digestedLabels”, then {{}} is returned.
(6) If aCharString is ”digestedRules”, then all of the digested relations are returned.
(7) If aCharString is ”userSelectsRules”, then all of the user selected relations are returned.
(8) If aCharString is ”userSelectsLabels”, then all of the user selected labels are returned.
(9) If aCharString is ”knownsLabels”, then {{}} is returned.
(10) If aCharString is ”knownsRules”, then all of the relations involving just knowns are returned.
(11) If aCharString is ”singleRules”, then all of the relations which solve directly for unknowns are returned.
(12) If aCharString is ”singleVars”, then all of the unknowns which have been solved for directly are returned.

Otherwise, NCPAns[aCharString] is returned.

Arguments: aCharString is a character string. NCPAns is a symbol.

#### 23.0.7 Clear[NCPAns]

Aliases: None
Description: Clear[aName] clears whatever info is stored in aName.
Arguments: Clear[NCPAns] clears NCPAns which might matter to you if you run shaorty of memory.

### 23.1 Example

Suppose we are in a NCProcess session which produced the output on page § and we really like the category whose unknowns are n1 and m1. To bring that category into our session so you can manipulate these equations with Mathematica use the command

 In[17]:=  GetCategories[ { n1,m1 } , NCPAns ]     Out[17]=  {n1**m1 - 1}     In[18]:=  GetCategories[ "singleVars", NCPAns ]     Out[18]=  {a,b,c,e,f,g}

### 23.2 Creating Categories

This is the command which is used inside NCProcess to instruct the C + + code to make categories. It takes aName to be NCPAns.

Before using this commands one must use SetMonomialOrder.

#### 23.2.1 CreateCategories[aListOfPolynomials, aName]

Aliases: None
Description: CreateCategories[aListOfPolynomials,aName] sorts aListOfPolynomials into categories. Each category and its label is stored in the array associated to the symbol aName and it is accessible by aName[label] using the GetCategory command. aListOfPolynomials is a list of polynomials. aName is a symbol which has not been used previously.
Arguments: aListOfPolynomials is a list of polynomials. aName is a Mathematica symbol.
Comments / Limitations: Not available before NCAlgebra 1.2. See GetCategory.

This is the command which is used inside NCProcess to instruct the C + + code to make categories. It takes aName to be NCPAns.

### 23.3 RegularOutput[aListOfPolynomials,“fileName”]

#### 23.3.1 RegularOutput[aListOfPolynomials,“fileName”]

Aliases: None
Description: RegularOutput[aListOfPolynomials,“fileName”] takes the list of polynomials in aListOfPolynomials and organizes this list in a certain way, and places the organized information in a file called “fileName”. It is the heart of the NCProcess display. The organization performed is based on the monomial order which was specified using SetMonomialOrder. Think of every variable in aList1 declared, via SetMonomialOrder[aList1,1], to be lowest in the ordering as a known. The unknowns are the remaining variables denoted var which are defined, via SetMonomialOrder[aList,n] where aList is a list of variables and var in a member of this list and n 2. For RegularOutput the only thing that counts is unknowns. RegularOutput sorts polynomials in aListOfPolynomials into categories consisting of polynomials having the same unknowns.
Arguments: “fileName” is a character string. aListOfPolynomials is a list of polynomials.
Comments / Limitations: Not available before NCAlgebra 1.2

### 23.4 How to Really Change Regular Output

Important to research is how one sorts the output of a GB algorithm. Serious changes might prompt you to edit the command itself. We now give a very few tips. The only files we have modified in the last few years are

 OutputArrayForTeX.m  OutputSingleCategory.m  TypesOfStrategyOutput.m*  NCProcess.m  NCCollectOnVariables.m  NCMakeRelations.m  oCategories.m

The top three of which could be useful for those who wish to make serious changes to the output of the GB algorithm.