Xenakis distribution

From Wikipedia, the free encyclopedia
Xenakis
Probability density function
Cumulative distribution function
Parameters a>0 length of the interval (real)
Support x\in [0;a]
pdf \scriptstyle {\frac  {2}{a}}\left(1-{\frac  {x}{a}}\right)
pour \scriptstyle x\in [0,a]
CDF {\frac  {2ax-x^{2}}{a^{2}}} for \scriptstyle x\in [0,a]
Mean \operatorname {E}[X]={\frac  {a}{3}}
Median a\left(1-{\frac  {{\sqrt  {2}}}{2}}\right)
Mode 0
Variance {\frac  {a^{2}}{18}}
Skewness {\frac  {2{\sqrt  {2}}}{5}}
Ex. kurtosis {\frac  {12}{5}}
Entropy {\frac  {3}{2}}
MGF {\frac  {2(e^{{at}}-at-1)}{t^{{2}}a^{{2}}}}
CF {\tfrac  {2-2\cos \left(at\right)+e^{{-ita}}-e^{{iat}}+2iat}{t^{2}a^{2}}}

In probability theory, a Xenakis distribution is a probability distribution the graph of whose probability density function on the interval from 0 to a positive number a is a straight line giving the function the value 0 at a. Thus the region under the graph of the density function is a triangle. It is a triangular distribution with parameters 0, a, and 0. It is named after Iannis Xenakis, who used this distribution in his book Musiques formelles (Formal Music),[1] where he described it as the distribution of the length of a line segment that is included inside another fixed line segment.

simulation of a random line segment with CaRMetal; histogram over 10,000 lengths

Properties

Probability density function

The probability density function of a Xenakis distribution is a linear function on [0,a]. Then, as a line segment is symmetric, its median is {\frac  {a}{2}}.

Cumulative distribution function

The cumulative distribution function of a Xenakis distribution is of degree 2; then, to simulate it with the use of the cumulative distribution function, one needs a square root.

Xenakis distribution of parameter 1

simulation of the minimum of 2 uniform random variables on [0,1] made with CaRMetal; histogram on 10,000 values

When its parameter is 1, a Xenakis distribution is a Beta distribution which parameters are 1 and 2. Hence, a Xenakis variable of parameter 1 can be defined also as the minimum of two variables which are uniform on [0,1]

Related distributions

  • The minimum of 2 Xenakis variables of parameter 1 is Beta with parameters 1 and 4.

Simulation

Three algorithms are in use when simulating a Xenakis variable of parameter 1:

  1. The first version uses the definition: Generate 2 uniform random variables then compute the absolute value of their difference;
  2. A variant is suggested by the definition as a Beta variable: Generate 2 uniform variables then compute their minimum;
  3. Xenakis used the inverse of the cumulative distribution: The third version below.

Python (language)'s timeit module allows to measure the performances of these algorithms then to compare them:

from timeit import *
from random import *
from math import *
 
def version1():
	return abs(uniform(0,1)-uniform(0,1))
def version2():
	return min(uniform(0,1),uniform(0,1))
def version3():
	return 1-sqrt(1-uniform(0,1))
 
print(Timer('x=version1()',"from __main__ import version1").timeit())
print(Timer('x=version2()',"from __main__ import version2").timeit())
print(Timer('x=version3()',"from __main__ import version3").timeit())

Surprisingly, the third version is faster than the others, probably because it is the only one to use only one random uniform variable. It is even possible to make it faster with

def version3():
	return 1-sqrt(uniform(0,1))

References

External links

This article is issued from Wikipedia. The text is available under the Creative Commons Attribution/Share Alike; additional terms may apply for the media files.