MVT API

math.objects
Class Expression

java.lang.Object
  |
  +--math.objects.Expression
Direct Known Subclasses:
BinaryExpression, Constant, UnaryExpression, Variable

public abstract class Expression
extends java.lang.Object

The Expr class defines a binary node that contains a data element and a left child and right child each pointing to a expr class object

Since:
JDK1.1
Version:
1.0
Author:
Peter Staab
, Pete Fox , both for the Mathematical Visualization Project for the Department of Applied Mathematics, University of Colorado at Boulder

Constructor Summary
Expression()
           
 
Method Summary
abstract  Expression differentiate(Variable var)
          An abstract method that returns a Expression representation of the derivative of the current Expression.
 double evaluate()
          An abstract method used to evaluate a symbolic object given a nothing
 double evaluate(Variable var, double value)
          An abstract method used to evaulate a symbolic object given a one variable name and one value
 double evaluate(Variable var1, double value0, Variable var2, double value1)
          An abstract method used to evaluate a symbolic object given two variable names and two values
 double evaluate(Variable var1, double value0, Variable var2, double value1, Variable var3, double value2)
          A method used to evaluate a symbolic object given three variable names and three values
 double evaluate(Variable var1, double value1, Variable var2, double value2, Variable var3, double value3, Variable var4, double value4)
          A method used to evaluate a symbolic object given 4 variable names and 4 values
abstract  double evaluate(VariableSet variables, double[] values)
          A new abstract method used to evaulate a symbolic object given an ordered variable vector and a corresponding array of constant values
abstract  Expression evaluateVariables(VariableSet variables, double[] values)
          An abstract method used to evaluate a symbolic object containing multiple variables given only one variable name and one value
abstract  Expression simplify()
          An abstract method that returns a Expression representation of the the current Expression but in a simplified form with redundant terms eliminated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Expression

public Expression()
Method Detail

evaluate

public double evaluate()
                throws java.lang.ArithmeticException,
                       VariableUndefinedException
An abstract method used to evaluate a symbolic object given a nothing

Returns:
a double representing the value of the Expression.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
VariableUndefinedException - for Variables not defined
Since:
JDK1.1

evaluate

public double evaluate(Variable var,
                       double value)
                throws java.lang.ArithmeticException,
                       VariableUndefinedException
An abstract method used to evaulate a symbolic object given a one variable name and one value

Parameters:
var - the name of the Variable associated with the function
value - the value of the Variable
Returns:
a double representing the value of the Expression for the entered value.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
VariableUndefinedException - for Variables not defined
Since:
JDK1.1

evaluate

public double evaluate(Variable var1,
                       double value0,
                       Variable var2,
                       double value1)
                throws java.lang.ArithmeticException,
                       VariableUndefinedException
An abstract method used to evaluate a symbolic object given two variable names and two values

Parameters:
var1 - the name of the first Variable associated with the function
value0 - a double value
var2 - the name of the second Variable associated with the function
value1 - the value of the first Variable
Returns:
a double representing the value of the Expression for the entered values.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
VariableUndefinedException - for Variables not defined
Since:
JDK1.1

evaluate

public double evaluate(Variable var1,
                       double value0,
                       Variable var2,
                       double value1,
                       Variable var3,
                       double value2)
                throws java.lang.ArithmeticException,
                       VariableUndefinedException
A method used to evaluate a symbolic object given three variable names and three values

Parameters:
var1 - the name of the first Variable associated with the function
value0 - a double value
var2 - the name of the second Variable associated with the function
value1 - the value of the first Variable
var3 - the name of the second Variable associated with the function
value2 - the value of the second Variable
Returns:
a double representing the value of the Expression for the entered values.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
VariableUndefinedException - for Variables not defined
Since:
JDK1.1

evaluate

public double evaluate(Variable var1,
                       double value1,
                       Variable var2,
                       double value2,
                       Variable var3,
                       double value3,
                       Variable var4,
                       double value4)
                throws java.lang.ArithmeticException,
                       VariableUndefinedException
A method used to evaluate a symbolic object given 4 variable names and 4 values

Parameters:
var1 - the name of the first Variable associated with the function
value1 - the value of the first Variable
var2 - the name of the second Variable associated with the function
value2 - the value of the second Variable
var3 - the name of the second Variable associated with the function
value3 - the value of the third Variable
Returns:
a double representing the value of the Expression for the entered values.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
VariableUndefinedException - for Variables not defined

evaluate

public abstract double evaluate(VariableSet variables,
                                double[] values)
                         throws java.lang.ArithmeticException,
                                IllegalEvaluationException,
                                VariableUndefinedException
A new abstract method used to evaulate a symbolic object given an ordered variable vector and a corresponding array of constant values

Parameters:
variables - a VariableSet value
Returns:
a double representing the value of the Expression for the entered value.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
IllegalEvaluationException - if an error occurs
VariableUndefinedException - for Variables not defined
Since:
JDK1.1

differentiate

public abstract Expression differentiate(Variable var)
An abstract method that returns a Expression representation of the derivative of the current Expression.

Parameters:
var - the variable of differentiation
Returns:
an Expression object representing the derivative of the current object

simplify

public abstract Expression simplify()
An abstract method that returns a Expression representation of the the current Expression but in a simplified form with redundant terms eliminated.

Returns:
an Expression object in a simplified form

evaluateVariables

public abstract Expression evaluateVariables(VariableSet variables,
                                             double[] values)
                                      throws java.lang.ArithmeticException,
                                             IllegalEvaluationException
An abstract method used to evaluate a symbolic object containing multiple variables given only one variable name and one value

Parameters:
variables - a VariableSet value
values - a double[] value
Returns:
a Expression object representing the given Expression with one of it's variables evaluated for the given value.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
IllegalEvaluationException - if an error occurs

MVT API

mvt.icons