![]() Print X.pdf(0.5) # f(0.5), the probability density at 1 X = stats.beta(1, 3) # Declare X to be a beta random variable This example declares $X \sim \text(\alpha = 1, \beta = 3)$: We love the scipy stats library because it defines all the functions you would care about for a random variable, including expectation, variance, and even things we haven't talked about in CS109, like entropy. Make a Binomial Random variable $X$ and compute its probability mass function (PMF) or cumulative density function (CDF). Print special.binom(10, 5) Discrete Random Variables Binomial This example computes $20!$Ĭomputes $n \choose m$ as a float. It is essential that you have this library installed! Counting Functions FactorialĬompute $n!$ as an Integer. The functions in this tutorial come from the scipy python library. ![]() CS109 has a good set of notes from our Python review session (including installation instructions)! Check out. For a tutorial on the basics of python, there are many good online tutorials. This handout only goes over probability functions for Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |