generalized math functions; fixes in optimization algorithm for convex
functions