some useful mathematical stuff in python.