Transforming algebraic equations and expressions is fundamental to symbolic computation. Although this page refers to the Sym application, it might be useful to anyone interested in symbolic computation. Sym is free, open source code software. Consider the following simple case.
You have an expression to be transformed:
And a transform you want to apply, here's the basic distributive law, expressed as a Sym transform.
You apply the transform with Sym and get the following result:
How does the Transform class transform equations and expressions this way? To understand it's operation, first divide the transform into two pieces. The 'matchToMe' side on the left of the '~', and the 'outPattern' on the right of the '~'. The expression, and both sides of the transform are parsed into individual trees. The expression to be transformed can be visualized as:
Tree data structures are common in computer programming. You might want to Google the concept if you are unfamiliar with them. The left side of the transform can be visualized as:
The transform class will walk the tree shown in figure 2, and while doing so will check to see if there are matching nodes in figure 1. Clearly the '*' and '+' in figure 2 have corresponding nodes in figure 1. There are suitable functions that f1, f2, and f3, can represent. So this transformation can proceed. The following assignments will be made:
The right hand side of the transform is used as a template.
The f1, f2, and f3 variables of this template are replaced by the assignments above. The result is:
Sym can use tree like transforms of any complexity with regards to the number of binary and unary operations. It can also apply the transform to any branch of the expression to be transformed. Download the latest code too see the details.
Here is a list of algebraic transformation expressions in the format Sym uses.
Symbolic Computation, Laws of Algebra, open source code.
Copyright 2012 SymbolicComputation.com