edu.uah.math.distributions
Class TriangleDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.TriangleDistribution
All Implemented Interfaces:
java.io.Serializable

public class TriangleDistribution
extends Distribution
implements java.io.Serializable

This class models the triangle distribution on a specified interval. If (X, Y) is uniformly distributed on a triangular region, then X and Y have triangular distribuitons.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
static int DOWN
           
static int UP
           
 
Fields inherited from class edu.uah.math.distributions.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
TriangleDistribution()
          This default constructor creates a new triangle distribution on the interval (0, 1) with positive slope.
TriangleDistribution(double a, double b, int i)
          This general constructor creates a new triangle distribution on a specified interval and with a specified orientation.
 
Method Summary
 double getCDF(double x)
          This method computes the cumulative distribution function.
 double getDensity(double x)
          This method computes the density.
 double getLowerBound()
          This method returns the lower bound
 double getMaxDensity()
          This method computes the maximum value of the density function.
 double getMean()
          This method computes the mean.
 int getOrientation()
          This method returns the orientation.
 double getUpperBound()
          This method returns the upper bound.
 double getVariance()
          This method computes the variance.
 void setLowerBound(double a)
          This method sets the lower bound
 void setOrientation(int i)
          This method sets the orientation.
 void setParameters(double a, double b, int i)
          This method sets the parameters: the minimum value, maximum value, and orientation.
 void setUpperBound(double b)
          This method sets the upper bound.
 double simulate()
          This method simulates a value from the distribution.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class edu.uah.math.distributions.Distribution
getDomain, getFailureRate, getMedian, getMGF, getMoment, getMoment, getPGF, getQuantile, getSD, getType, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UP

public static final int UP
See Also:
Constant Field Values

DOWN

public static final int DOWN
See Also:
Constant Field Values
Constructor Detail

TriangleDistribution

public TriangleDistribution(double a,
                            double b,
                            int i)
This general constructor creates a new triangle distribution on a specified interval and with a specified orientation.

Parameters:
a - the left endpoint of the domain
b - the right endpoint of the domain param i the orientation (UP or DOWN)

TriangleDistribution

public TriangleDistribution()
This default constructor creates a new triangle distribution on the interval (0, 1) with positive slope.

Method Detail

setParameters

public void setParameters(double a,
                          double b,
                          int i)
This method sets the parameters: the minimum value, maximum value, and orientation.

Parameters:
a - the left endpoint of the domain
b - the right endpoint of the domain
i - the orientation (UP or DOWN)

getDensity

public double getDensity(double x)
This method computes the density.

Specified by:
getDensity in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the probability density at x

getMaxDensity

public double getMaxDensity()
This method computes the maximum value of the density function.

Overrides:
getMaxDensity in class Distribution
Returns:
the maximum value of the probability density function

getMean

public double getMean()
This method computes the mean.

Overrides:
getMean in class Distribution
Returns:
the mean of the distribution

getVariance

public double getVariance()
This method computes the variance.

Overrides:
getVariance in class Distribution
Returns:
the variance of the distribution

setLowerBound

public void setLowerBound(double a)
This method sets the lower bound

Parameters:
a - the lower bound

getLowerBound

public double getLowerBound()
This method returns the lower bound

Returns:
the left endpoint of the domain

setUpperBound

public void setUpperBound(double b)
This method sets the upper bound.

Parameters:
b - the upper bound

getUpperBound

public double getUpperBound()
This method returns the upper bound.

Returns:
the right endpoint of the domain

setOrientation

public void setOrientation(int i)
This method sets the orientation.

Parameters:
i - the orientation (UP or DOWN)

getOrientation

public int getOrientation()
This method returns the orientation.

Returns:
the orientation (UP or DOWN)

simulate

public double simulate()
This method simulates a value from the distribution.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

getCDF

public double getCDF(double x)
This method computes the cumulative distribution function.

Overrides:
getCDF in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the cumulative distribution at x

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class Distribution
Returns:
a string giving the name of the distribution and the values of the parameters