Changes between Version 14 and Version 15 of Symbolic Expressions


Ignore:
Timestamp:
02/13/10 18:51:34 (16 years ago)
Author:
Stephen Siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Symbolic Expressions

    v14 v15  
    33Write here your thoughts on the new design of the symbolic module.
    44
    5 == Organization ==
     5== Organization of Symbolic Module ==
    66
    77The following directory/package structure will be used:
     8
     9`symbolic`
    810 * `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
    1113 * `symbolic.real`: this is an implementation based on real-arithmetic and canonical forms.
    1214    * `symbolic.real.type`
    1315    * `symbolic.real.expression`
    14  * `SymbolicModule`
     16 * `SymbolicModule`: entry point
    1517    * `public static SymbolicUniverseIF newRealUniverse();`
    1618
    17 == Interface `symbolic.IF` ==
    1819
    19 Package `symbolic.IF.type`:
     20== Infinite Precision Rational Numbers ==
     21
     22In 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
     45package `symbolic.IF.type`:
    2046 * `SymbolicTypeIF`
    2147 * `SymbolicPrimitiveTypeIF` /* int, real, boolean */
     
    3157    * `SymbolicTypeIF outputType();`
    3258
    33 Package `symbolic.IF.expression`:
     59package `symbolic.IF.expression`:
    3460 * `SymbolicExpressionIF`
    3561    * `int id();` /* every expression has a unique id number */
     
    4571    * `SymbolicExpressionIF[] arguments();`
    4672
    47 package `symbolic`:
     73package `symbolic.IF`:
    4874 * `SymbolicUniverseIF`
    4975    * `SymbolicPrimitiveTypeIF booleanType();`
     
    76102    * `SymbolicExpressionIF simplify(SymbolicExpressionIF expression);`
    77103 
    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();`
    99104
    100 == Implementation: `symbolic.real` ==
     105== An Implementation of the Symbolic Module ==
    101106
    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.
     107Package `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.
    104108
    105109Additional Interfaces:
     
    116120       * `ConcreteExpression`
    117121
    118 Classes:
     122`symbolic.real.expression` classes:
    119123 * `RealExpression implements SymbolicExpressionIF`
    120124 * `ConcreteExpression extends RealExpression implements ConcreteExpressionIF`
     
    143147 * `Monomial extends RealExpression`
    144148    * 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}^
    146150 * `RationalExpression extends RealExpression`
    147151    * numerator, denominator: `Polynomial`
    148152
    149153Some 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`
    150156 * `x>=y <=> !(y-x>0)`
    151157 * `x<y <=> y-x>0`