Skip to main content

PiecewiseLinear

Base class: Distribution

Returns random real numbers distributed linearly within the given intervals with default value [0.0,1.0], and densities with default value [1.0].

The probability density is given by,

f(x∣I,w)=x(Ik+1−Ik)12∑j(wj+wj+1)(Ij+1−Ij)(Ik+1wk+Ikwk+1),if Ik≤x<Ik+1. f(x | I, w) = \frac{x}{(I_{k+1} - I_k)\frac{1}{2}\sum_j (w_j + w_{j+1})(I_{j+1} - I_{j})}\left(I_{k+1}w_k + I_{k}w_{k+1} \right),\quad \text{if } I_k \leq x < I_{k+1}.

where IkI_k represent the elements of the intervals parameter and a wkw_k represents the elements of the densities parameter.

Constructors​

PiecewiseLinear(const PiecewiseLinear distribution) -> PiecewiseLinear​

Copy constructor for PiecewiseLinear distribution.

Parameters​

Symbols​

NameDescription
=Copy assignment operator for PiecewiseLinear distribution.

Members​

NameDescription
densitiesWeights of each interval.
intervalsBoundaries of each interval.
maxReturns the maximum possible value from the distribution
minReturns the minimum possible value from the distribution
sampleSample from distribution.