drasys.or.prob
Class NormalDistribution

java.lang.Object
  |
  +--drasys.or.prob.Distribution
        |
        +--drasys.or.prob.ContinuousDistribution
              |
              +--drasys.or.prob.NormalDistribution

public class NormalDistribution
extends ContinuousDistribution
implements ContinuousDistributionI

An implementation of the Normal probability distribution.

References:

The Art of Computer Programming: Seminumerical Algorithms (Vol 2, 3rd Ed)
    Donald Ervin Knuth; Hardcover
Numerical Recipes in C : The Art of Scientific Computing
    William H. Press, et al / Hardcover / Published 1993
Probability and Statistics
    Morris H. Degroot / Hardcover / Published 1986
Mathematical Statistics With Applications
    Dennis D. Wackerly, et al / Hardcover / Published 1996

See Also:
Serialized Form

Inner Class Summary
 class NormalDistribution.Cdf
           
 class NormalDistribution.Pdf
           
 
Constructor Summary
NormalDistribution()
          Create normal distribution with mean = 0 and std = 1.
NormalDistribution(double mean, double std)
          Create normal distribution with explicit mean and std.
NormalDistribution(double mean, double std, IntegrationI integration)
          The argument integration will be used to compute the cdf from the pdf.
NormalDistribution(double mean, double std, IntegrationI integration, EquationSolutionI solver)
          The argument integration will be used to compute the cdf from the pdf.
NormalDistribution(double mean, double std, long seed)
          Create normal distribution with explicit parameters and set the random seed.
 
Method Summary
 double cdf(double x)
          Computes the cdf by numerical integration using the pdf.
 boolean equals(java.lang.Object o)
           
 double function(double x)
           
 double getRandomScaler()
          Returns a random number from the normal distribution.
 double inverseCdf(double probability)
          Computes the inverse cdf from the cdf numerically.
 double mean()
          Returns the mean of the distribution.
 double pdf(double x)
          Returns the value of the probability distribution function at x;
 double probability(double x1, double x2)
          Computes the the probability that x will be between x1 and x2 by numerical integration using the pdf.
 void setParameters(double mean, double std)
          Sets the distribution parameters.
 double std()
          Returns the standard deviation of the distribution.
 java.lang.String toString()
           
 double variance()
          Returns the variance of the distribution.
 
Methods inherited from class drasys.or.prob.ContinuousDistribution
probability
 
Methods inherited from class drasys.or.prob.Distribution
getRandomMatrix, getRandomNumberGenerator, getRandomVector, setElements, setElements, setRandomNumberGenerator, setSeed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NormalDistribution

public NormalDistribution()
Create normal distribution with mean = 0 and std = 1.

NormalDistribution

public NormalDistribution(double mean,
                          double std)
Create normal distribution with explicit mean and std.

NormalDistribution

public NormalDistribution(double mean,
                          double std,
                          long seed)
Create normal distribution with explicit parameters and set the random seed.

NormalDistribution

public NormalDistribution(double mean,
                          double std,
                          IntegrationI integration)
The argument integration will be used to compute the cdf from the pdf.

NormalDistribution

public NormalDistribution(double mean,
                          double std,
                          IntegrationI integration,
                          EquationSolutionI solver)
The argument integration will be used to compute the cdf from the pdf. The argument solver will be used to compute the inverse cdf from the cdf. Setting either integration or solver to null will cause the default to be used.
Method Detail

function

public double function(double x)

cdf

public double cdf(double x)
Computes the cdf by numerical integration using the pdf.
Throws:
StatError - if the integration fails.

inverseCdf

public double inverseCdf(double probability)
Computes the inverse cdf from the cdf numerically.
Specified by:
inverseCdf in interface ContinuousDistributionI
Overrides:
inverseCdf in class ContinuousDistribution
Throws:
StatError - if the solution fails.

probability

public double probability(double x1,
                          double x2)
Computes the the probability that x will be between x1 and x2 by numerical integration using the pdf.
Throws:
StatError - if the integration fails.
InvalidArgumentError - if x2 < x1.

setParameters

public void setParameters(double mean,
                          double std)
Sets the distribution parameters.
Throws:
InvalidArgumentError - if std <= 0.0.

pdf

public double pdf(double x)
Returns the value of the probability distribution function at x;

mean

public double mean()
Returns the mean of the distribution.

variance

public double variance()
Returns the variance of the distribution.

std

public double std()
Returns the standard deviation of the distribution.

getRandomScaler

public double getRandomScaler()
Returns a random number from the normal distribution.
Overrides:
getRandomScaler in class ContinuousDistribution

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

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


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com