================================================================================ Author: Bhama Sridharan Date: 31 March 2003 ================================================================================ Overall Description =================== This directory contains the python files used to convert an equation to canonical order. The input has to be in the form "..... = ......" . That is, the top root node of the equation is the "=" node. The input is given in graphical form after loading the metamodel 'ExprTree.py'. This metamodel file is generated by the model `ExprTree_ER_mdl.py'. There is a button called 'IdentOperNum' which is used to build the individual nodes of the tree. While connecting the nodes of the tree using the button 'connect', we have to be careful if the order of the children matters (like in 'power' and 'eq' nodes), becuase the child that is connected first to the parent is considered to be the first child of the parent. After building the equation tree, the button 'make_canonical' is pressed to get the canonical form. Since the graphics are not updated currently, the tree does not change in the graphics, but the changed tree is written out in preorder form as output text on the screen. Brief Description of Python files used: ======================================= 1. canonical.py -- Main file which calls the different transformation routines in order. It also calls the preorder print routine of the tree after each transformation so that we can see the tree after each transformation. We can modify the routine main() to call which ever transformation we want in whichever order we want. 2. utilities.py -- The file that has different utility routine like copytree, delete a tree, etc. 3. printtree.py -- This file contains the routines to print the tree. 4. rules.py -- This file contains the routines to do the transformation rules. These rules are numbered as in the document `An algorithm to implement a canonical representation of algebraic expressions in AToM3'. 5. flatten.py -- This file contains the routines to make a binary tree into an n-ary tree in the case of "+" and "*" nodes. 6. convertNodes.py -- This file contains the routines which convert "-" and "/" nodes to "+" and "*" nodes and also the trig functions like 'sec' etc into their corresponding trig forms. 7. constFold.py -- This file contains the routines used in constant folding. 8. Example models are in the subdirectory `models'. These examples are the equations presented in the document `An algorithm...'