Class NormalDistribution

  • All Implemented Interfaces:
    ProbabilityDistribution<Double>

    public class NormalDistribution
    extends Object
    implements ProbabilityDistribution<Double>
    The normal distribution is a continuous probability distribution with probability density function $$ \begin{align*} f(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(x - \mu)^2}{2\sigma^2}} \end{align*} $$ where $\mu$ is the mean and $\sigma$ the standard deviation of the distribution.
    • Constructor Detail

      • NormalDistribution

        public NormalDistribution​(double mean,
                                  double standardDeviation)
        Parameters:
        mean - The mean of the distribution
        standardDeviation - The standard deviation of the distribution, not negative or zero
      • NormalDistribution

        public NormalDistribution​(double mean,
                                  double standardDeviation,
                                  RandomEngine randomEngine)
        Parameters:
        mean - The mean of the distribution
        standardDeviation - The standard deviation of the distribution, not negative or zero
        randomEngine - A generator of uniform random numbers, not null
    • Method Detail

      • getCDF

        public double getCDF​(Double x)
        Returns the cumulative distribution function for a value
        Specified by:
        getCDF in interface ProbabilityDistribution<Double>
        Parameters:
        x - The value, not null
        Returns:
        The cdf
      • getPDF

        public double getPDF​(Double x)
        Return the probability density function for a value
        Specified by:
        getPDF in interface ProbabilityDistribution<Double>
        Parameters:
        x - The value, not null
        Returns:
        The pdf
      • getInverseCDF

        public double getInverseCDF​(Double p)
        Given a probability, return the value that returns this cdf
        Specified by:
        getInverseCDF in interface ProbabilityDistribution<Double>
        Parameters:
        p - The probability, not null. $0 \geq p \geq 1$
        Returns:
        The inverse cdf
      • getMean

        public double getMean()
        Returns:
        The mean
      • getStandardDeviation

        public double getStandardDeviation()
        Returns:
        The standard deviation
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object