| ||||||||||||||||||
The Automatic Simplifier
When an expression is acted upon, it is usually passed direct to the automatic simplifier. The result obtained by the automatic simplifier is then converted into a text format and shown as the result. This is the heart of the Algebra module.
For example, the expression y*sin(pi/2) + x*cos(y-y) is automatically simplified
to the expression x + y.
Almost everything that happens is the result of the automatic simplifier's operations. Among these operations are:
(1) Simple arithmetic. Expressions or subexpressions that consist entirely of arithmetic operations on numbers are replaced by the results of those operations
(2) Rearrangement. The user is at liberty to enter an expression in any form that is
syntactically correct. For efficiency in processing, UltimaCalc's Algebra module needs to have some
standardisation of structure. For example, if an expression is a product containing a numerical
multiplier, then the simplifier will ensure that the numerical multiplier is the first item in the product.
Other rearrangements are done for consistency of display, or for clarity. For example, in the
expression sin(-a-b) it looks as if the argument to sin is negative, so the
expression is rearranged to -sin(a+b).
(3) Simplification of functions. All trigonometric functions other than sin
and cos are converted into equivalent expressions which use only sin and
cos. Then, the arguments to these functions are looked at. If an argument consists solely
of an integer multiplied by pi/12, the function will be converted to the equivalent numeric
value, where possible. For example, the expression sin(pi/6) is replaced by 1/2.
With sinand cos, arguments which are sums containing integer multiples
of pi/2 will be modified to remove such terms, and the function will be changed appropriately.
For example, sin(x+pi/2) is changed to cos(x).
(4) Evaluation of functions. Some functions carry out tasks. An example is
diff which differentiates an expression. For
example, diff(sin(a*x), x) differentiates sin(a*x) with
respect to x to give the result a*cos(a*x) .
Decimal Numbers and the Simplifier
Due to the fact that decimal numbers are inherently restricted in their precision, there are certain simplifications that are valid when using integers or fractions, but which are potentially unjustified when using decimals.
For example, when using fractions, it is reasonable to simplify sin(1/2 * pi) to 1,
but it is not reasonable to assume that sin(0.5 * pi) is also precisely 1, as the
value 0.5 might be the result of losing precision in a value slightly different from 1/2.
Algebra UltimaCalc therefore refrains from performing this simplification.
