Advice on following math examples

Hello, I am grateful you made such easy to start with lectures and at the same time with some advanced examples that also freely available.

Personally I have hard time reading some math examples, for example

We wish to generate a discrete random variable x such that ℙ{x=i}=q_i

I don’t know how to read and interpret this math snippet ℙ{x=i}=qi
Can you recommend something ?

This comes from exercise 2 from the NumPy section, doesn’t it?

It is amusing you bring this up, because when I read this, I also found that this could perhaps be formulated a bit more carefully, but maybe I am nitpicking. For myself, I interpreted it as:

“Given $q_0, q_1, \ldots ,q_{n-1}$ non-negative and summing to 1, define a probability space $(\Omega, \mathcal{F}, P)$ and a random variable $X : \Omega \to \mathbb{Z}$ such that $P(X = i) = q_i$ for all $i = 0, \ldots, n-1$.”

The notation $P(X = i)$ (or: $\mathbb{P}\{x = i\}$, as they write it in the lecture) is just shorthand for the probability of the event $\{\omega \in \Omega ,:, X(\omega) = i\} \in \mathcal{F}$. This is not uncommon.

The most natural (but not the only) choice would be to work with $\Omega = [0,1]$ and ordinary length of intervals (i.e. Lebesgue measure). Then the cumsum and searchsorted methods can indeed be used nicely to implement a function that returns a particular realization of $X$ (which I would usually denote by lowercase $x$) for a given choice of the vector $q$.

P.S. There is a nice method for rendering formulas on pages that do not have native support for it, see this topic: Viewing Math on the Discourse Forum

1 Like

Hi @DmitryW, that snippet should be read “the probability that x takes the value i is equal to q_i”. I’ll make a note to clarify that. (@Janssens gives further discussion that is all correct.) Thanks for your feedback.

In terms of reading, I have a hard time finding good elementary probability texts to recommend. Modern probability theory is based on measure theory, which is a big topic in itself. If you do want an introduction to probability at this level you might try this book.

Good luck with your studies.