Splitting into equal probability intervals I have some distributions (some of them gaussian and some of them not) for which I know the PDF. 
I would like to split them into intervals of equal probability. I would like to use the PDF of the distributions and to compute the N positions which define equal probability slices
I read about some matlab/python libraries that can compute this, but I would like to understand how this works.
Does anyone know how to do this?
Thank you
 A: To split your support into intervals with given probabilities you can use the quantile function for your distribution.  The quantile function can be defined directly in terms of the density function $f$ as:
$$Q(p) = \inf \Bigg\{ x \in \mathbb{R} \Bigg| p \leqslant \int \limits_{-\infty}^x f(r) dr \Bigg\}.$$
Once you have obtained your quantiles function (and assuming you have a continuous distribution), you can split the support into $m$ equal-probability intervals, where the $i$th interval is:
$$\mathscr{I}_i = (Q(\tfrac{i-1}{m}), Q(\tfrac{i}{m})].$$
(Note that the lowest interval will generally have a closed left bound.  The bounds $Q(0)$ and $Q(1)$ may be negative/positive infinite, in which case you write this boundary as an open interval.)

Example: Consider the case where you have an exponential random variable with scale $\lambda>0$.  This has probability density function:
$$f(x) = \lambda \exp(- \lambda x) \quad \text{for all }x \geqslant 0.$$
The corresponding quantile function is:
$$\begin{equation} \begin{aligned}
Q(p) 
&= \inf \Bigg\{ x \in \mathbb{R} \Bigg| p \leqslant \lambda \int \limits_{-\infty}^x \exp(-\lambda r) dr \Bigg\} \\[6pt]
&= \inf \Bigg\{ x \in \mathbb{R} \Bigg| p \leqslant 1-\exp(-\lambda x) \Bigg\} \\[6pt]
&= \inf \Bigg\{ x \in \mathbb{R} \Bigg| \exp(-\lambda x) \leqslant 1-p \Bigg\} \\[6pt]
&= \inf \Bigg\{ x \in \mathbb{R} \Bigg| -\lambda x \leqslant \ln(1-p) \Bigg\} \\[6pt]
&= \inf \Bigg\{ x \in \mathbb{R} \Bigg| x \geqslant \frac{1}{\lambda} \cdot |\ln(1-p)| \Bigg\} \\[6pt]
&= \frac{1}{\lambda} \cdot |\ln(1-p)|.
\end{aligned} \end{equation}$$
The $i$th equal-probability interval (out of a partition of $m$ intervals) is:
$$\mathscr{I}_i = ( \tfrac{1}{\lambda} |\ln(1-\tfrac{i-1}{m})| , \tfrac{1}{\lambda} |\ln(1-\tfrac{i}{m})| ].$$
(To get a full partition we close the bottom bound for the first interval.  The lower bound for this bottom interval is zero.)
