JSci.maths.symbolic
Class Variable

java.lang.Object
  extended by JSci.maths.symbolic.Expression
      extended by JSci.maths.symbolic.Variable
All Implemented Interfaces:
java.io.Serializable, Field.Member, Ring.Member, AbelianGroup.Member, Member

public class Variable
extends Expression

Variables in an Expression.

See Also:
Serialized Form

Constructor Summary
Variable(java.lang.String n, java.lang.Object valueSet)
           
 
Method Summary
 Expression differentiate(Variable x)
          Differentiation of the expression with respect to a variable
 boolean equals(java.lang.Object o)
           
 Expression evaluate()
          This method substitutes the variable with the variable values, if non-null; they can be Contants or other Expressions.
protected  int getPriority()
          Get the priority of the operator described by the expression.
 java.lang.Object getSet()
           
 Member getValue()
          Get the value of the variable.
 void setValue(Member o)
          Set the value of the variable.
 java.lang.String toString()
           
 
Methods inherited from class JSci.maths.symbolic.Expression
add, difference, differentiate, divide, divide, inverse, inverse, main, multiply, negate, negative, power, product, product, rise, subtract, sum, sum
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Variable

public Variable(java.lang.String n,
                java.lang.Object valueSet)
Parameters:
n - the name (symbol) of the variable
valueSet - the set to which the variable values belong, e.g. RealField.getInstance(). Note it is not the Class of the values (odd thing indeed).
Method Detail

setValue

public void setValue(Member o)
Set the value of the variable.

Parameters:
o - the value; can be null to unset the variable

getValue

public Member getValue()
Get the value of the variable.

Returns:
the value of the variable; null if the variable is unset.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

differentiate

public Expression differentiate(Variable x)
Description copied from class: Expression
Differentiation of the expression with respect to a variable

Specified by:
differentiate in class Expression
Parameters:
x - the variable

evaluate

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

Specified by:
evaluate in class Expression
Returns:
the evaluated Expression. Can be a Constant.

getPriority

protected int getPriority()
Description copied from class: Expression
Get the priority of the operator described by the expression. This is needed only for allowing toString() to generate the parenthesis when needed.

Specified by:
getPriority in class Expression
Returns:
the priority

getSet

public java.lang.Object getSet()