org.jscience.mathematics.analysis.expressions.symbolic
Class Rand

java.lang.Object
  extended by org.jscience.mathematics.analysis.expressions.OperatorExpression
      extended by org.jscience.mathematics.analysis.expressions.BinaryOperator
          extended by org.jscience.mathematics.analysis.expressions.symbolic.Rand
All Implemented Interfaces:
java.io.Serializable, Expression, JavaExpressible, XMLExpressible

public class Rand
extends BinaryOperator

Class representing a uniformly distributed random number between two Expression objects. The two Expresssion objects will typically be numbers but may be arbitrary Expressions.
Example of use:

 Constant c1 = new Constant( -7 );
 Constant c2 = new Constant( 11 );
 Expression c3 = new Rand( c1, c2 ); // uniformly distributed random number between -7 and 11.
 Expression e1 = ...;
 Expression e2 = ...;
 Expression e3 = new Rand( e1, e2 );
 

See Also:
Expression, BinaryOperator, Serialized Form

Field Summary
 
Fields inherited from class org.jscience.mathematics.analysis.expressions.BinaryOperator
deriv, evalValid, evalValue, secondOperand, valid
 
Fields inherited from class org.jscience.mathematics.analysis.expressions.OperatorExpression
firstOperand
 
Constructor Summary
Rand(Expression op1, Expression op2)
          Creates a Rand object that represent a random number between the two expressions.
Rand(Expression op1, Expression op2, long seed)
          Creates a Rand object that represent a random number between the two expressions.
 
Method Summary
 boolean equals(java.lang.Object e)
          DOCUMENT ME!
 double eval()
          DOCUMENT ME!
 boolean isDifferentiable()
          DOCUMENT ME!
 boolean isExpandable()
          DOCUMENT ME!
 Expression optimize()
          DOCUMENT ME!
 Expression replace(Expression a, Expression b)
          DOCUMENT ME!
 java.lang.String toJava()
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
 java.lang.String toXML()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.mathematics.analysis.expressions.BinaryOperator
diff, getElements, getSecondOperand, resetNumDiff, resetNumEval, setIndex, setNumberOfIndependents, setSecondOperand, toTaylorMap
 
Methods inherited from class org.jscience.mathematics.analysis.expressions.OperatorExpression
contains, factor, getFirstOperand, isolate, isolate, setFirstOperand
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rand

public Rand(Expression op1,
            Expression op2,
            long seed)
Creates a Rand object that represent a random number between the two expressions.

Parameters:
op1 - First Expression object.
op2 - Second Expression object.
seed - a seed for the random number generator.

Rand

public Rand(Expression op1,
            Expression op2)
Creates a Rand object that represent a random number between the two expressions.

Parameters:
op1 - First Expression object.
op2 - Second Expression object.
Method Detail

eval

public double eval()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isDifferentiable

public boolean isDifferentiable()
DOCUMENT ME!

Specified by:
isDifferentiable in interface Expression
Overrides:
isDifferentiable in class BinaryOperator
Returns:
DOCUMENT ME!
See Also:
Expression.isDifferentiable()

isExpandable

public boolean isExpandable()
DOCUMENT ME!

Specified by:
isExpandable in interface Expression
Overrides:
isExpandable in class BinaryOperator
Returns:
DOCUMENT ME!
See Also:
Expression.isExpandable()

replace

public Expression replace(Expression a,
                          Expression b)
DOCUMENT ME!

Parameters:
a - DOCUMENT ME!
b - DOCUMENT ME!
Returns:
DOCUMENT ME!

equals

public boolean equals(java.lang.Object e)
DOCUMENT ME!

Overrides:
equals in class java.lang.Object
Parameters:
e - DOCUMENT ME!
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

toJava

public java.lang.String toJava()
DOCUMENT ME!

Returns:
DOCUMENT ME!

optimize

public Expression optimize()
DOCUMENT ME!

Returns:
DOCUMENT ME!

toXML

public java.lang.String toXML()
DOCUMENT ME!

Returns:
DOCUMENT ME!