Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mef/schema/random_deviate.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ beta-deviate = element beta-deviate { expression, expression }

histogram = element histogram { expression, bin+ }

piecewise-linear = element piecewise-linear { bin+ }

bin = element bin { expression, expression }
1 change: 1 addition & 0 deletions mef/schema/stochastic_layer.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ random-deviate =
| gamma-deviate
| beta-deviate
| histogram
| piecewise-linear

test-event = test-initiating-event | test-functional-event
40 changes: 40 additions & 0 deletions mef/stochastic_layer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ As for arithmetic operators and built-ins, this list can be extended on demand.
+-----------------------+------------+-------------------------------------------------------------------------------------------------------------+
| **histograms** | any | discrete distributions defined by means of a list of pairs |
+-----------------------+------------+-------------------------------------------------------------------------------------------------------------+
| **piecewise-linear** | >1 | piecewise-linear distributions defined by means of a list of pairs |
+-----------------------+------------+-------------------------------------------------------------------------------------------------------------+

Uniform Deviates
These primitives describe uniform distributions in a given range
Expand Down Expand Up @@ -713,6 +715,44 @@ Histograms
with the initial value
:math:`x_0 = 0, x_1 = 2m_1, \text{ and } x_i = x_{i-1} + 2(m_i - x_{i-1})`.

Piecewise-Linear Distributions
Piecewise-linear distributions are lists of pairs :math:`(b_0, w_0), \ldots, (b_n, w_n)`,
where the :math:`b_i`'s are bounds of successive, contiguous intervals
such that :math:`b_i < b_{i+1}` for :math:`i = 0, \dots, n-1`,
and the :math:`w_i`'s are non-negative weights of corresponding interval bounds :math:`b_i`.
A piecewise-linear distribution can approximate a continuous distribution function [#HC94]_.

The distribution is defined by the following probability density function:

.. math::

f(x;b_0,\ldots,b_n, w_0,\ldots,w_n) = \frac{1}{S}
\left[\frac{w_k - w_{k-1}}{b_k - b_{k-1}}(x - b_{k-1}) + w_{k-1}\right]

Where :math:`k` is such that:

.. math::

b_{k-1} \leq x < b_k \quad \forall k \in \mathbb{Z} : 1 \leq k \leq n

:math:`S` is the total weight of the intervals for normalization:

.. math::

S = \sum_{i=1}^{n}\tfrac{1}{2}(w_i + w_{i-1})(b_i - b_{i-1})

The expected value of the piecewise-linear distribution is as follows.

.. math::

E(x) = \frac{1}{6S}
\sum_{i=1}^{n}(b_i - b_{i-1})[w_i(2b_i + b_{i-1}) + w_{i-1}(b_i + 2b_{i-1})]


.. [#HC94] B. Hamann and J. L. Chen,
"Data point selection for piecewise linear curve approximation,"
Computer Aided Geometric Design, vol. 11, no. 3, pp. 289-301, 1994.


XML Representation
------------------
Expand Down
1 change: 1 addition & 0 deletions spelling_wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Ai
CCF
Fi
Hamann
LAnguage
Napierian
PSA
Expand Down