math functions cdf + pdf, algorithm todo update

From rasbt, sending back upstream