## “Intensity” channels

Consider a random variable x taking discrete values $$x \in \{x_1,x_2,\ldots,x_n\},$$ with probability mass function $$p(x_i).$$ If all the possible values of x are positive, it turns out that the following is also a valid probability mass function (all positive, sums to 1): $$q(x_i) = p(x_i) \frac{x_i}{E[X]},$$ where $$E[X] = \sum_i x_i p(x_i)$$ is the expected value of x. … [Read more…]

## Knuth shuffle

The Knuth shuffle is a simple, elegant algorithm for randomly permuting a list. It’s not used very often, but it’s one of my favourite algorithms. Here’s how it works: for a list n with elements n, n, …, n[N-1], pick an index uniformly distributed over 0,1,…,N-1. That index is swapped with n. (If you pick … [Read more…]

## Resolution for 2018: Delete MATLAB

Over the past year or so, I’ve been migrating from MATLAB to Anaconda, a free distribution of Python. With the NumPy and PyPlot packages, Anaconda keeps the functionality of plain-vanilla MATLAB while adding the power of the Python language. And if you like graphical IDEs, Anaconda includes Spyder, which replaces the MATLAB graphical environment. Over … [Read more…]