Xenakis distribution

From formulasearchengine
Jump to navigation Jump to search

Template:Notability Template:Ref improve Template:Probability distribution

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 . Then, as a line segment is symmetric, its median is .

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 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

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

  1. REDIRECT Template:Probability distributions