jphase
Class Term

java.lang.Object
  extended by jphase.Term
All Implemented Interfaces:
java.io.Serializable

public class Term
extends java.lang.Object
implements java.io.Serializable

This class describes a basic term in a super-Erlang function It has the form: alpha lambda^n * t^(n-1) * exp(^-m*lambda) / (n-1)! Or alpha * R(n,lambda) where R(n,lambda) is an Erlang pdf.

Author:
Germá Riaño Mendoza. Universidad de los Andes. (C) 2006
See Also:
Serialized Form

Field Summary
static Term ONE
          Number 1.0
 
Constructor Summary
Term(double cf, int pw, double lb)
          Creates a term cf * t^pw exp(-lb * t)
 
Method Summary
 java.lang.Object clone()
          Clones this term
 int compareTo(Term tr)
          Compares according to lambda,power in that order.
static SuperErlang convolution(Term term1, Term term2)
          Return the convolution of this two terms
static SuperErlang convolutionUseExp(Term term1, Term term2)
           
 double defIntegrate()
          Returns the integral from 0 to infinity
 double defIntegrate(double x)
          Returns the integral from 0 to x
 SuperErlang derive()
          Returns the derivative at t
 boolean equalPowers(Term tr)
           
 double evaluate()
          Evaluates this term at infinity
 double evaluate(double x)
          Evaluates this term at the value x
 Term expand(double a)
          Return this term evaluated at t*a
 double getCoeff()
          Returns the value of the coefficient
 int getDegree()
          Returns the value of the degree
 double getLambda()
          Returns the value of lambda
 SuperErlang integrate()
          Returns the integral form 0 to t
 SuperErlang integrateCom()
          Returns the integral from t to infinity
 boolean isConstant()
          Tells if it is constatnt.
 boolean isPTerm()
          Tells if the term is a polinonial
 boolean isZero()
          Tells if it is identically = 0.
protected  double moment(int k)
          Computes the k-th moment
 SuperErlang move(double a)
          Return this term evaluated at t+a
 Term multiply(Term tr)
          Return the product of this term with tr
static Term multiply(Term t1, Term t2)
          Return the product of this two terms
 void setCoeff(double alpha)
          Sets the value of the coefficient
 void setDegree(int n)
          Returns the value of the degree
 void setLambda(double lbd)
          Returns the value of the coefficient
 java.lang.String toString()
           
 java.lang.String toStringE()
          Represents the term as a multiple of an Eralng pdf.
 java.lang.String toStringP()
          String representation of the Polynomial
 java.lang.String toStringRTF()
          RTF representation fo the term
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ONE

public static Term ONE
Number 1.0

Constructor Detail

Term

public Term(double cf,
            int pw,
            double lb)
Creates a term cf * t^pw exp(-lb * t)

Parameters:
cf - coefficient
pw - power
lb - lambda
Method Detail

getCoeff

public double getCoeff()
Returns the value of the coefficient

Returns:
the coefficient

setCoeff

public void setCoeff(double alpha)
Sets the value of the coefficient

Parameters:
alpha - new value

getDegree

public int getDegree()
Returns the value of the degree

Returns:
the degree of this term

setDegree

public void setDegree(int n)
Returns the value of the degree

Parameters:
n -

getLambda

public double getLambda()
Returns the value of lambda

Returns:
the value of lambda

setLambda

public void setLambda(double lbd)
Returns the value of the coefficient

Parameters:
lbd - lambda

clone

public java.lang.Object clone()
Clones this term

Overrides:
clone in class java.lang.Object

isConstant

public boolean isConstant()
Tells if it is constatnt.

Returns:
true if this term represents a constant

isZero

public boolean isZero()
Tells if it is identically = 0.

Returns:
true if this term represents a zero

isPTerm

public boolean isPTerm()
Tells if the term is a polinonial

Returns:
tru if it is a poer term.

equalPowers

public boolean equalPowers(Term tr)
Parameters:
tr -
Returns:
true if both terms have equal powers.

compareTo

public int compareTo(Term tr)
Compares according to lambda,power in that order.

Parameters:
tr - Term to compare to
Returns:
establishes an ordering among terms

evaluate

public double evaluate(double x)
Evaluates this term at the value x

Parameters:
x - Evaluation point
Returns:
Value of the term at the specified point

evaluate

public double evaluate()
Evaluates this term at infinity

Returns:
value of the term at infinity

defIntegrate

public double defIntegrate()
Returns the integral from 0 to infinity

Returns:
Value of the integral from 0 to infinity

defIntegrate

public double defIntegrate(double x)
Returns the integral from 0 to x

Parameters:
x - upper limit of the integral
Returns:
Value of the integral from 0 to x

moment

protected double moment(int k)
Computes the k-th moment

Parameters:
k - required moment
Returns:
k-th moment

integrate

public SuperErlang integrate()
Returns the integral form 0 to t

Returns:
SuperErlang representation of the integral from 0 to t

integrateCom

public SuperErlang integrateCom()
Returns the integral from t to infinity

Returns:
SuperErlang representation of the integral frrm t to infinity

derive

public SuperErlang derive()
Returns the derivative at t

Returns:
SuperErlang representation of the derivative at t

multiply

public static Term multiply(Term t1,
                            Term t2)
Return the product of this two terms

Parameters:
t1 - First term to multiply
t2 - Second term to multiply
Returns:
Product of this two terms

multiply

public Term multiply(Term tr)
Return the product of this term with tr

Parameters:
tr - Term to multiply
Returns:
Product of this term with tr

move

public SuperErlang move(double a)
Return this term evaluated at t+a

Parameters:
a -
Returns:
SuperErlang representation of the term evaluated at t+a

expand

public Term expand(double a)
Return this term evaluated at t*a

Parameters:
a -
Returns:
This term evaluated at t*a

convolution

public static SuperErlang convolution(Term term1,
                                      Term term2)
Return the convolution of this two terms

Parameters:
term1 - First term
term2 - Second term
Returns:
SuperErlang representation the convolution of this two terms

convolutionUseExp

public static SuperErlang convolutionUseExp(Term term1,
                                            Term term2)
Parameters:
term1 -
term2 -
Returns:
Convolution of Term1 and Term2

toString

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

toStringP

public java.lang.String toStringP()
String representation of the Polynomial

Returns:
String representation of the Polynomial

toStringE

public java.lang.String toStringE()
Represents the term as a multiple of an Eralng pdf.

Returns:
aforementioned string

toStringRTF

public java.lang.String toStringRTF()
RTF representation fo the term

Returns:
a string representing this term