Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ProbablitySpace:
- def __init__(self):
- #sample space
- self.OMEGA = ["one","two","three","four","five","six"]
- def P(self,omega):
- """
- element of sample space -> [0,1]
- """
- measure = {"one":1/6.,"two":1/6.,"three":1/6.,"four":1/6.,"five":1/6.,"six":1/6.}
- return measure[omega]
- def X(self,omega):
- """
- sample space -> X of sample space
- """
- X_sample_space = ["odd","even"]
- X_func = { "one":X_sample_space[0],\
- "two":X_sample_space[1],\
- "three":X_sample_space[0],\
- "four":X_sample_space[1],\
- "five":X_sample_space[0],\
- "six":X_sample_space[1] }
- return X_func[omega]
- def PofX(self,X_omega):
- X_measure = {"odd":1/2.,"even":1/2.}
- return X_measure[X_omega]
- dice = ProbablitySpace()
- dice.OMEGA
- dice.P(dice_trial.OMEGA[0])
- list(map(dice.P,dice.OMEGA))
- dice.X(dice.OMEGA[0])
- dice.PofX(dice.X(dice.OMEGA[0]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement