Expression simplification |
This page in 2007 Top Previous Next |
|
The formula =IF(A1+B2+C3+D4>E6+F7+G8+H9, can be expressed more simply as =MAX(A1+B2+C3+D4,E6+F7+G8+H9) The second formula is better than the first as it •is shorter, and so easier to read •mentions the two subexpressions once each rather than twice, so it is more robust to change. OAK is able to transform long expressions of this kind into shorter ones automatically. It does so by recognising patterns in formulas, and replacing them by equivalents according to a number of algebraic rules. In the example above, the rule is =IF(x>y,x,y) maps to MAX(x,y) OAK recognises that the first formula matches the pattern, with x=A1+B2+C3+D4, and y=E6+F7+G8+H9. It then replaces the IF(...) in the formula with =MAX(x,y), substituting the terms it has matched to x and y as necessary. OAK is equipped with about fifty algebraic rules which it can apply to simplify formulas. They are activated by the Formula | Optimize command. See also |