Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A number of functions operate with Mathematica's set of distributions e.g.

Through[{Mean, StandardDeviation, Variance}[UniformDistribution[{umin,umax}]]]

which returns the correct result

    {(umax + umin)/2, (umax - umin)/(2 Sqrt[3]), 1/12 (umax - umin)^2}

However, when I add two continuous distributions, thus creating a kind of annular distribution, it will not be evaluated.

Through[{Mean, StandardDeviation, Variance}[
  UniformDistribution[{umin, umax}] - 
   UniformDistribution[{\[Epsilon] umin, \[Epsilon] umax}]]]

I think I had a very good look at the Mathematica documentation but I simply could not find any indication of how to define "my own distribution".

Please note, that I know how to handle such functions, i.e., how to calculate the Mean ... The issue of this question is, are there ways in Mathematica, I have missed, that allow me to use Mathematica's functionality on distributions with my distributions I have defined using Mathematica's distributions.

share|improve this question
up vote 5 down vote accepted

The way to combine distributions would be to use TransformedDistribution. Your code could be written as follows:

Through[{Mean, StandardDeviation, Variance}[
   x - y, 
    x \[Distributed] UniformDistribution[{umin, umax}], 
    y \[Distributed] UniformDistribution[{\[Epsilon] umin, \[Epsilon] umax}]

Mathematica graphics

If you want to define distributions that work like the built-in distributions, have a look at this workshop.

share|improve this answer
Thank you very much that was exactly what I was looking for. The collection guide/DerivedDistributions summarizes a number of other functions I was looking for. – Ernst Stelzer Oct 26 '13 at 13:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.