|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.uah.math.distributions.Distribution edu.uah.math.distributions.MatchDistribution
public class MatchDistribution
This class models the distribution of the number of matches in a random permutation. A match occurs whenever an element is in its natural order.
Field Summary |
---|
Fields inherited from class edu.uah.math.distributions.Distribution |
---|
CONTINUOUS, DISCRETE, MIXED |
Constructor Summary | |
---|---|
MatchDistribution()
This default constructor creates a new mathcing distribuiton with parameter 5. |
|
MatchDistribution(int n)
This general constructor creates a new matching distribution with a specified parameter. |
Method Summary | |
---|---|
double |
getDensity(double x)
This method computes the probability density function. |
double |
getMaxDensity()
This method gives the maximum value of the probability density function. |
double |
getMean()
This method returns the mean, which is 1, regardless of the parameter value. |
int |
getParameter()
This method gets the parameter. |
double |
getVariance()
This method returns the variance, which is 1 regardless of the parameter value. |
void |
setParameter(int n)
This method sets the parameter of the distribution. |
double |
simulate()
This method simulates a value from the distribution, by generating a random permutation and computing the number of matches. |
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 |
---|
getCDF, 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 |
Constructor Detail |
---|
public MatchDistribution(int n)
n
- the number of elementspublic MatchDistribution()
Method Detail |
---|
public void setParameter(int n)
n
- the size of the random permutationpublic double getDensity(double x)
getDensity
in class Distribution
x
- a number in the domain {0, 1, 2, ...}
public double getMaxDensity()
getMaxDensity
in class Distribution
public double getMean()
getMean
in class Distribution
public double getVariance()
getVariance
in class Distribution
public int getParameter()
public double simulate()
simulate
in class Distribution
public java.lang.String toString()
toString
in class Distribution
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |