-
Notifications
You must be signed in to change notification settings - Fork 1
Maximum and Minimum
MthwRobinson edited this page Dec 21, 2014
·
1 revision
The Maximum
and Minimum
procedures compute the distribution of the maximum and minimum of a series of random variables. These procedures can accept a variable number of arguments. For instance, Maximum(X,Y)
can be entered to compute the maximum of two random variables and Maximum(W,X,Y,Z)
can be entered to compute the maximum of four random variables. MaximumIID(X,n)
and MinimumIID(X,n)
can be used to compute the maximum or minimum of n IID random variables.
Maximum(X,Y,...,Z)
Minimum(X,Y,...,Z)
MaximumIID(X,n)
MinimumIID(X,n)
In [34]: X=TriangularRV(Rational(2),Rational(4),Rational(6))
In [35]: Y=TriangularRV(Rational(3),Rational(5),Rational(7))
In [36]: Z=TriangularRV(Rational(4),Rational(5),Rational(9))
In [37]: # Compute the maximum of two random variables
In [38]: A=Maximum(X,Y)
In [39]: A.display()
continuous pdf
for 3 <= x <= 4
---------------------------
⎛ 2 ⎞ ⎛ 2 ⎞
(2⋅x - 6)⋅⎝x - 4⋅x + 4⎠ (2⋅x - 4)⋅⎝x - 6⋅x + 9⎠
──────────────────────── + ────────────────────────
64 64
---------------------------
for 4 <= x <= 5
---------------------------
⎛ 2 ⎞ ⎛ 2 ⎞
(2⋅x - 12)⋅⎝x - 6⋅x + 9⎠ (2⋅x - 6)⋅⎝x - 12⋅x + 28⎠
- ───────────────────────── - ──────────────────────────
64 64
---------------------------
for 5 <= x <= 6
---------------------------
⎛ 2 ⎞ ⎛ 2 ⎞
(2⋅x - 14)⋅⎝x - 12⋅x + 28⎠ (2⋅x - 12)⋅⎝x - 14⋅x + 41⎠
─────────────────────────── + ───────────────────────────
64 64
---------------------------
for 6 <= x <= 7
---------------------------
x 7
- ─ + ─
4 4
---------------------------
In [40]: # Compute the minimum of three random variables
In [41]: B=Minimum(X,Y,Z)
In [42]: B.display()
continuous pdf
for 2 <= x <= 3
---------------------------
x 1
─ - ─
4 2
---------------------------
for 3 <= x <= 4
---------------------------
x 1
─ - ─
4 2
---------------------------
for 4 <= x <= 5
---------------------------
⎛ 4 3 2 ⎞ ⎛ 2 ⎞ ⎛ 3 2
(2⋅x - 8)⋅⎝x - 10⋅x + 21⋅x + 20⋅x - 4⎠ ⎝x - 8⋅x + 11⎠⋅⎝4⋅x - 30⋅x + 42
───────────────────────────────────────── + ──────────────────────────────────
320 320
⎞
⋅x + 20⎠
────────
---------------------------
for 5 <= x <= 6
---------------------------
⎛ 4 3 2 ⎞ ⎛ 2 ⎞ ⎛ 3 2
(2⋅x - 18)⋅⎝x - 10⋅x + 21⋅x + 20⋅x - 4⎠ ⎝x - 18⋅x + 81⎠⋅⎝4⋅x - 30⋅x
- ────────────────────────────────────────── - ───────────────────────────────
1280 1280
⎞
+ 42⋅x + 20⎠
────────────
---------------------------
In [43]: # Compute the maximum of 3 IID random variables
In [44]: C=MaximumIID(X,3)
In [45]: C.display()
continuous pdf
for 2 <= x <= 4
---------------------------
⎛ 4 3 2 ⎞ ⎛ 2 ⎞ ⎛ 3 2
(2⋅x - 4)⋅⎝x - 8⋅x + 24⋅x - 32⋅x + 16⎠ ⎝x - 4⋅x + 4⎠⋅⎝4⋅x - 24⋅x + 48⋅
───────────────────────────────────────── + ──────────────────────────────────
512 512
⎞
x - 32⎠
───────
---------------------------
for 4 <= x <= 6
---------------------------
⎛ 4 3 2 ⎞ ⎛ 2 ⎞ ⎛ 3
(2⋅x - 12)⋅⎝x - 24⋅x + 200⋅x - 672⋅x + 784⎠ ⎝x - 12⋅x + 28⎠⋅⎝4⋅x - 72
- ────────────────────────────────────────────── - ───────────────────────────
512 512
2 ⎞
⋅x + 400⋅x - 672⎠
──────────────────
---------------------------