I have two discrete uniform distributions over same support:

Dx = DiscreteUniformDistribution[{-8, 8}];  
Dy = DiscreteUniformDistribution[{-8, 8}];

I use random variables X $\sim$ Dx, Y $\sim$ Dy to model condition in some if-else clause in C code. For example,

if (3 * x + 1 > y) {

So, I model this condition by random event 3*X + 1 > Y. Then probability I look for is:

  x > y, 
  {Distributed[x, TransformedDistribution[3 * x + 1, Distributed[x, Dx]]],
   Distributed[y, Dy]}

Unfortunately, Mathematica produces nothing. As for me, this is very strange behavior because Mathematica also cannot compute mean for the product distribution of {X, Y}. Maybe, this problem is caused by different support of X and Y.

How can I compute this probability?


1 Answer 1


The following computes the probability you asked for, but I'm at a loss to understand why your notation won't work. It seems correct to me.

 3 x + 1 > y, {Distributed[x, Dx], Distributed[y, Dy]}]

==> 147/289

The Probability / Distribution functions are quite young and hence not fully bulletproofed and I have encountered a number of bugs myself. I suppose/hope that in the next release they will be solved. I suggest you contact Wolfram support (support@wolfram.com). But perhaps someone else here may find out what's wrong.

A few of mine:

No random variates from PDFs that stem from multivariate distributions:

dist = ProbabilityDistribution[
   PDF[BinormalDistribution[{0, 0}, {1, 1}, 0]][{x, 
     y}], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

This works for 3, but not for 5 (and higher):

Expectation[x,x\[Distributed] OrderDistribution[{GeometricDistribution[0.1], 3}, 3]]
Expectation[x,x\[Distributed] OrderDistribution[{GeometricDistribution[0.1], 5}, 5]]

The following crashes the kernel after a minute or so (so, DO NOT EXECUTE):

PDF[TransformedDistribution[Sin[u], u \[Distributed] NormalDistribution[0, 1]], 0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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