add functions for discrete analysis