Miscellaneous math functions in python