Composite (class)

A composite distribution consisting of some math operator between one or two other Distribution objects.

For example:

g = distl.gaussian(10, 2)
u = distl.gaussian(1, 5)

c = g * u
print(c)

or:

import numpy as np
g = distl.gaussian(0, 1)
sin_g = np.sin(g)
print(sin_g)

Currently supported operators include:

  • multiplication, division, addition, subtraction
  • np.sin, np.cos, np.tan (but not math.sin, etc)
  • bitwise and (&), bitwise or (|)

When doing math between a distribution and a float or integer, that float/int will be treated as a Delta distribution. In some simple cases, the applicable distribution type will be returned, but in other cases, a Composite distribution will be returned. For example, multiplying a Uniform or Gaussian distribution by a float will return another Uniform or Gaussian distribution, respectively.

Limitations and treatment "under-the-hood":