MVT API

math.constants
Class RationalConstant

java.lang.Object
  |
  +--math.objects.Expression
        |
        +--math.objects.Constant
              |
              +--math.constants.RationalConstant

public class RationalConstant
extends Constant

RationalConstant.java: The Rational class provides support for Rational numbers.

Since:
JDK1.2
Version:
1.1
Author:
Peter Staab
, for the Mathematical Visualization Project for the Department of Applied Mathematics, University of Colorado at Boulder

Constructor Summary
RationalConstant()
           
RationalConstant(long i)
           
RationalConstant(long i, long j)
           
 
Method Summary
 boolean equalsOne()
           
 boolean equalsZero()
           
 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
 long getDenominator()
           
 long getNumerator()
           
 java.lang.String toString()
           
 
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

RationalConstant

public RationalConstant()

RationalConstant

public RationalConstant(long i)

RationalConstant

public RationalConstant(long i,
                        long j)
Method Detail

toString

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

getNumerator

public long getNumerator()

getDenominator

public long getDenominator()

equalsZero

public boolean equalsZero()

equalsOne

public boolean equalsOne()

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 enteredvalue.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
IllegalEvaluationException - if an error occurs
VariableUndefinedException - for Variables not defined
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:
java.lang.ArithmeticException - for NaN and Divide by Zero
IllegalEvaluationException - if an error occurs
Since:
JDK1.1

MVT API

mvt.icons