JSci.maths.symbolic
Class Expression

java.lang.Object
  extended by JSci.maths.symbolic.Expression
All Implemented Interfaces:
java.io.Serializable, Field.Member, Ring.Member, AbelianGroup.Member, Member
Direct Known Subclasses:
Constant, Evaluation, Function, Negative, Power, Product, Sum, Variable

public abstract class Expression
extends java.lang.Object
implements Field.Member

The basic abstract class for doing analytical calculations.

See Also:
Serialized Form

Constructor Summary
Expression()
           
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member g)
          The group composition law.
static Expression difference(AbelianGroup.Member a, AbelianGroup.Member b)
          Method for generating an Expression by a formal operation on a set member
 Expression differentiate(java.util.Hashtable ht)
          Differentiation of the expression with respect to the variables
abstract  Expression differentiate(Variable x)
          Differentiation of the expression with respect to a variable
 Field.Member divide(Field.Member f)
          The multiplication law with inverse.
static Expression divide(Field.Member f, Field.Member g)
          Method for generating an Expression by a formal operation on a set member
abstract  Expression evaluate()
          This method substitutes the variable with the variable values, if non-null; they can be Contants or other Expressions.
protected abstract  int getPriority()
          Get the priority of the operator described by the expression.
 Field.Member inverse()
          Returns the inverse member.
static Expression inverse(Field.Member f)
          Method for generating an Expression by a formal operation on a set member
static void main(java.lang.String[] args)
          Put some expressions like "sin(2*x)/x+3/z" in the command line.
 Ring.Member multiply(Ring.Member r)
          The multiplication law.
 AbelianGroup.Member negate()
          Returns the negative member.
static Expression negative(AbelianGroup.Member r)
          Method for generating an Expression by a formal operation on a set member
static Expression power(Field.Member f, int g)
          Method for generating an Expression by a formal operation on a set member
static Expression product(Ring.Member[] args)
          Method for generating an Expression by a formal operation on a set member
static Expression product(Ring.Member a, Ring.Member b)
          Method for generating an Expression by a formal operation on a set member
 Ring.Member rise(int f)
          Power of an expression.
 AbelianGroup.Member subtract(AbelianGroup.Member g)
          The group composition law with inverse.
static Expression sum(AbelianGroup.Member[] args)
          Method for generating an Expression by a formal operation on a set member
static Expression sum(AbelianGroup.Member a, AbelianGroup.Member b)
          Method for generating an Expression by a formal operation on a set member
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface JSci.maths.Member
getSet
 

Constructor Detail

Expression

public Expression()
Method Detail

differentiate

public Expression differentiate(java.util.Hashtable ht)
Differentiation of the expression with respect to the variables

Parameters:
ht - table with variable / derivative order

differentiate

public abstract Expression differentiate(Variable x)
Differentiation of the expression with respect to a variable

Parameters:
x - the variable

evaluate

public abstract Expression evaluate()
This method substitutes the variable with the variable values, if non-null; they can be Contants or other Expressions. Simplification is performed.

Returns:
the evaluated Expression. Can be a Constant.

getPriority

protected abstract int getPriority()
Get the priority of the operator described by the expression. This is needed only for allowing toString() to generate the parenthesis when needed.

Returns:
the priority

inverse

public Field.Member inverse()
Description copied from interface: Field.Member
Returns the inverse member.

Specified by:
inverse in interface Field.Member
Returns:
the inverse member.

divide

public Field.Member divide(Field.Member f)
The multiplication law with inverse.

Specified by:
divide in interface Field.Member
Parameters:
f - a field member

multiply

public Ring.Member multiply(Ring.Member r)
The multiplication law.

Specified by:
multiply in interface Ring.Member
Parameters:
r - a ring member

add

public AbelianGroup.Member add(AbelianGroup.Member g)
The group composition law.

Specified by:
add in interface AbelianGroup.Member
Parameters:
g - a group member

negate

public AbelianGroup.Member negate()
Returns the negative member.

Specified by:
negate in interface AbelianGroup.Member

subtract

public AbelianGroup.Member subtract(AbelianGroup.Member g)
The group composition law with inverse.

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
g - a group member

rise

public Ring.Member rise(int f)
Power of an expression. Only constant and integer exponent.

Parameters:
f - the exponent.

negative

public static Expression negative(AbelianGroup.Member r)
Method for generating an Expression by a formal operation on a set member


sum

public static Expression sum(AbelianGroup.Member a,
                             AbelianGroup.Member b)
Method for generating an Expression by a formal operation on a set member


sum

public static Expression sum(AbelianGroup.Member[] args)
Method for generating an Expression by a formal operation on a set member


difference

public static Expression difference(AbelianGroup.Member a,
                                    AbelianGroup.Member b)
Method for generating an Expression by a formal operation on a set member


product

public static Expression product(Ring.Member a,
                                 Ring.Member b)
Method for generating an Expression by a formal operation on a set member


product

public static Expression product(Ring.Member[] args)
Method for generating an Expression by a formal operation on a set member


inverse

public static Expression inverse(Field.Member f)
Method for generating an Expression by a formal operation on a set member


divide

public static Expression divide(Field.Member f,
                                Field.Member g)
Method for generating an Expression by a formal operation on a set member


power

public static Expression power(Field.Member f,
                               int g)
Method for generating an Expression by a formal operation on a set member


main

public static void main(java.lang.String[] args)
                 throws ParseException
Put some expressions like "sin(2*x)/x+3/z" in the command line. The program writes the expression, the simplifyed expression and the derivative.

Throws:
ParseException