Namespaces

Types in MathNet.Numerics.Distributions

Type Triangular

Namespace MathNet.Numerics.Distributions

Interfaces IContinuousDistribution

Triangular distribution. For details, see .

The distribution will use the Random by default. Users can get/set the random number generator by using the RandomSource property.

The statistics classes will check whether all the incoming parameters are in the allowed range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters to false , all parameter checks can be turned off.

Constructors

Static Functions

Methods

Properties

Public Constructors

Triangular(double lower, double upper, double mode, Random randomSource)

Initializes a new instance of the Triangular class with the given lower bound, upper bound and mode.
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Random randomSource

The random number generator which is used to draw random samples.

Triangular(double lower, double upper, double mode)

Initializes a new instance of the Triangular class with the given lower bound, upper bound and mode.
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Public Static Functions

double CDF(double lower, double upper, double mode, double x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

double x

The location at which to compute the cumulative distribution function.

Return
double

the cumulative distribution at location x.

double InvCDF(double lower, double upper, double mode, double p)

Computes the inverse of the cumulative distribution function (InvCDF) for the distribution at the given probability. This is also known as the quantile or percent point function.
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

double p

The location at which to compute the inverse cumulative density.

Return
double

the inverse cumulative density at p.

bool IsValidParameterSet(double lower, double upper, double mode)

Tests whether the provided values are valid parameters for this distribution.
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

double PDF(double lower, double upper, double mode, double x)

Computes the probability density of the distribution (PDF) at x, i.e. ∂P(X ≤ x)/∂x.
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

double x

The location at which to compute the density.

Return
double

the density at x.

double PDFLn(double lower, double upper, double mode, double x)

Computes the log probability density of the distribution (lnPDF) at x, i.e. ln(∂P(X ≤ x)/∂x).
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

double x

The location at which to compute the density.

Return
double

the log density at x.

double Sample(double lower, double upper, double mode)

Generates a sample from the Triangular distribution.
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Return
double

a sample from the distribution.

double Sample(Random rnd, double lower, double upper, double mode)

Generates a sample from the Triangular distribution.
Parameters
Random rnd

The random number generator to use.

double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Return
double

a sample from the distribution.

IEnumerable<double> Samples(Random rnd, double lower, double upper, double mode)

Generates a sequence of samples from the Triangular distribution.
Parameters
Random rnd

The random number generator to use.

double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Return
IEnumerable<double>

a sequence of samples from the distribution.

IEnumerable<double> Samples(double lower, double upper, double mode)

Generates a sequence of samples from the Triangular distribution.
Parameters
double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Return
IEnumerable<double>

a sequence of samples from the distribution.

void Samples(Double[] values, double lower, double upper, double mode)

Fills an array with samples generated from the distribution.
Parameters
Double[] values

The array to fill with the samples.

double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Return
void

a sequence of samples from the distribution.

void Samples(Random rnd, Double[] values, double lower, double upper, double mode)

Fills an array with samples generated from the distribution.
Parameters
Random rnd

The random number generator to use.

Double[] values

The array to fill with the samples.

double lower

Lower bound. Range: lower ≤ mode ≤ upper

double upper

Upper bound. Range: lower ≤ mode ≤ upper

double mode

Mode (most frequent value). Range: lower ≤ mode ≤ upper

Return
void

a sequence of samples from the distribution.

Public Methods

double CumulativeDistribution(double x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
Parameters
double x

The location at which to compute the cumulative distribution function.

Return
double

the cumulative distribution at location x.

double Density(double x)

Computes the probability density of the distribution (PDF) at x, i.e. ∂P(X ≤ x)/∂x.
Parameters
double x

The location at which to compute the density.

Return
double

the density at x.

double DensityLn(double x)

Computes the log probability density of the distribution (lnPDF) at x, i.e. ln(∂P(X ≤ x)/∂x).
Parameters
double x

The location at which to compute the log density.

Return
double

the log density at x.

bool Equals(object obj)

int GetHashCode()

Type GetType()

double InverseCumulativeDistribution(double p)

Computes the inverse of the cumulative distribution function (InvCDF) for the distribution at the given probability. This is also known as the quantile or percent point function.
Parameters
double p

The location at which to compute the inverse cumulative density.

Return
double

the inverse cumulative density at p.

double Sample()

Generates a sample from the Triangular distribution.
Return
double

a sample from the distribution.

IEnumerable<double> Samples()

Generates a sequence of samples from the Triangular distribution.
Return
IEnumerable<double>

a sequence of samples from the distribution.

void Samples(Double[] values)

Fills an array with samples generated from the distribution.

string ToString()

A string representation of the distribution.
Return
string

a string representation of the distribution.

Public Properties

double Entropy get;

Gets the entropy of the distribution.

double LowerBound get;

Gets the lower bound of the distribution.

double Maximum get;

Gets the maximum of the distribution.

double Mean get;

Gets the mean of the distribution.

double Median get;

Gets the median of the distribution.

double Minimum get;

Gets the minimum of the distribution.

double Mode get;

Gets or sets the mode of the distribution.

Random RandomSource get; set;

Gets or sets the random number generator which is used to draw random samples.

double Skewness get;

Gets the skewness of the distribution.

double StdDev get;

Gets the standard deviation of the distribution.

double UpperBound get;

Gets the upper bound of the distribution.

double Variance get;

Gets the variance of the distribution.