MVT API

math.constants
Class RealConstant

java.lang.Object
  |
  +--math.objects.Expression
        |
        +--math.objects.Constant
              |
              +--math.constants.RealConstant
Direct Known Subclasses:
E, Pi

public class RealConstant
extends Constant

The class Constant is used to create mathematical Constant objects. It extends the Expression class.

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

Constructor Summary
RealConstant(double value)
           
 
Method Summary
 double evaluate(VariableSet vars, double[] values)
          A method used to evaluate a Constant object given an ordered variable vector and a corresponding array of constant double values
 Expression evaluateVariables(VariableSet variables, double[] values)
          A method used to evaluate a Constant object containing multiple variables given only one variable name and one value
 double getValue()
          Returns the Constant object's value as a double
 void setValue(double value)
          Alternate method to set the Constant object's value to a double
 java.lang.String toString()
          Overrides the toString() method of the Object class.
 
Methods inherited from class math.objects.Constant
differentiate, simplify
 
Methods inherited from class math.objects.Expression
evaluate, evaluate, evaluate, evaluate, evaluate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RealConstant

public RealConstant(double value)
Method Detail

getValue

public double getValue()
Returns the Constant object's value as a double

Returns:
the Constant object's value as a double

setValue

public void setValue(double value)
Alternate method to set the Constant object's value to a double


toString

public java.lang.String toString()
Overrides the toString() method of the Object class. This gives a string represenation of the Symbolic Object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the Constant Object

evaluate

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

Specified by:
evaluate in class Expression
Parameters:
vars - the name of the VariableVector of Variables associated with the function.
Returns:
a double representing the value of the Expression for the entered value.
Throws:
VariableUndefinedException - for Variables not defined
java.lang.ArithmeticException - for NaN and Divide by Zero
IllegalEvaluationException - if an error occurs
Since:
JDK1.1

evaluateVariables

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

Specified by:
evaluateVariables in class Expression
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:
IllegalEvaluationException - if the number of variables do not equal the number of values.
java.lang.ArithmeticException - for NaN and Divide by Zero
Since:
JDK1.1

MVT API

mvt.icons