Skip to content

Probability of max/min of independent random variables #24755

Discussion options

You must be logged in to vote

Using max(X, Y) will fail because max is not a symbolic function (and cannot be overloaded by a dunder).

The correct way is Max(X, Y) and in that case the error is:

In [6]: from sympy.stats import Die, P
   ...: from sympy import Max
   ...: X = Die("", 3)
   ...: Y = Die("", 6)

In [7]: Max(X, Y) > 1
Out[7]: Max(, ) > 1

In [8]: P(Max(X, Y) > 1)
---------------------------------------------------------------------------
ValueError: Overlapping Random Variables

Why does it think that the variables are overlapping? That's because you gave them both the same name (the empty string) which also explains the weird printing.

If you give them different names then you'll get an answer:

In [9]: from 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@michelececcacci
Comment options

Answer selected by michelececcacci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants