Simple routines for mathematical optimization