Changes between Version 14 and Version 15 of Symbolic Expressions
- Timestamp:
- 02/13/10 18:51:34 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Symbolic Expressions
v14 v15 3 3 Write here your thoughts on the new design of the symbolic module. 4 4 5 == Organization ==5 == Organization of Symbolic Module == 6 6 7 7 The following directory/package structure will be used: 8 9 `symbolic` 8 10 * `symbolic.IF`: interface. All items that will be exported go in here. 9 * `symbolic.IF.type` 10 * `symbolic.IF.expression` 11 * `symbolic.IF.type`: types of symbolic expressions 12 * `symbolic.IF.expression`: symbolic expressions 11 13 * `symbolic.real`: this is an implementation based on real-arithmetic and canonical forms. 12 14 * `symbolic.real.type` 13 15 * `symbolic.real.expression` 14 * `SymbolicModule` 16 * `SymbolicModule`: entry point 15 17 * `public static SymbolicUniverseIF newRealUniverse();` 16 18 17 == Interface `symbolic.IF` ==18 19 19 Package `symbolic.IF.type`: 20 == Infinite Precision Rational Numbers == 21 22 In package `util` we need to add a class supporting infinite precision rational arithmetic. It will be implemented on top of `BigInteger`: 23 * `Rational` /* infinite precision rational numbers */ 24 * `static Rational rational(int value);` 25 * `static Rational rational(double value);` 26 * `static Rational rational(BigInteger value);` 27 * `static Rational add(Rational arg0, Rational arg1);` 28 * `static Rational subtract(Rational arg0, Rational arg1);` 29 * `static Rational multiply(Rational arg0, Rational arg1);` 30 * `static Rational divide(Rational arg0, Rational arg1);` 31 * `static Rational minus(Rational arg);` 32 * `static int compare(Rational arg0, Rational arg1);` /* +-0 */ 33 * `boolean isInteger();` 34 * `BigInteger intValue();` 35 * `BigInteger numerator();` 36 * `BigInteger denominator();` 37 * `BigInteger floor();` 38 * `BigInteger ceil();` 39 * `boolean isGT0();` 40 * `boolean isGTE0();` 41 * `boolean is0();` 42 43 == Interface to Symbolic Module == 44 45 package `symbolic.IF.type`: 20 46 * `SymbolicTypeIF` 21 47 * `SymbolicPrimitiveTypeIF` /* int, real, boolean */ … … 31 57 * `SymbolicTypeIF outputType();` 32 58 33 Package `symbolic.IF.expression`:59 package `symbolic.IF.expression`: 34 60 * `SymbolicExpressionIF` 35 61 * `int id();` /* every expression has a unique id number */ … … 45 71 * `SymbolicExpressionIF[] arguments();` 46 72 47 package `symbolic `:73 package `symbolic.IF`: 48 74 * `SymbolicUniverseIF` 49 75 * `SymbolicPrimitiveTypeIF booleanType();` … … 76 102 * `SymbolicExpressionIF simplify(SymbolicExpressionIF expression);` 77 103 78 79 In util we need to export:80 * `Rational` /* infinite precision rational numbers */81 * `static Rational rational(int value);`82 * `static Rational rational(double value);`83 * `static Rational rational(BigInteger value);`84 * `static Rational add(Rational arg0, Rational arg1);`85 * `static Rational subtract(Rational arg0, Rational arg1);`86 * `static Rational multiply(Rational arg0, Rational arg1);`87 * `static Rational divide(Rational arg0, Rational arg1);`88 * `static Rational minus(Rational arg);`89 * `static int compare(Rational arg0, Rational arg1);` /* +-0 */90 * `boolean isInteger();`91 * `BigInteger intValue();`92 * `BigInteger numerator();`93 * `BigInteger denominator();`94 * `BigInteger floor();`95 * `BigInteger ceil();`96 * `boolean isGT0();`97 * `boolean isGTE0();`98 * `boolean is0();`99 104 100 == Implementation: `symbolic.real`==105 == An Implementation of the Symbolic Module == 101 106 102 Package `symbolic.real` will implement the interface defined above. 103 The idea is to aggressively put every expression into a canonical form. It assumes real arithmetic, so addition and multiplication are as in the real numbers. 107 Package `symbolic.real` will implement the interface defined above. The idea is to aggressively put every expression into a canonical form. It assumes real arithmetic, so addition and multiplication are as in the real numbers. 104 108 105 109 Additional Interfaces: … … 116 120 * `ConcreteExpression` 117 121 118 Classes:122 `symbolic.real.expression` classes: 119 123 * `RealExpression implements SymbolicExpressionIF` 120 124 * `ConcreteExpression extends RealExpression implements ConcreteExpressionIF` … … 143 147 * `Monomial extends RealExpression` 144 148 * coefficient: `Rational` 145 * factors: set of pairs (`PrimitiveExpression X, int i`), where i>0, representing the product X_1^{i_1} ...X_n^{i_n}149 * factors: set of pairs (`PrimitiveExpression X, int i`), where i>0, representing the product X_1^{i_1}^ ... X_n^{i_n}^ 146 150 * `RationalExpression extends RealExpression` 147 151 * numerator, denominator: `Polynomial` 148 152 149 153 Some facts which show how to put any expression into this canonical form: 154 * `f/g>0 <=> ((f>0 && g>0) || (f<0 && g<0))` 155 * `f/g=0 <=> f=0` 150 156 * `x>=y <=> !(y-x>0)` 151 157 * `x<y <=> y-x>0`
